use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LocationMode method createPreferenceHierarchy.
private PreferenceScreen createPreferenceHierarchy() {
PreferenceScreen root = getPreferenceScreen();
if (root != null) {
root.removeAll();
}
addPreferencesFromResource(R.xml.location_mode);
root = getPreferenceScreen();
mHighAccuracy = (RadioButtonPreference) root.findPreference(KEY_HIGH_ACCURACY);
mBatterySaving = (RadioButtonPreference) root.findPreference(KEY_BATTERY_SAVING);
mSensorsOnly = (RadioButtonPreference) root.findPreference(KEY_SENSORS_ONLY);
mHighAccuracy.setOnClickListener(this);
mBatterySaving.setOnClickListener(this);
mSensorsOnly.setOnClickListener(this);
refreshLocationMode();
return root;
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkTrafficSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.network_traffic_settings);
ContentResolver resolver = getActivity().getContentResolver();
PreferenceScreen prefSet = getPreferenceScreen();
loadResources();
mNetTrafficState = (ListPreference) prefSet.findPreference(NETWORK_TRAFFIC_STATE);
mNetTrafficUnit = (ListPreference) prefSet.findPreference(NETWORK_TRAFFIC_UNIT);
mNetTrafficPeriod = (ListPreference) prefSet.findPreference(NETWORK_TRAFFIC_PERIOD);
mNetTrafficAutohide = (SwitchPreference) prefSet.findPreference(NETWORK_TRAFFIC_AUTOHIDE);
mNetTrafficAutohide.setChecked((Settings.System.getInt(getContentResolver(), Settings.System.NETWORK_TRAFFIC_AUTOHIDE, 0) == 1));
mNetTrafficAutohide.setOnPreferenceChangeListener(this);
mNetTrafficAutohideThreshold = (SeekBarPreference) prefSet.findPreference(NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD);
int netTrafficAutohideThreshold = Settings.System.getInt(resolver, Settings.System.NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD, 10);
mNetTrafficAutohideThreshold.setValue(netTrafficAutohideThreshold / 1);
mNetTrafficAutohideThreshold.setOnPreferenceChangeListener(this);
mNetTrafficColor = (ColorPickerPreference) prefSet.findPreference(NETWORK_TRAFFIC_COLOR);
mNetTrafficColor.setOnPreferenceChangeListener(this);
int intColor = Settings.System.getInt(getContentResolver(), Settings.System.NETWORK_TRAFFIC_COLOR, 0xffffffff);
String hexColor = String.format("#%08x", (0xffffffff & intColor));
mNetTrafficColor.setSummary(hexColor);
mNetTrafficColor.setNewPreviewColor(intColor);
// TrafficStats will return UNSUPPORTED if the device does not support it.
if (TrafficStats.getTotalTxBytes() != TrafficStats.UNSUPPORTED && TrafficStats.getTotalRxBytes() != TrafficStats.UNSUPPORTED) {
mNetTrafficVal = Settings.System.getInt(resolver, Settings.System.NETWORK_TRAFFIC_STATE, 0);
int intIndex = mNetTrafficVal & (MASK_UP + MASK_DOWN);
intIndex = mNetTrafficState.findIndexOfValue(String.valueOf(intIndex));
if (intIndex <= 0) {
mNetTrafficUnit.setEnabled(false);
mNetTrafficPeriod.setEnabled(false);
mNetTrafficAutohide.setEnabled(false);
mNetTrafficAutohideThreshold.setEnabled(false);
mNetTrafficColor.setEnabled(false);
}
mNetTrafficState.setValueIndex(intIndex >= 0 ? intIndex : 0);
mNetTrafficState.setSummary(mNetTrafficState.getEntry());
mNetTrafficState.setOnPreferenceChangeListener(this);
mNetTrafficUnit.setValueIndex(getBit(mNetTrafficVal, MASK_UNIT) ? 1 : 0);
mNetTrafficUnit.setSummary(mNetTrafficUnit.getEntry());
mNetTrafficUnit.setOnPreferenceChangeListener(this);
intIndex = (mNetTrafficVal & MASK_PERIOD) >>> 16;
intIndex = mNetTrafficPeriod.findIndexOfValue(String.valueOf(intIndex));
mNetTrafficPeriod.setValueIndex(intIndex >= 0 ? intIndex : 1);
mNetTrafficPeriod.setSummary(mNetTrafficPeriod.getEntry());
mNetTrafficPeriod.setOnPreferenceChangeListener(this);
} else {
prefSet.removePreference(findPreference(NETWORK_TRAFFIC_STATE));
prefSet.removePreference(findPreference(NETWORK_TRAFFIC_UNIT));
prefSet.removePreference(findPreference(NETWORK_TRAFFIC_PERIOD));
prefSet.removePreference(findPreference(NETWORK_TRAFFIC_AUTOHIDE));
prefSet.removePreference(findPreference(NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD));
prefSet.removePreference(findPreference(NETWORK_TRAFFIC_COLOR));
}
}
use of android.support.v7.preference.PreferenceScreen 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.PreferenceScreen 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.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PowerMenuSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.rr_power_menu);
PreferenceScreen prefSet = getPreferenceScreen();
final ContentResolver resolver = getActivity().getContentResolver();
// Power menu alpha
mPowerMenuAlpha = (SeekBarPreference) prefSet.findPreference(PREF_TRANSPARENT_POWER_MENU);
int powerMenuAlpha = Settings.System.getInt(resolver, Settings.System.TRANSPARENT_POWER_MENU, 100);
mPowerMenuAlpha.setValue(powerMenuAlpha / 1);
mPowerMenuAlpha.setOnPreferenceChangeListener(this);
// Power/reboot dialog dim
mPowerDialogDim = (SeekBarPreference) prefSet.findPreference(PREF_TRANSPARENT_POWER_DIALOG_DIM);
int powerDialogDim = Settings.System.getInt(resolver, Settings.System.TRANSPARENT_POWER_DIALOG_DIM, 50);
mPowerDialogDim.setValue(powerDialogDim / 1);
mPowerDialogDim.setOnPreferenceChangeListener(this);
}
Aggregations