private void removeUnnecessaryAdvancedPrefs(PreferenceScreen screen) { PreferenceCategory plugins = (PreferenceCategory) screen.findPreference("category_plugins"); // Disable the emoji/kana buttons to scroll preference if those keys don't exist if (!CompatHelper.hasKanaAndEmojiKeys()) { CheckBoxPreference emojiScrolling = (CheckBoxPreference) screen.findPreference("scrolling_buttons"); if (emojiScrolling != null && plugins != null) { plugins.removePreference(emojiScrolling); } } // Disable the double scroll preference if no scrolling keys if (!CompatHelper.hasScrollKeys() && !CompatHelper.hasKanaAndEmojiKeys()) { CheckBoxPreference doubleScrolling = (CheckBoxPreference) screen.findPreference("double_scrolling"); if (doubleScrolling != null && plugins != null) { plugins.removePreference(doubleScrolling); } } PreferenceCategory workarounds = (PreferenceCategory) screen.findPreference("category_workarounds"); if (workarounds != null) { CheckBoxPreference fixHebrewText = (CheckBoxPreference) screen.findPreference("fixHebrewText"); CompatHelper.removeHiddenPreferences(this.getApplicationContext()); if (CompatHelper.getSdkVersion() >= 16) { workarounds.removePreference(fixHebrewText); } } }
private void removePreference(String parent, String category) { PreferenceCategory p = (PreferenceCategory) findPreference(parent); Preference c = findPreference(category); p.removePreference(c); }
@Override public boolean onPreferenceClick(Preference preference) { Context ctx = getActivity(); ProfileHelper.migrateProfiles(ctx); if (ctx != null) { Api.toast(getActivity(), ctx.getString(R.string.profile_migrate_msg)); mCategory.removePreference(migrate); Preference migrate = (Preference) findPreference("profile1"); mCategory2.removePreference(migrate); migrate = (Preference) findPreference("profile2"); mCategory2.removePreference(migrate); migrate = (Preference) findPreference("profile3"); mCategory2.removePreference(migrate); } return true; } });
mCategory.removePreference(migrate); mCategory2.removePreference(migrate2); mCategory2.removePreference(migrate2); mCategory2.removePreference(migrate2);
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); } }
private void checkForRemoved() { for (ServerSettings ss : serverSettings.values()) { if (!ss.update()) { serversCategory.removePreference(ss.getScreen()); serverCount--; } } }
watchCategory.removePreference(pebbleSpecialValue); watchCategory.removePreference(pebbleSpecialText); } else { watchCategory.removePreference(pebbleTrend); watchCategory.removePreference(pebbleFilteredLine); watchCategory.removePreference(pebbleTinyDots); watchCategory.removePreference(pebbleHighLine); watchCategory.removePreference(pebbleLowLine); watchCategory.removePreference(pebbleTrendPeriod); watchCategory.removePreference(pebbleDelta); watchCategory.removePreference(pebbleDeltaUnits); watchCategory.removePreference(pebbleShowArrows); watchCategory.removePreference(pebbleSpecialValue); watchCategory.removePreference(pebbleSpecialText); watchCategory.removePreference(pebbleVibrateNoSignal); watchCategory.removePreference(pebbleVibrateNoBluetooth);
watchCategory.removePreference(pebbleSpecialValue); watchCategory.removePreference(pebbleSpecialText); } else { watchCategory.removePreference(pebbleTrend); watchCategory.removePreference(pebbleFilteredLine); watchCategory.removePreference(pebbleTinyDots); watchCategory.removePreference(pebbleHighLine); watchCategory.removePreference(pebbleLowLine); watchCategory.removePreference(pebbleTrendPeriod); watchCategory.removePreference(pebbleDelta); watchCategory.removePreference(pebbleDeltaUnits); watchCategory.removePreference(pebbleShowArrows); watchCategory.removePreference(pebbleSpecialValue); watchCategory.removePreference(pebbleSpecialText); watchCategory.removePreference(pebbleVibrateNoSignal); watchCategory.removePreference(pebbleVibrateNoBluetooth);
@SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { //remove priority preference (not supported) PreferenceCategory notificationCategory = (PreferenceCategory) findPreference("pref_category_notification"); ListPreference priorityPreference = (ListPreference) findPreference("pref_notification_priority"); notificationCategory.removePreference(priorityPreference); } }
private void removePreference() { try { PackageInfo info = getApplicationContext().getPackageManager().getPackageInfo("com.eg.android.AlipayGphone", 0); boolean isAvailable = info != null; if (!isAvailable) { PreferenceCategory displayOptions = (PreferenceCategory) findPreference("ABOUT"); displayOptions.removePreference(findPreference("DONATE_ALIPAY")); } else { donateAlipay(); } } catch (Throwable t) { PreferenceCategory displayOptions = (PreferenceCategory) findPreference("ABOUT"); displayOptions.removePreference(findPreference("DONATE_ALIPAY")); } }
public void setCollectionPrefs() { //if (mPrefs.getBoolean("dex_collection_method", false)) {//DexCollectionType.DexcomG5 if (DexCollectionType.hasBluetooth()) { screen.addPreference(category); Log.d("NWPreferences", "setCollectionPrefs addPreference category"); } else { screen.removePreference(category); Log.d("NWPreferences", "setCollectionPrefs removePreference category"); } if (DexCollectionType.hasBattery()) { watchcategory.addPreference(showBridgeBattery); Log.d("NWPreferences", "setCollectionPrefs addPreference showBridgeBattery"); } else { watchcategory.removePreference(showBridgeBattery); Log.d("NWPreferences", "setCollectionPrefs removePreference showBridgeBattery"); } if (collectionMethod != null && category != null) { //category.removePreference(collectionMethod); } } }
@Override public void onReceive(Context context, Intent intent) { final String packageName = intent.getStringExtra(OpenFitIntent.EXTRA_PACKAGE_NAME); final String appName = intent.getStringExtra(OpenFitIntent.EXTRA_APP_NAME); Log.d(LOG_TAG, "Recieved add application: "+appName+" : "+packageName); appManager.addNotificationApp(packageName); oPrefs.saveSet(packageName); oPrefs.saveString(packageName, appName); Preference app = createAppPreference(packageName, appName); PreferenceCategory category = (PreferenceCategory) findPreference("preference_category_apps"); category.removePreference(preference_apps_placeholder); category.addPreference(app); sendNotificationApplications(); } };
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); findPreference(MyConstants.PREF_CHANGE_LOG).setSummary("V " + BuildConfig.VERSION_NAME); if (!myPreferenceManager.getAppRatedPref()) { ((PreferenceCategory)findPreference(MyConstants.PREF_ABOUT)).removePreference(findPreference(MyConstants.PREF_RATE_SEARCH_BUBBLE)); } setListeners(); }
@Override public void onReceive(Context context, Intent intent) { final String packageName = intent.getStringExtra(OpenFitIntent.EXTRA_PACKAGE_NAME); final String appName = intent.getStringExtra(OpenFitIntent.EXTRA_APP_NAME); Log.d(LOG_TAG, "Recieved del application: "+appName+" : "+packageName); appManager.delNotificationApp(packageName); oPrefs.removeSet(packageName); oPrefs.removeString(packageName); PreferenceCategory category = (PreferenceCategory) findPreference("preference_category_apps"); Preference app = (Preference) findPreference(packageName); category.removePreference(app); // If no more preference in the category, restore the placeholder if(category.getPreferenceCount() <= 0) { category.addPreference(preference_apps_placeholder); } sendNotificationApplications(); } };
prefCat.removePreference(announcePref); prefCat.removePreference(announceNamePref); prefCat.removePreference(showConnInfoPref);
@SuppressLint("ApplySharedPref") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //noinspection deprecation getPreferenceManager().setSharedPreferencesMode(Context.MODE_WORLD_READABLE); addPreferencesFromResource(R.xml.preferences); prefs = ConfigUtils.getPreferences(getActivity()); findPreference("theme_colorPrimary").setEnabled(!prefs.getString("app_theme", "light").equals("device")); mExperimental = ConfigUtils.isExperimental(prefs); mShowExperimental = ConfigUtils.showExperimental(prefs); if (UpdateUtils.isEnabled()) { if (prefs.getBoolean("check_for_updates", true)) UpdateUtils.check(getActivity(), this); } else { PreferenceCategory appCategory = (PreferenceCategory) findPreference("settings_app"); Preference updatePref = getPreferenceScreen().findPreference("check_for_updates"); appCategory.removePreference(updatePref); } if (!mShowExperimental) { PreferenceCategory tweaksCategory = (PreferenceCategory) findPreference("settings_tweaks"); Preference experimentalPref = getPreferenceScreen().findPreference("settings_experimental"); tweaksCategory.removePreference(experimentalPref); } // SELinux test, see XposedHook prefs.edit().putBoolean("can_read_prefs", true).commit(); setHasOptionsMenu(true); }
PreferenceCategory category = (PreferenceCategory) findPreference("pref_key_update_settings"); Preference updateServerPreference = findPreference("pref_updateserver"); category.removePreference(updateServerPreference); category.removePreference(versionCheckPreference);
String translator = resources.getString(R.string.app_translator); if (translator.isEmpty()) { about.removePreference(appTranslator);
pref.removePreference(pref.findPreference(Preferences.KEEP_IN_MESSAGING)); pref.removePreference(pref.findPreference(Preferences.DUALSIM_SIM)); } else { fillDualSimList(preferenceScreen);
}); } else { securityCategory.removePreference(clearTextTraffic);