Search in sources :

Example 1 with AutoSilencePickerPreference

use of org.omnirom.deskclock.preference.AutoSilencePickerPreference in project android_packages_apps_OmniClock by omnirom.

the class SettingsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(Utils.getThemeResourceId(this));
    getWindow().getDecorView().setBackgroundColor(Utils.getViewBackgroundColor(this));
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    // We don't want to reconstruct the timezone list every single time
    // onResume() is called so we do it once in onCreate
    ListPreference listPref;
    listPref = (ListPreference) findPreference(KEY_HOME_TZ);
    if (mTimezones == null) {
        mTime = System.currentTimeMillis();
        mTimezones = getAllTimezones();
    }
    listPref.setEntryValues(mTimezones[0]);
    listPref.setEntries(mTimezones[1]);
    listPref.setSummary(listPref.getEntry());
    listPref.setOnPreferenceChangeListener(this);
    mTimerAlarmPref = (RingtonePreference) findPreference(KEY_TIMER_ALARM);
    mTimerAlarmPref.setOnPreferenceChangeListener(this);
    mSnoozeMinutes = (NumberPickerPreference) findPreference(KEY_ALARM_SNOOZE_MINUTES);
    mSnoozeMinutes.setValue(Utils.getSnoozeTimeoutValue(this));
    mSnoozeMinutes.setMinValue(1);
    mSnoozeMinutes.setMaxValue(30);
    mSnoozeMinutes.setSummary(getSnoozedMinutes(mSnoozeMinutes.getValue()));
    mSnoozeMinutes.setOnPreferenceChangeListener(this);
    mSilenceMinutes = (AutoSilencePickerPreference) findPreference(KEY_ALARM_SILENCE_AFTER);
    mSilenceMinutes.setValue(Utils.getTimeoutValue(this));
    mSilenceMinutes.setMinValue(1);
    mSilenceMinutes.setMaxValue(30);
    updateSilenceAfterSummary(mSilenceMinutes, mSilenceMinutes.getValue());
    mSilenceMinutes.setOnPreferenceChangeListener(this);
    addSettings();
    if (!getResources().getBoolean(R.bool.config_disableSensorOnWirelessCharging)) {
        Preference p = findPreference(KEY_ALARM_ACTION_WIRELESS_HEADER);
        PreferenceCategory alarmActionsCategory = (PreferenceCategory) findPreference(KEY_ALARM_ACTION_CATEGORY);
        alarmActionsCategory.removePreference(p);
    }
}
Also used : NumberPickerPreference(org.omnirom.deskclock.preference.NumberPickerPreference) CheckBoxPreference(android.preference.CheckBoxPreference) AutoSilencePickerPreference(org.omnirom.deskclock.preference.AutoSilencePickerPreference) RingtonePreference(android.preference.RingtonePreference) ListPreference(android.preference.ListPreference) Preference(android.preference.Preference) PreferenceCategory(android.preference.PreferenceCategory) ListPreference(android.preference.ListPreference)

Aggregations

CheckBoxPreference (android.preference.CheckBoxPreference)1 ListPreference (android.preference.ListPreference)1 Preference (android.preference.Preference)1 PreferenceCategory (android.preference.PreferenceCategory)1 RingtonePreference (android.preference.RingtonePreference)1 AutoSilencePickerPreference (org.omnirom.deskclock.preference.AutoSilencePickerPreference)1 NumberPickerPreference (org.omnirom.deskclock.preference.NumberPickerPreference)1