private void refreshSettings() { pInterval.setEnabled(AppSettings.isNotifyEnable()); pNightClose.setEnabled(AppSettings.isNotifyEnable()); pStatusMention.setEnabled(AppSettings.isNotifyEnable()); pCommentMention.setEnabled(AppSettings.isNotifyEnable()); pFollower.setEnabled(AppSettings.isNotifyEnable()); pComment.setEnabled(AppSettings.isNotifyEnable()); pNotifySound.setEnabled(AppSettings.isNotifyEnable()); pNotifyVibrate.setEnabled(AppSettings.isNotifyEnable()); pNotifyLED.setEnabled(AppSettings.isNotifyEnable()); pDm.setEnabled(AppSettings.isNotifyEnable()); }
public static void checkXposed(Preference pref) { if (pref == null) { return; } checkBoxPreference = (CheckBoxPreference) pref; // gray out the fixDownloadManagerLeak preference if xposed module is not activated Log.i(Api.TAG, "Checking Xposed:" + G.isXposedEnabled() + ""); checkBoxPreference.setEnabled(G.isXposedEnabled()); }
private void setupLogHostname(Preference showHostName) { CheckBoxPreference showHost = (CheckBoxPreference) showHostName; if (G.isDoKey(getActivity()) || G.isDonate()) { showHost.setEnabled(true); } /* if(!Api.isAFWallAllowed((Context) getActivity())){ showHost.setChecked(false); }*/ }
public boolean onRunConditionPreferenceChange(Preference preference, Object o) { switch (preference.getKey()) { case Constants.PREF_POWER_SOURCE: mPowerSource.setValue(o.toString()); preference.setSummary(mPowerSource.getEntry()); break; case Constants.PREF_RUN_ON_WIFI: mRunOnMeteredWifi.setEnabled((Boolean) o); mWifiSsidWhitelist.setEnabled((Boolean) o); break; case Constants.PREF_WIFI_SSID_WHITELIST: String wifiSsidSummary = TextUtils.join(", ", (Set<String>) o); preference.setSummary(TextUtils.isEmpty(wifiSsidSummary) ? getString(R.string.run_on_all_wifi_networks) : getString(R.string.run_on_whitelisted_wifi_networks, wifiSsidSummary) ); break; } mPendingRunConditions = true; return true; }
private void setupDeviceSecurityCheck(Preference pref) { PreferenceCategory mCategory = (PreferenceCategory) findPreference("securitySetting"); enableDeviceCheckPref = (CheckBoxPreference) pref; if (Build.VERSION.SDK_INT >= 21) { //only for donate version if ((G.isDoKey(getActivity()) || G.isDonate())) { if (globalContext != null) { KeyguardManager keyguardManager = (KeyguardManager) globalContext.getSystemService(KEYGUARD_SERVICE); //enable only when keyguard has set if (keyguardManager.isKeyguardSecure()) { enableDeviceCheckPref.setEnabled(true); } else { enableDeviceCheckPref.setEnabled(false); enableDeviceCheckPref.setChecked(false); } } } else { enableDeviceCheckPref.setEnabled(false); enableDeviceCheckPref.setChecked(false); } } else { //remove this option for older devices mCategory.removePreference(enableDeviceCheckPref); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.rules_preferences); try { updateRuleStatus(); } catch (Exception e) { } //make sure Roaming is disable in Wifi-only Tablets if (!Api.isMobileNetworkSupported(getActivity())) { CheckBoxPreference roamPreference = (CheckBoxPreference) findPreference("enableRoam"); roamPreference.setChecked(false); roamPreference.setEnabled(false); } else { CheckBoxPreference roamPreference = (CheckBoxPreference) findPreference("enableRoam"); roamPreference.setEnabled(true); } }
public void setupFixLeak(Preference pref, Context ctx) { if (pref == null) { return; } CheckBoxPreference fixLeakPref = (CheckBoxPreference) pref; if (fixLeakPref.isEnabled()) { // gray out the fixLeak preference if the ROM doesn't support init.d updateLeakCheckbox(); fixLeakPref.setEnabled(getFixLeakPath(initScript) != null && !isPackageInstalled("com.androguide.universal.init.d", ctx)); } }
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals("fixLeak")) { boolean enabled = G.fixLeak(); Activity activity = getActivity(); new Thread(() -> { if (enabled != isFixLeakInstalled()) { activity.runOnUiThread(() -> updateFixLeakScript(enabled)); } }).start(); } if (key.equals("initPath")) { if (G.initPath() != null) { CheckBoxPreference fixPath = (CheckBoxPreference) findPreference("fixLeak"); fixPath.setEnabled(true); } } if (key.equals("multiUser")) { if (!Api.supportsMultipleUsers(this.getActivity().getApplicationContext())) { CheckBoxPreference multiUserPref = (CheckBoxPreference) findPreference(key); multiUserPref.setChecked(false); } else { Api.setUserOwner(this.getActivity().getApplicationContext()); } } }
} else { CheckBoxPreference fixLeakPref = (CheckBoxPreference) findPreference("fixLeak"); fixLeakPref.setEnabled(false);
final ListPreference patternMaxTry = (ListPreference) findPreference("patternMax"); final CheckBoxPreference stealthMode = (CheckBoxPreference) findPreference("stealthMode"); if (stealthMode != null) stealthMode.setEnabled(true); if (patternMaxTry != null) patternMaxTry.setEnabled(true);
/** Updates the device capabilities area (dis/enabling) as the admin is (de)activated */ private void enableDeviceCapabilitiesArea(boolean enabled) { mDisableCameraCheckbox.setEnabled(enabled); mDisableKeyguardWidgetsCheckbox.setEnabled(enabled); mDisableKeyguardSecureCameraCheckbox.setEnabled(enabled); mDisableKeyguardNotificationCheckbox.setEnabled(enabled); mDisableKeyguardUnredactedCheckbox.setEnabled(enabled); mDisableKeyguardTrustAgentCheckbox.setEnabled(enabled); } }
final ListPreference patternMaxTry = (ListPreference) findPreference("patternMax"); final CheckBoxPreference stealthMode = (CheckBoxPreference) findPreference("stealthMode"); stealthMode.setEnabled(false); patternMaxTry.setEnabled(false); switch (itemList.getValue()) {
private void setScrobblingOptionsRestEnabled(AdvancedOptions ao) { ongoing.setEnabled(ao == AdvancedOptions.CUSTOM); notify.setEnabled(ao == AdvancedOptions.CUSTOM); scrobble.setEnabled(ao == AdvancedOptions.CUSTOM); np.setEnabled(ao == AdvancedOptions.CUSTOM); when.setEnabled(ao == AdvancedOptions.CUSTOM); also_on_complete.setEnabled(ao == AdvancedOptions.CUSTOM); net.setEnabled(ao == AdvancedOptions.CUSTOM); roaming.setEnabled(ao == AdvancedOptions.CUSTOM); }
/** Updates the device capabilities area (dis/enabling) as the admin is (de)activated */ private void enableDeviceCapabilitiesArea(boolean enabled) { mDisableCameraCheckbox.setEnabled(enabled); mDisableKeyguardWidgetsCheckbox.setEnabled(enabled); mDisableKeyguardSecureCameraCheckbox.setEnabled(enabled); mDisableKeyguardNotificationCheckbox.setEnabled(enabled); mDisableKeyguardUnredactedCheckbox.setEnabled(enabled); mDisableKeyguardTrustAgentCheckbox.setEnabled(enabled); mTrustAgentComponent.setEnabled(enabled); mTrustAgentFeatures.setEnabled(enabled); } }
@Override public void run() { if (syncAutofillToggled) { // If the user checks the autofill sync checkbox, then enable and check the // payments integration checkbox. // // If the user unchecks the autofill sync checkbox, then disable and uncheck // the payments integration checkbox. mPaymentsIntegration.setEnabled(preferenceChecked); mPaymentsIntegration.setChecked(preferenceChecked); } maybeDisableSync(); } });
Preference appVersion = screen.findPreference("app_version"); mRunOnMeteredWifi.setEnabled(mRunOnWifi.isChecked()); mWifiSsidWhitelist.setEnabled(mRunOnWifi.isChecked());
public void setForegroundBackground(final boolean checked) { final CheckBoxPreference preference = (CheckBoxPreference) findPreference(Preferences.FOREGROUND); preference.setChecked(checked); preference.setEnabled(!checked); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_other); setHasOptionsMenu(true); Settings settings = (Settings) getActivity(); settings.preferenceImmersiveMode = (CheckBoxPreference) findPreference(getString(R.string.pref_key_immersive_mode)); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { settings.preferenceImmersiveMode.setEnabled(false); } } }
public void toggleVisibility() { boolean enabled = account != null; if (pollEvents != null && vmsSearchQuery != null) { // also the others pollEvents.setEnabled(enabled); connectionNotification.setEnabled(enabled); periodicSync.setEnabled(enabled); maxEventsPolled.setEnabled(enabled); maxEventsStored.setEnabled(enabled); eventsSearchQuery.setEnabled(enabled); maxVmsPolled.setEnabled(enabled); vmsSearchQuery.setEnabled(enabled); } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); addPreferencesFromResource(R.xml.preferences_advanced); toolbarInterface.setTitle(getString(R.string.pref_advanced_settings)); findPreference("send_debug_logfile_enabled").setOnPreferenceClickListener(this); findPreference("clear_database").setOnPreferenceClickListener(this); findPreference("clear_search_history").setOnPreferenceClickListener(this); findPreference("clear_icon_cache").setOnPreferenceClickListener(this); notificationsEnabledPreference = (CheckBoxPreference) findPreference("notifications_enabled"); notificationsEnabledPreference.setOnPreferenceClickListener(this); notificationsEnabledPreference.setEnabled(isUnlocked); }