use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DevelopmentSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
mWebViewUpdateService = IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
mOemUnlockManager = (PersistentDataBlockManager) getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mDpm = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
setIfOnlyAvailableForAdmins(true);
if (isUiRestricted() || !Utils.isDeviceProvisioned(getActivity())) {
// Block access to developer options if the user is not the owner, if user policy
// restricts it, or if the device has not been provisioned
mUnavailable = true;
setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
return;
}
addPreferencesFromResource(R.xml.development_prefs);
final PreferenceGroup debugDebuggingCategory = (PreferenceGroup) findPreference(DEBUG_DEBUGGING_CATEGORY_KEY);
mEnableAdb = findAndInitSwitchPref(ENABLE_ADB);
mAdbAlwaysNotify = findAndInitSwitchPref(ADB_ALWAYS_NOTIFY);
mAdbOverNetwork = findAndInitSwitchPref(ADB_TCPIP);
mClearAdbKeys = findPreference(CLEAR_ADB_KEYS);
if (!SystemProperties.getBoolean("ro.adb.secure", false)) {
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mClearAdbKeys);
}
}
mAllPrefs.add(mClearAdbKeys);
mEnableTerminal = findAndInitSwitchPref(ENABLE_TERMINAL);
if (!isPackageInstalled(getActivity(), TERMINAL_APP_PACKAGE)) {
debugDebuggingCategory.removePreference(mEnableTerminal);
mEnableTerminal = null;
}
mBugreport = findPreference(BUGREPORT);
mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
mEnableOemUnlock = (RestrictedSwitchPreference) findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
if (!showEnableOemUnlockPreference()) {
removePreference(mEnableOemUnlock);
mEnableOemUnlock = null;
}
mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES);
mForceAllowOnExternal = findAndInitSwitchPref(FORCE_ALLOW_ON_EXTERNAL_KEY);
mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);
mAllPrefs.add(mPassword);
mForceAuthorizeSubstratumPackages = findAndInitSwitchPref(FORCE_AUTHORIZE_SUBSTRATUM_PACKAGES);
if (!mUm.isAdminUser()) {
disableForUser(mEnableAdb);
disableForUser(mClearAdbKeys);
disableForUser(mEnableTerminal);
disableForUser(mPassword);
disableForUser(mForceAuthorizeSubstratumPackages);
}
mDebugAppPref = findPreference(DEBUG_APP_KEY);
mAllPrefs.add(mDebugAppPref);
mWaitForDebugger = findAndInitSwitchPref(WAIT_FOR_DEBUGGER_KEY);
mMockLocationAppPref = findPreference(MOCK_LOCATION_APP_KEY);
mAllPrefs.add(mMockLocationAppPref);
mVerifyAppsOverUsb = findAndInitSwitchPref(VERIFY_APPS_OVER_USB_KEY);
if (!showVerifierSetting()) {
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mVerifyAppsOverUsb);
} else {
mVerifyAppsOverUsb.setEnabled(false);
}
}
mStrictMode = findAndInitSwitchPref(STRICT_MODE_KEY);
mPointerLocation = findAndInitSwitchPref(POINTER_LOCATION_KEY);
mShowTouches = findAndInitSwitchPref(SHOW_TOUCHES_KEY);
mShowScreenUpdates = findAndInitSwitchPref(SHOW_SCREEN_UPDATES_KEY);
mDisableOverlays = findAndInitSwitchPref(DISABLE_OVERLAYS_KEY);
mShowCpuInfo = findAndInitSwitchPref(SHOW_CPU_INFO_KEY);
mForceHardwareUi = findAndInitSwitchPref(FORCE_HARDWARE_UI_KEY);
mForceMsaa = findAndInitSwitchPref(FORCE_MSAA_KEY);
mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
mShowHwScreenUpdates = findAndInitSwitchPref(SHOW_HW_SCREEN_UPDATES_KEY);
mShowHwLayersUpdates = findAndInitSwitchPref(SHOW_HW_LAYERS_UPDATES_KEY);
mDebugLayout = findAndInitSwitchPref(DEBUG_LAYOUT_KEY);
mForceRtlLayout = findAndInitSwitchPref(FORCE_RTL_LAYOUT_KEY);
mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
mWifiDisplayCertification = findAndInitSwitchPref(WIFI_DISPLAY_CERTIFICATION_KEY);
mWifiVerboseLogging = findAndInitSwitchPref(WIFI_VERBOSE_LOGGING_KEY);
mWifiAggressiveHandover = findAndInitSwitchPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
if ("1".equals(SystemProperties.get("ro.debuggable", "0"))) {
mLogpersist = addListPreference(SELECT_LOGPERSIST_KEY);
} else {
mLogpersist = (ListPreference) findPreference(SELECT_LOGPERSIST_KEY);
if (mLogpersist != null) {
mLogpersist.setEnabled(false);
if (debugDebuggingCategory != null) {
debugDebuggingCategory.removePreference(mLogpersist);
}
}
mLogpersist = null;
}
mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
mWebViewProvider = addListPreference(WEBVIEW_PROVIDER_KEY);
mWebViewMultiprocess = findAndInitSwitchPref(WEBVIEW_MULTIPROCESS_KEY);
mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
mForceResizable = findAndInitSwitchPref(FORCE_RESIZABLE_KEY);
mWindowAnimationScale = findAndInitAnimationScalePreference(WINDOW_ANIMATION_SCALE_KEY);
mTransitionAnimationScale = findAndInitAnimationScalePreference(TRANSITION_ANIMATION_SCALE_KEY);
mAnimatorDurationScale = findAndInitAnimationScalePreference(ANIMATOR_DURATION_SCALE_KEY);
mImmediatelyDestroyActivities = (SwitchPreference) findPreference(IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
mAllPrefs.add(mImmediatelyDestroyActivities);
mResetSwitchPrefs.add(mImmediatelyDestroyActivities);
mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
mShowAllANRs = (SwitchPreference) findPreference(SHOW_ALL_ANRS_KEY);
mAllPrefs.add(mShowAllANRs);
mResetSwitchPrefs.add(mShowAllANRs);
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
removePreferenceForProduction(hdcpChecking);
}
PreferenceScreen convertFbePreference = (PreferenceScreen) findPreference(KEY_CONVERT_FBE);
try {
IBinder service = ServiceManager.getService("mount");
IMountService mountService = IMountService.Stub.asInterface(service);
if (!mountService.isConvertibleToFBE()) {
removePreference(KEY_CONVERT_FBE);
} else if ("file".equals(SystemProperties.get("ro.crypto.type", "none"))) {
convertFbePreference.setEnabled(false);
convertFbePreference.setSummary(getResources().getString(R.string.convert_to_file_encryption_done));
}
} catch (RemoteException e) {
removePreference(KEY_CONVERT_FBE);
}
mOtaDisableAutomaticUpdate = findAndInitSwitchPref(OTA_DISABLE_AUTOMATIC_UPDATE_KEY);
if (!SystemProperties.getBoolean("ro.build.ab_update", false)) {
removePreference(mOtaDisableAutomaticUpdate);
mOtaDisableAutomaticUpdate = null;
}
mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
mColorModePreference.updateCurrentAndSupported();
if (mColorModePreference.getColorModeCount() < 2) {
removePreference(KEY_COLOR_MODE);
mColorModePreference = null;
}
updateWebViewProviderOptions();
mColorTemperaturePreference = (SwitchPreference) findPreference(COLOR_TEMPERATURE_KEY);
if (getResources().getBoolean(R.bool.config_enableColorTemperature)) {
mAllPrefs.add(mColorTemperaturePreference);
mResetSwitchPrefs.add(mColorTemperaturePreference);
} else {
removePreference(COLOR_TEMPERATURE_KEY);
mColorTemperaturePreference = null;
}
mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY);
mRootAccess.setOnPreferenceChangeListener(this);
mRootAppops = (Preference) findPreference(ROOT_APPOPS_KEY);
mRootAppops.setOnPreferenceClickListener(this);
if (!removeRootOptionsIfRequired()) {
if (FileUtils.fileExists("/system/xbin/su")) {
mRootAccess.setEntries(R.array.root_access_entries);
mRootAccess.setEntryValues(R.array.root_access_values);
} else {
mRootAccess.setEntries(R.array.root_access_entries_adb);
mRootAccess.setEntryValues(R.array.root_access_values_adb);
}
mAllPrefs.add(mRootAccess);
mAllPrefs.add(mRootAppops);
}
mDevelopmentTools = (PreferenceScreen) findPreference(DEVELOPMENT_TOOLS);
mAllPrefs.add(mDevelopmentTools);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BreathingNotifications method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_breathing_notif);
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
Context context = getActivity();
mMissedCallBreath = (SwitchPreference) findPreference(MISSED_CALL_BREATH);
mMissedCallBreath.setChecked(Settings.System.getInt(resolver, Settings.System.KEY_MISSED_CALL_BREATH, 0) == 1);
mMissedCallBreath.setOnPreferenceChangeListener(this);
mVoicemailBreath = (SwitchPreference) findPreference(VOICEMAIL_BREATH);
mVoicemailBreath.setChecked(Settings.System.getInt(resolver, Settings.System.KEY_VOICEMAIL_BREATH, 0) == 1);
mVoicemailBreath.setOnPreferenceChangeListener(this);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EmptyShadeViewSettings method refreshSettings.
public void refreshSettings() {
PreferenceScreen prefs = getPreferenceScreen();
if (prefs != null) {
prefs.removeAll();
}
addPreferencesFromResource(R.xml.empty_shade_view_settings);
mResolver = getContentResolver();
final boolean showCarrierName = Settings.System.getInt(mResolver, Settings.System.EMPTY_SHADE_VIEW_SHOW_CARRIER_NAME, 0) == 1;
final boolean showWifiName = Settings.System.getInt(mResolver, Settings.System.EMPTY_SHADE_VIEW_SHOW_WIFI_NAME, 0) == 1;
final boolean supportsMobileData = DeviceUtils.deviceSupportsMobileData(getActivity());
if (supportsMobileData) {
mShowCarrierName = (SwitchPreference) findPreference(PREF_SHOW_CARRIER_NAME);
mShowCarrierName.setChecked(showCarrierName);
mShowCarrierName.setOnPreferenceChangeListener(this);
} else {
removePreference(PREF_SHOW_CARRIER_NAME);
}
mShowWifiName = (SwitchPreference) findPreference(PREF_SHOW_WIFI_NAME);
mShowWifiName.setChecked(showWifiName);
mShowWifiName.setOnPreferenceChangeListener(this);
if ((showCarrierName && supportsMobileData) || showWifiName) {
mTextColor = (ColorPickerPreference) findPreference(PREF_TEXT_COLOR);
int intColor = Settings.System.getInt(mResolver, Settings.System.EMPTY_SHADE_VIEW_TEXT_COLOR, WHITE);
mTextColor.setNewPreviewColor(intColor);
String hexColor = String.format("#%08x", (0xffffffff & intColor));
mTextColor.setSummary(hexColor);
mTextColor.setOnPreferenceChangeListener(this);
} else {
removePreference(PREF_TEXT_COLOR);
}
}
use of android.support.v7.preference.PreferenceScreen 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.PreferenceScreen 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);
}
Aggregations