use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ClockSettings method createCustomView.
private PreferenceScreen createCustomView() {
mCheckPreferences = false;
addPreferencesFromResource(R.xml.rr_clock);
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
PackageManager pm = getPackageManager();
Resources systemUiResources;
try {
systemUiResources = pm.getResourcesForApplication("com.android.systemui");
} catch (Exception e) {
Log.e(TAG, "can't access systemui resources", e);
return null;
}
mStatusBarClock = (ListPreference) findPreference(STATUS_BAR_CLOCK_STYLE);
mStatusBarAmPm = (ListPreference) findPreference(STATUS_BAR_AM_PM);
mStatusBarDate = (ListPreference) findPreference(STATUS_BAR_DATE);
mStatusBarDateStyle = (ListPreference) findPreference(STATUS_BAR_DATE_STYLE);
mStatusBarDateFormat = (ListPreference) findPreference(STATUS_BAR_DATE_FORMAT);
mStatusBarClockSeconds = (SwitchPreference) findPreference(STATUS_BAR_CLOCK_SECONDS);
mStatusBarClockSeconds.setChecked((Settings.System.getInt(getActivity().getApplicationContext().getContentResolver(), Settings.System.STATUS_BAR_CLOCK_SECONDS, 0) == 1));
mStatusBarClockSeconds.setOnPreferenceChangeListener(this);
int clockStyle = CMSettings.System.getInt(resolver, CMSettings.System.STATUS_BAR_CLOCK, 0);
mStatusBarClock.setValue(String.valueOf(clockStyle));
mStatusBarClock.setSummary(mStatusBarClock.getEntry());
mStatusBarClock.setOnPreferenceChangeListener(this);
if (DateFormat.is24HourFormat(getActivity())) {
mStatusBarAmPm.setEnabled(false);
mStatusBarAmPm.setSummary(R.string.status_bar_am_pm_info);
} else {
int statusBarAmPm = CMSettings.System.getInt(resolver, CMSettings.System.STATUS_BAR_AM_PM, 2);
mStatusBarAmPm.setValue(String.valueOf(statusBarAmPm));
mStatusBarAmPm.setSummary(mStatusBarAmPm.getEntry());
mStatusBarAmPm.setOnPreferenceChangeListener(this);
}
int showDate = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_DATE, 0);
mStatusBarDate.setValue(String.valueOf(showDate));
mStatusBarDate.setSummary(mStatusBarDate.getEntry());
mStatusBarDate.setOnPreferenceChangeListener(this);
int dateStyle = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_DATE_STYLE, 0);
mStatusBarDateStyle.setValue(String.valueOf(dateStyle));
mStatusBarDateStyle.setSummary(mStatusBarDateStyle.getEntry());
mStatusBarDateStyle.setOnPreferenceChangeListener(this);
mClockDatePosition = (ListPreference) findPreference(PREF_CLOCK_DATE_POSITION);
mClockDatePosition.setOnPreferenceChangeListener(this);
mClockDatePosition.setValue(Integer.toString(Settings.System.getInt(resolver, Settings.System.STATUSBAR_CLOCK_DATE_POSITION, 0)));
mClockDatePosition.setSummary(mClockDatePosition.getEntry());
mStatusBarDateFormat.setOnPreferenceChangeListener(this);
mStatusBarDateFormat.setSummary(mStatusBarDateFormat.getEntry());
if (mStatusBarDateFormat.getValue() == null) {
mStatusBarDateFormat.setValue("EEE");
}
parseClockDateFormats();
mFontStyle = (ListPreference) findPreference(PREF_FONT_STYLE);
mFontStyle.setOnPreferenceChangeListener(this);
mFontStyle.setValue(Integer.toString(Settings.System.getInt(getActivity().getContentResolver(), Settings.System.STATUSBAR_CLOCK_FONT_STYLE, 0)));
mFontStyle.setSummary(mFontStyle.getEntry());
mStatusBarClockFontSize = (SeekBarPreference) findPreference(PREF_STATUS_BAR_CLOCK_FONT_SIZE);
int size = Settings.System.getInt(getContentResolver(), Settings.System.STATUSBAR_CLOCK_FONT_SIZE, 14);
mStatusBarClockFontSize.setValue(size);
mStatusBarClockFontSize.setOnPreferenceChangeListener(this);
setHasOptionsMenu(true);
mCheckPreferences = true;
return prefSet;
}
use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CustomLogo method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.custom_logo);
PreferenceScreen prefSet = getPreferenceScreen();
// custom logo color
mCustomLogoColor = (ColorPickerPreference) prefSet.findPreference(KEY_CUSTOM_LOGO_COLOR);
mCustomLogoColor.setOnPreferenceChangeListener(this);
int intColor = Settings.System.getInt(getContentResolver(), Settings.System.CUSTOM_LOGO_COLOR, 0xffffffff);
String hexColor = String.format("#%08x", (0xffffffff & intColor));
mCustomLogoColor.setSummary(hexColor);
mCustomLogoColor.setNewPreviewColor(intColor);
mCustomLogoStyle = (ListPreference) findPreference(KEY_CUSTOM_LOGO_STYLE);
int LogoStyle = Settings.System.getIntForUser(getContentResolver(), Settings.System.CUSTOM_LOGO_STYLE, 0, UserHandle.USER_CURRENT);
mCustomLogoStyle.setValue(String.valueOf(LogoStyle));
mCustomLogoStyle.setSummary(mCustomLogoStyle.getEntry());
mCustomLogoStyle.setOnPreferenceChangeListener(this);
mCustomLogoPos = (ListPreference) findPreference(KEY_CUSTOM_LOGO_POS);
int cLogopos = Settings.System.getIntForUser(getContentResolver(), Settings.System.CUSTOM_LOGO_POSITION, 0, UserHandle.USER_CURRENT);
mCustomLogoPos.setValue(String.valueOf(cLogopos));
mCustomLogoPos.setSummary(mCustomLogoPos.getEntry());
mCustomLogoPos.setOnPreferenceChangeListener(this);
}
use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RecentsClearAll method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_recents_clear_all_fragment);
final ContentResolver resolver = getContentResolver();
final PreferenceScreen prefSet = getPreferenceScreen();
final Resources res = getResources();
mRecentsClearAll = (SwitchPreference) prefSet.findPreference(SHOW_CLEAR_ALL_RECENTS);
mRecentsClearAll.setChecked(Settings.System.getIntForUser(resolver, Settings.System.SHOW_CLEAR_ALL_RECENTS, 1, UserHandle.USER_CURRENT) == 1);
mRecentsClearAll.setOnPreferenceChangeListener(this);
mRecentsClearAllLocation = (ListPreference) prefSet.findPreference(RECENTS_CLEAR_ALL_LOCATION);
int location = Settings.System.getIntForUser(resolver, Settings.System.RECENTS_CLEAR_ALL_LOCATION, 3, UserHandle.USER_CURRENT);
mRecentsClearAllLocation.setValue(String.valueOf(location));
mRecentsClearAllLocation.setSummary(mRecentsClearAllLocation.getEntry());
mRecentsClearAllLocation.setOnPreferenceChangeListener(this);
}
use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class QsPullDown method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_qs_pulldown);
mContext = getActivity().getApplicationContext();
mContentRes = getActivity().getContentResolver();
final Resources res = getResources();
PreferenceScreen prefs = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
mSmartPulldown = (ListPreference) findPreference(PREF_SMART_PULLDOWN);
mSmartPulldown.setOnPreferenceChangeListener(this);
int smartPulldown = Settings.System.getInt(resolver, Settings.System.QS_SMART_PULLDOWN, 0);
mSmartPulldown.setValue(String.valueOf(smartPulldown));
updateSmartPulldownSummary(smartPulldown);
mQuickPulldown = (ListPreference) findPreference(STATUS_BAR_QUICK_QS_PULLDOWN);
int quickPulldown = CMSettings.System.getInt(resolver, CMSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 0);
mQuickPulldown.setValue(String.valueOf(quickPulldown));
if (quickPulldown == 0) {
// quick pulldown deactivated
mQuickPulldown.setSummary(res.getString(R.string.status_bar_quick_qs_pulldown_off));
} else {
String direction = res.getString(quickPulldown == 2 ? R.string.status_bar_quick_qs_pulldown_left : R.string.status_bar_quick_qs_pulldown_right);
mQuickPulldown.setSummary(res.getString(R.string.status_bar_quick_qs_pulldown_summary, direction));
}
mQuickPulldown.setOnPreferenceChangeListener(this);
mQuickPulldownFp = (SystemSettingSwitchPreference) findPreference(PREF_QUICK_PULLDOWN_FP);
if (!getResources().getBoolean(com.android.internal.R.bool.config_supportSystemNavigationKeys)) {
getPreferenceScreen().removePreference(mQuickPulldownFp);
} else {
mQuickPulldownFp.setChecked((Settings.System.getInt(getContentResolver(), Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN_FP, 0) == 1));
mQuickPulldownFp.setOnPreferenceChangeListener(this);
}
}
use of android.support.v7.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RecentsUI method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_recents_ui);
final ContentResolver resolver = getContentResolver();
final PreferenceScreen prefScreen = getPreferenceScreen();
final Resources res = getResources();
mImmersiveRecents = (ListPreference) findPreference(IMMERSIVE_RECENTS);
mImmersiveRecents.setValue(String.valueOf(Settings.System.getInt(getContentResolver(), Settings.System.IMMERSIVE_RECENTS, 0)));
mImmersiveRecents.setSummary(mImmersiveRecents.getEntry());
mImmersiveRecents.setOnPreferenceChangeListener(this);
}
Aggregations