android.support.v7.preference.PreferenceFragmentCompat Java Examples
The following examples show how to use
android.support.v7.preference.PreferenceFragmentCompat.
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: SettingsFragment.java From walt with Apache License 2.0 | 6 votes |
@Override public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { SettingsFragment fragment = new SettingsFragment(); Bundle args = new Bundle(); args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, preferenceScreen.getKey()); fragment.setArguments(args); FragmentTransaction ft = preferenceFragmentCompat.getFragmentManager().beginTransaction(); ft.add(R.id.fragment_container, fragment, preferenceScreen.getKey()); ft.addToBackStack(preferenceScreen.getTitle().toString()); ft.commit(); toolbar.setTitle(preferenceScreen.getTitle()); return true; }
Example #2
Source File: PreferencesChannelsActivity.java From notification-channel-compat with Apache License 2.0 | 6 votes |
protected void loadFragment() { String channelId = getIntent().getStringExtra(INTENT_EXTRA_CHANNEL_ID); PreferenceFragmentCompat frag; NotificationManagerCompat manager = NotificationManagerCompat.from(this); if (!manager.areNotificationsEnabled()) frag = new PreferencesChannelsSystemFragment(); else frag = TextUtils.isEmpty(channelId) ? new PreferencesChannelsMainFragment() : PreferencesChannelsSubFragment.newInstance(channelId); getSupportFragmentManager() .beginTransaction() .replace(R.id.settings_container, frag) .commit(); }
Example #3
Source File: SpectrumPreferenceCompat.java From Muzesto with GNU General Public License v3.0 | 6 votes |
public static boolean onDisplayPreferenceDialog(Preference preference, PreferenceFragmentCompat target) { boolean handled = false; if (target.getTargetFragment() instanceof PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback) { handled = ((PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback) target.getTargetFragment()) .onPreferenceDisplayDialog(target, preference); } if (!handled && target.getActivity() instanceof PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback) { handled = ((PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback) target.getActivity()) .onPreferenceDisplayDialog(target, preference); } // check if dialog is already showing if (!handled && target.getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG) != null) { handled = true; } if (!handled && preference instanceof SpectrumPreferenceCompat) { DialogFragment f = SpectrumPreferenceDialogFragmentCompat.newInstance(preference.getKey()); f.setTargetFragment(target, 0); f.show(target.getFragmentManager(), DIALOG_FRAGMENT_TAG); handled = true; } return handled; }
Example #4
Source File: NGPreferenceActivity.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
public void replaceSettingsFragment(Bundle args) { FragmentManager fm = getSupportFragmentManager(); NGPreferenceSettingsFragment fragment = (NGPreferenceSettingsFragment) fm.findFragmentByTag( getPreferenceSettingsFragmentTag()); if (null != fragment) { removeListener(fragment); } String subScreenKey = null; if (null != args) { subScreenKey = args.getString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT); } String tag = getPreferenceSettingsFragmentTag(); fragment = getNewPreferenceSettingsFragment(subScreenKey); addListener(fragment); if (null != args) { fragment.setArguments(args); } FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.setting_fragment, fragment, tag); if (!isMultiPane(this)) { ft.addToBackStack(tag); } ft.commit(); }
Example #5
Source File: SettingsActivity.java From Stringlate with MIT License | 5 votes |
@Override protected void onPreferenceScreenChanged(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { super.onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); if (!TextUtils.isEmpty(preferenceScreen.getTitle())) { SettingsActivity a = (SettingsActivity) getActivity(); if (a != null) { a.toolbar.setTitle(preferenceScreen.getTitle()); } } }
Example #6
Source File: GsPreferenceFragmentCompat.java From Stringlate with MIT License | 5 votes |
@Deprecated @Override public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { _prefScreenBackstack.add(getPreferenceScreen()); preferenceFragmentCompat.setPreferenceScreen(preferenceScreen); updatePreferenceIcons.callback(this); onPreferenceScreenChangedPriv(preferenceFragmentCompat, preferenceScreen); return true; }
Example #7
Source File: DialogPreference.java From android_external_MicroGUiTools with Apache License 2.0 | 5 votes |
@Override public boolean onPreferenceDisplayDialog(PreferenceFragmentCompat caller, Preference pref) { DialogPreferenceCompatDialogFragment fragment = new DialogPreferenceCompatDialogFragment(); fragment.setTargetFragment(caller, 0); fragment.show(caller.getFragmentManager(), DIALOG_FRAGMENT_TAG); return true; }
Example #8
Source File: SettingsActivity.java From ForPDA with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentThemeIsDark = App.get().isDarkTheme(); setTheme(currentThemeIsDark ? R.style.PreferenceAppThemeDark : R.style.PreferenceAppThemeLight); setContentView(R.layout.activity_settings); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(R.string.activity_title_settings); } PreferenceFragmentCompat fragment = null; Intent intent = getIntent(); if (intent != null) { String settingsArgument = intent.getStringExtra(ARG_NEW_PREFERENCE_SCREEN); if (settingsArgument != null) { if (settingsArgument.equals(NotificationsSettingsFragment.PREFERENCE_SCREEN_NAME)) { fragment = new NotificationsSettingsFragment(); } } } if (fragment == null) { fragment = new SettingsFragment(); } getSupportFragmentManager().beginTransaction().replace(R.id.fragment_content, fragment).commit(); /*View view = findViewById(R.id.fragment_content); view.setBackgroundColor(Color.TRANSPARENT); view.setBackgroundColor(Color.rgb(4, 26, 55));*/ App.get().addPreferenceChangeObserver(appThemeChangeObserver); }
Example #9
Source File: GsPreferenceFragmentCompat.java From openlauncher with Apache License 2.0 | 5 votes |
@Deprecated @Override public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { _prefScreenBackstack.add(getPreferenceScreen()); preferenceFragmentCompat.setPreferenceScreen(preferenceScreen); updatePreferenceIcons.callback(this); onPreferenceScreenChangedPriv(preferenceFragmentCompat, preferenceScreen); return true; }
Example #10
Source File: NGPreferenceActivity.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean onPreferenceStartScreen( PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { if (isMultiPane(this)) { setTitle(preferenceScreen); } onStartSubScreen(preferenceScreen); return true; }
Example #11
Source File: NGPreferenceActivity.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
protected void onStartSubScreen(PreferenceScreen preferenceScreen) { Bundle args = new Bundle(); args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, preferenceScreen.getKey()); args.putString(ConstantsUI.PREF_SCREEN_TITLE, preferenceScreen.getTitle().toString()); replaceSettingsFragment(args); }
Example #12
Source File: SettingsActivity.java From openlauncher with Apache License 2.0 | 5 votes |
@Override public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference preference) { Fragment fragment = Fragment.instantiate(this, preference.getFragment(), preference.getExtras()); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_holder, fragment).addToBackStack(fragment.getTag()).commit(); return true; }
Example #13
Source File: USBGpsBaseActivity.java From UsbGps4Droid with GNU General Public License v3.0 | 5 votes |
/** * Called when a nested preference screen is clicked by the root preference screen * * Makes that fragment the now visible fragment */ @Override public void onNestedScreenClicked(PreferenceFragmentCompat preferenceFragment) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } getSupportFragmentManager().beginTransaction() .replace(resSettingsHolder, preferenceFragment, TAG_NESTED) .addToBackStack(TAG_NESTED) .commit(); }
Example #14
Source File: SettingsActivity.java From kimai-android with MIT License | 5 votes |
@Override protected void onPreferenceScreenChanged(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { super.onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); if (!TextUtils.isEmpty(preferenceScreen.getTitle())) { SettingsActivity a = (SettingsActivity) getActivity(); if (a != null) { a.toolbar.setTitle(preferenceScreen.getTitle()); } } }
Example #15
Source File: GsPreferenceFragmentCompat.java From memetastic with GNU General Public License v3.0 | 5 votes |
@Deprecated @Override public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { _prefScreenBackstack.add(getPreferenceScreen()); preferenceFragmentCompat.setPreferenceScreen(preferenceScreen); updatePreferenceIcons.callback(this); onPreferenceScreenChangedPriv(preferenceFragmentCompat, preferenceScreen); return true; }
Example #16
Source File: SettingsActivity.java From memetastic with GNU General Public License v3.0 | 5 votes |
@Override protected void onPreferenceScreenChanged(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { super.onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); if (!TextUtils.isEmpty(preferenceScreen.getTitle())) { SettingsActivity a = (SettingsActivity) getActivity(); if (a != null) { a.toolbar.setTitle(preferenceScreen.getTitle()); } } }
Example #17
Source File: SettingsActivity.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 5 votes |
@Override public boolean onPreferenceDisplayDialog(PreferenceFragmentCompat preferenceFragmentCompat, @NonNull Preference preference) { final String key = preference.getKey(); DialogFragment f; if (preference instanceof ColorPreference) { f = XpColorPreferenceDialogFragment.newInstance(key); } else { return false; } f.setTargetFragment(preferenceFragmentCompat, 0); f.show(this.getSupportFragmentManager(), key); return true; }
Example #18
Source File: GsPreferenceFragmentCompat.java From kimai-android with MIT License | 5 votes |
@Deprecated @Override public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { _prefScreenBackstack.add(getPreferenceScreen()); preferenceFragmentCompat.setPreferenceScreen(preferenceScreen); updatePreferenceIcons.callback(this); onPreferenceScreenChangedPriv(preferenceFragmentCompat, preferenceScreen); return true; }
Example #19
Source File: ActivitySettings.java From fingen with Apache License 2.0 | 5 votes |
@Override public boolean onPreferenceDisplayDialog(PreferenceFragmentCompat preferenceFragmentCompat, Preference preference) { // final String key = preference.getKey(); // DialogFragment f; // if (preference instanceof ColorPreference) { // f = XpColorPreferenceDialogFragment.newInstance(key); // } else { return false; // } // // f.setTargetFragment(preferenceFragmentCompat, 0); // f.show(this.getSupportFragmentManager(), key); // return true; }
Example #20
Source File: PreferenceFragmentCompatHack.java From ChipHellClient with Apache License 2.0 | 5 votes |
/** * Displays preference dialogs which aren't supported by default in PreferenceFragmentCompat. * * @return true if we managed a preference which isn't supported by default, false otherwise. */ public static boolean onDisplayPreferenceDialog(PreferenceFragmentCompat preferenceFragmentCompat, Preference preference) { DialogFragment dialogFragment = (DialogFragment) preferenceFragmentCompat.getFragmentManager().findFragmentByTag(FRAGMENT_TAG_DIALOG); if (dialogFragment != null) return false; // Hack to allow a MultiSelectListPreference if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH && preference instanceof MultiSelectListPreference) { dialogFragment = MultiSelectListPreferenceDialogFragmentCompat.newInstance(preference.getKey()); } // Hack to allow a PasswordPreference //else if (preference instanceof PasswordPreference) { // dialogFragment = PasswordPreferenceDialogFragmentCompat.newInstance(preference.getKey()); //} // We've created our own fragment: if (dialogFragment != null) { dialogFragment.setTargetFragment(preferenceFragmentCompat, 0); dialogFragment.show(preferenceFragmentCompat.getFragmentManager(), FRAGMENT_TAG_DIALOG); return true; } return false; }
Example #21
Source File: PreferenceActivity.java From utexas-utilities with Apache License 2.0 | 5 votes |
@Override public boolean onPreferenceStartScreen(PreferenceFragmentCompat pfc, PreferenceScreen screen) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container, UTilitiesPreferenceFragment.newInstance("experimental"), UTilitiesPreferenceFragment.class.getSimpleName()); transaction.addToBackStack(null); transaction.commit(); return true; }
Example #22
Source File: GsPreferenceFragmentCompat.java From openlauncher with Apache License 2.0 | 4 votes |
private void onPreferenceScreenChangedPriv(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { setDividerVisibility(isDividerVisible()); onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); updatePreferenceChangedListeners(true); doUpdatePreferences(); }
Example #23
Source File: GsPreferenceFragmentCompat.java From kimai-android with MIT License | 4 votes |
protected void onPreferenceScreenChanged(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { }
Example #24
Source File: GsPreferenceFragmentCompat.java From kimai-android with MIT License | 4 votes |
public void tintAllPrefIcons(PreferenceFragmentCompat preferenceFragment, @ColorInt int iconColor) { tintPrefIconsRecursive(getPreferenceScreen(), iconColor); }
Example #25
Source File: GsPreferenceFragmentCompat.java From kimai-android with MIT License | 4 votes |
private void onPreferenceScreenChangedPriv(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { setDividerVisibility(isDividerVisible()); onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); updatePreferenceChangedListeners(true); }
Example #26
Source File: GsPreferenceFragmentCompat.java From Stringlate with MIT License | 4 votes |
private void onPreferenceScreenChangedPriv(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); updatePreferenceChangedListeners(true); }
Example #27
Source File: GsPreferenceFragmentCompat.java From Stringlate with MIT License | 4 votes |
public void tintAllPrefIcons(PreferenceFragmentCompat preferenceFragment, @ColorInt int iconColor) { tintPrefIconsRecursive(getPreferenceScreen(), iconColor); }
Example #28
Source File: GsPreferenceFragmentCompat.java From openlauncher with Apache License 2.0 | 4 votes |
public void tintAllPrefIcons(PreferenceFragmentCompat preferenceFragment, @ColorInt int iconColor) { tintPrefIconsRecursive(getPreferenceScreen(), iconColor); }
Example #29
Source File: GsPreferenceFragmentCompat.java From openlauncher with Apache License 2.0 | 4 votes |
protected void onPreferenceScreenChanged(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { }
Example #30
Source File: GsPreferenceFragmentCompat.java From memetastic with GNU General Public License v3.0 | 4 votes |
private void onPreferenceScreenChangedPriv(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { setDividerVisibility(isDividerVisible()); onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); updatePreferenceChangedListeners(true); doUpdatePreferences(); }