android.preference.PreferenceFragment Java Examples
The following examples show how to use
android.preference.PreferenceFragment.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SuntimesSettingsActivity.java From SuntimesWidget with GNU General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void initPref_ui(final PreferenceFragment fragment) { boolean[] showFields = AppSettings.loadShowFieldsPref(fragment.getActivity()); for (int i = 0; i<AppSettings.NUM_FIELDS; i++) { CheckBoxPreference field = (CheckBoxPreference)fragment.findPreference(AppSettings.PREF_KEY_UI_SHOWFIELDS + "_" + i); if (field != null) { initPref_ui_field(field, fragment.getActivity(), i, showFields[i]); } } final ThemePreference overrideTheme_light = (ThemePreference)fragment.findPreference(PREF_KEY_APPEARANCE_THEME_LIGHT); initPref_ui_themeOverride(fragment.getActivity(), overrideTheme_light, fragment.getActivity(), PREF_KEY_APPEARANCE_THEME_LIGHT); loadPref_ui_themeOverride(fragment.getActivity(), overrideTheme_light, PREF_KEY_APPEARANCE_THEME_LIGHT, fragment.getActivity()); final ThemePreference overrideTheme_dark = (ThemePreference)fragment.findPreference(AppSettings.PREF_KEY_APPEARANCE_THEME_DARK); initPref_ui_themeOverride(fragment.getActivity(), overrideTheme_dark, fragment.getActivity(), AppSettings.PREF_KEY_APPEARANCE_THEME_DARK); loadPref_ui_themeOverride(fragment.getActivity(), overrideTheme_dark, AppSettings.PREF_KEY_APPEARANCE_THEME_DARK, fragment.getActivity()); updatePref_ui_themeOverride(AppSettings.loadThemePref(fragment.getActivity()), overrideTheme_dark, overrideTheme_light); }
Example #2
Source File: NSClientPlugin.java From AndroidAPS with GNU Affero General Public License v3.0 | 6 votes |
@Override public void preprocessPreferences(@NotNull PreferenceFragment preferenceFragment) { super.preprocessPreferences(preferenceFragment); if (Config.NSCLIENT) { PreferenceScreen scrnAdvancedSettings = (PreferenceScreen) preferenceFragment.findPreference(MainApp.gs(R.string.key_advancedsettings)); if (scrnAdvancedSettings != null) { scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_res_warning))); scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_res_critical))); scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_bat_warning))); scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_bat_critical))); scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_show_statuslights))); scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_show_statuslights_extended))); } } }
Example #3
Source File: SettingsGames.java From Simple-Solitaire with GNU General Public License v3.0 | 6 votes |
/** * Tests if a loaded fragment is valid * * @param fragmentName The name of the fragment to test * @return True if it's valid, false otherwise */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || CalculationPreferenceFragment.class.getName().equals(fragmentName) || CanfieldPreferenceFragment.class.getName().equals(fragmentName) || FortyEightPreferenceFragment.class.getName().equals(fragmentName) || GolfPreferenceFragment.class.getName().equals(fragmentName) || KlondikePreferenceFragment.class.getName().equals(fragmentName) || PyramidPreferenceFragment.class.getName().equals(fragmentName) || VegasPreferenceFragment.class.getName().equals(fragmentName) || YukonPreferenceFragment.class.getName().equals(fragmentName) || SpiderPreferenceFragment.class.getName().equals(fragmentName) || SpiderettePreferenceFragment.class.getName().equals(fragmentName) || Mod3PreferenceFragment.class.getName().equals(fragmentName) || NapoleonsTombPreferenceFragment.class.getName().equals(fragmentName); }
Example #4
Source File: MtkFixDevOptions.java From GravityBox with Apache License 2.0 | 6 votes |
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) { try { final Class<?> classDevSettings = XposedHelpers.findClass(CLASS_DEV_SETTINGS, classLoader); if (DEBUG) log("hooking DeveloperSettings.onCreate method"); XposedHelpers.findAndHookMethod(classDevSettings, "onCreate", Bundle.class, new XC_MethodHook() { @Override protected void beforeHookedMethod(final MethodHookParam param) throws Throwable { PreferenceFragment pf = (PreferenceFragment) param.thisObject; mResId = pf.getResources().getIdentifier("development_prefs", "xml", PACKAGE_NAME); if (DEBUG) log("mResId=" + mResId); } }); } catch (Throwable t) { XposedBridge.log(t); } }
Example #5
Source File: SettingsActivity.java From loaned-android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // If the available screen size is that of an average tablet (as defined // in the Android documentation) then allow the screen to rotate if(getResources().getBoolean(R.bool.lock_orientation)){ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } getActionBar().setDisplayHomeAsUpEnabled(true); super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); PreferenceFragment mPrefsFrag = new SettingsFragment(); FragmentTransaction mFragMan = getFragmentManager().beginTransaction(); mFragMan.add(R.id.settings_frame, mPrefsFrag); mFragMan.commit(); }
Example #6
Source File: SettingsActivity.java From AndroidBlueprints with Apache License 2.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || ApplicationBehaviourPreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
Example #7
Source File: SettingsActivity.java From M365-Power with GNU General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
Example #8
Source File: MtkFixTtsSettings.java From GravityBox with Apache License 2.0 | 5 votes |
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) { try { final Class<?> classVoiceIoSettings = XposedHelpers.findClass(CLASS_VOICEIO_SETTINGS, classLoader); if (DEBUG) log("replacing populateOrRemovePreferences method"); XposedHelpers.findAndHookMethod(classVoiceIoSettings, "populateOrRemovePreferences", new XC_MethodReplacement() { @Override protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { boolean hasRecognizer = (Boolean) XposedHelpers.callMethod(param.thisObject, "populateOrRemoveRecognizerPrefs"); boolean hasTts = (Boolean) XposedHelpers.callMethod(param.thisObject, "populateOrRemoveTtsPrefs"); if (DEBUG) log("populateOrRemovePreferences: hasRecognizer=" + hasRecognizer + "; hasTts=" + hasTts); if (hasRecognizer || hasTts) { return null; } PreferenceFragment fragment = (PreferenceFragment) XposedHelpers.getObjectField( param.thisObject, "mFragment"); PreferenceCategory prefCat = (PreferenceCategory) XposedHelpers.getObjectField( param.thisObject, "mVoiceCategory"); if (fragment != null && prefCat != null) { fragment.getPreferenceScreen().removePreference(prefCat); } return null; } }); } catch (Throwable t) { XposedBridge.log(t); } }
Example #9
Source File: SettingsActivity.java From AndroidDemo with MIT License | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
Example #10
Source File: SettingsActivity.java From kolabnotes-android with GNU Lesser General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
Example #11
Source File: SettingsActivity.java From SecScanQR with GNU General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || ScannerPreferenceFragment.class.getName().equals(fragmentName) || HistoryPreferenceFragment.class.getName().equals(fragmentName) || SearchEnginePreferenceFragment.class.getName().equals(fragmentName); }
Example #12
Source File: SettingsActivity.java From Cybernet-VPN with GNU General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
Example #13
Source File: SettingsActivity.java From lrkFM with MIT License | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || UIPreferenceFragment.class.getName().equals(fragmentName) || NotificationsPreferenceFragment.class.getName().equals(fragmentName); }
Example #14
Source File: SettingsActivity.java From Android-Carbon-Forum with Apache License 2.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
Example #15
Source File: SettingsActivity.java From android-espresso-revealed with Apache License 2.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName) || WebViewFragment.class.getName().equals(fragmentName); }
Example #16
Source File: GaPreferenceActivity.java From green_android with GNU General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(final String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GAPreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || SPVPreferenceFragment.class.getName().equals(fragmentName); }
Example #17
Source File: SettingsActivity.java From redgram-for-reddit with GNU General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || PostPreferenceFragment.class.getName().equals(fragmentName) || CommentsPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName) || SyncPreferenceFragment.class.getName().equals(fragmentName); }
Example #18
Source File: BlacklistActivity.java From AcDisplay with GNU General Public License v2.0 | 5 votes |
@Override public boolean onPreferenceStartFragment(PreferenceFragment caller, @NonNull Preference pref) { startPreferencePanel( pref.getFragment(), pref.getExtras(), pref.getTitleRes(), pref.getTitle(), null, 0); return true; }
Example #19
Source File: Settings.java From Simple-Search with GNU General Public License v3.0 | 5 votes |
/** * Tests if a loaded fragment is valid * * @param fragmentName The name of the fragment to test * @return True if it's valid, false otherwise */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || SearchPreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName); }
Example #20
Source File: PreferencesActivity.java From privacy-friendly-pedometer with GNU General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); //|| HelpFragment.class.getName().equals(fragmentName); }
Example #21
Source File: SettingsActivity.java From privacy-friendly-interval-timer with GNU General Public License v3.0 | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) // || GeneralPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName) || PersonalizationPreferenceFragment.class.getName().equals(fragmentName) || StatisticsPreferenceFragment.class.getName().equals(fragmentName) || WorkoutPreferenceFragment.class.getName().equals(fragmentName); }
Example #22
Source File: BaseActivity.java From open with GNU General Public License v3.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings: final PreferenceFragment settingsFragment = SettingsFragment.newInstance(this); getFragmentManager().beginTransaction() .add(R.id.settings, settingsFragment, SettingsFragment.TAG) .addToBackStack(null) .commit(); return true; case R.id.logout: SharedPreferences prefs = getSharedPreferences("OAUTH", Context.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.remove("token"); editor.remove("forced_login"); editor.commit(); startActivity(new Intent(this, InitialActivity.class)); finish(); return true; case R.id.upload_traces: uploadTraces(); return true; case R.id.about: final Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("https://mapzen.com/open/about")); startActivity(intent); return true; case R.id.action_view_all: final PagerResultsFragment pagerResultsFragment = getPagerResultsFragment(); if (pagerResultsFragment != null) { pagerResultsFragment.viewAll(); } return true; default: return super.onOptionsItemSelected(item); } }
Example #23
Source File: Preferences.java From delion with Apache License 2.0 | 5 votes |
@Override public void onAttachedToWindow() { super.onAttachedToWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content); if (fragment instanceof PreferenceFragment && fragment.getView() != null) { // Set list view padding to 0 so dividers are the full width of the screen. fragment.getView().findViewById(android.R.id.list).setPadding(0, 0, 0, 0); } } }
Example #24
Source File: SettingsActivity.java From journaldev with MIT License | 5 votes |
/** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName) || DataSyncPreferenceFragment.class.getName().equals(fragmentName) || NotificationPreferenceFragment.class.getName().equals(fragmentName); }
Example #25
Source File: Preferences.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private static void clickScreen(final PreferenceFragment fragment, final PreferenceScreen screen) { if (screen == null) return; if (fragment.getPreferenceScreen() != screen) { try { final Method method = screen.getClass().getDeclaredMethod("onClick"); method.setAccessible(true); method.invoke(screen); } catch (Exception e) { android.util.Log.e(TAG, "" + e); } } else { android.util.Log.d(TAG, "Already on that screen"); } }
Example #26
Source File: Settings.java From Simple-Solitaire with GNU General Public License v3.0 | 5 votes |
/** * Tests if a loaded fragment is valid * * @param fragmentName The name of the fragment to test * @return True if it's valid, false otherwise */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || CustomizationPreferenceFragment.class.getName().equals(fragmentName) || OtherPreferenceFragment.class.getName().equals(fragmentName) || MenuPreferenceFragment.class.getName().equals(fragmentName) || AdditionalMovementsPreferenceFragment.class.getName().equals(fragmentName) || SoundPreferenceFragment.class.getName().equals(fragmentName) || DeveloperOptionsPreferenceFragment.class.getName().equals(fragmentName) || ExpertSettingsPreferenceFragment.class.getName().equals(fragmentName); }
Example #27
Source File: BlacklistActivity.java From HeadsUp with GNU General Public License v2.0 | 5 votes |
@Override public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) { startPreferencePanel( pref.getFragment(), pref.getExtras(), pref.getTitleRes(), pref.getTitle(), null, 0); return true; }
Example #28
Source File: Preferences.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void onAttachedToWindow() { super.onAttachedToWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content); if (fragment instanceof PreferenceFragment && fragment.getView() != null) { // Set list view padding to 0 so dividers are the full width of the screen. fragment.getView().findViewById(android.R.id.list).setPadding(0, 0, 0, 0); } } }
Example #29
Source File: PreferenceCompatFragment.java From Popeens-DSub with GNU General Public License v3.0 | 5 votes |
private void setFragment(PreferenceFragment preferenceFragment) { try { Method m = PreferenceManager.class.getDeclaredMethod("setFragment", PreferenceFragment.class); m.setAccessible(true); m.invoke(mPreferenceManager, preferenceFragment); } catch (Exception e) { throw new RuntimeException(e); } }
Example #30
Source File: PreferenceSettingsUtils.java From talkback with Apache License 2.0 | 5 votes |
/** * Inflates the given XML resource and adds the preference hierarchy to the current preference * hierarchy. {@link PreferenceFragment#addPreferencesFromResource} */ public static void addPreferencesFromResource( PreferenceFragment preferenceFragment, @XmlRes int preferencesResId) { // Set preferences to use device-protected storage. if (BuildVersionUtils.isAtLeastN()) { preferenceFragment.getPreferenceManager().setStorageDeviceProtected(); } preferenceFragment.addPreferencesFromResource(preferencesResId); }