androidx.preference.Preference Java Examples
The following examples show how to use
androidx.preference.Preference.
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 XposedSmsCode with GNU General Public License v3.0 | 6 votes |
@Override public void onDisplayPreferenceDialog(Preference preference) { boolean handled = false; if (preference instanceof ResetEditPreference) { DialogFragment dialogFragment = ResetEditPreferenceDialogFragCompat.newInstance(preference.getKey()); FragmentManager fm = getFragmentManager(); if (fm != null) { dialogFragment.setTargetFragment(this, 0); dialogFragment.show(fm, "android.support.v7.preference.PreferenceFragment.DIALOG"); handled = true; } } if (!handled) { super.onDisplayPreferenceDialog(preference); } }
Example #2
Source File: SettingsActivity.java From Infinity-For-Reddit with GNU Affero General Public License v3.0 | 6 votes |
@Override public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) { // Instantiate the new Fragment final Bundle args = pref.getExtras(); final Fragment fragment = getSupportFragmentManager().getFragmentFactory().instantiate( getClassLoader(), pref.getFragment()); fragment.setArguments(args); fragment.setTargetFragment(caller, 0); getSupportFragmentManager().beginTransaction() .replace(R.id.frame_layout_settings_activity, fragment) .addToBackStack(null) .commit(); setTitle(pref.getTitle()); return true; }
Example #3
Source File: AppProtectionPreferenceFragment.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@Override public void onResume() { super.onResume(); ((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.preferences__privacy); initializePassphraseLockTriggerSummary(); initializePassphraseTimeoutSummary(); Preference signalPinCreateChange = this.findPreference(TextSecurePreferences.SIGNAL_PIN_CHANGE); SwitchPreferenceCompat signalPinReminders = (SwitchPreferenceCompat) this.findPreference(PinValues.PIN_REMINDERS_ENABLED); SwitchPreferenceCompat registrationLockV2 = (SwitchPreferenceCompat) this.findPreference(KbsValues.V2_LOCK_ENABLED); if (SignalStore.kbsValues().hasPin()) { signalPinCreateChange.setOnPreferenceClickListener(new KbsPinUpdateListener()); signalPinCreateChange.setTitle(R.string.preferences_app_protection__change_your_pin); registrationLockV2.setEnabled(true); } else { signalPinCreateChange.setOnPreferenceClickListener(new KbsPinCreateListener()); signalPinCreateChange.setTitle(R.string.preferences_app_protection__create_a_pin); signalPinReminders.setEnabled(false); registrationLockV2.setEnabled(false); } }
Example #4
Source File: PreferencesActivity.java From TowerCollector with Mozilla Public License 2.0 | 6 votes |
@Override public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) { // instantiate the new Fragment final Bundle args = pref.getExtras(); final Fragment fragment = getSupportFragmentManager().getFragmentFactory().instantiate( getClassLoader(), pref.getFragment()); fragment.setArguments(args); fragment.setTargetFragment(caller, 0); // replace the existing Fragment with the new Fragment getSupportFragmentManager().beginTransaction() .replace(R.id.preferences_container, fragment) .addToBackStack(null) .commit(); setTitle(pref.getTitle()); return true; }
Example #5
Source File: AppProtectionPreferenceFragment.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enabled = (Boolean)newValue; int mode = enabled ? ChangePassphraseDialogFragment.MODE_ENABLE : ChangePassphraseDialogFragment.MODE_DISABLE; ChangePassphraseDialogFragment dialog = ChangePassphraseDialogFragment.newInstance(mode); dialog.setMasterSecretChangedListener(masterSecret -> { ((SwitchPreferenceCompat) preference).setChecked(enabled); ((ApplicationPreferencesActivity) requireContext()).setMasterSecret(masterSecret); }); dialog.show(requireFragmentManager(), "ChangePassphraseDialogFragment"); return false; }
Example #6
Source File: SettingsFragment.java From Kore with Apache License 2.0 | 6 votes |
/** * Sets up the preferences state and summaries */ private void setupPreferences() { // Theme preferences ListPreference themePref = (ListPreference)findPreference(Settings.KEY_PREF_THEME); themePref.setSummary(themePref.getEntry()); // About preference String nameAndVersion = getActivity().getString(R.string.app_name); try { nameAndVersion += " " + getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException exc) { } Preference aboutPreference = findPreference(Settings.KEY_PREF_ABOUT); aboutPreference.setSummary(nameAndVersion); aboutPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { AboutDialogFragment aboutDialog = new AboutDialogFragment(); aboutDialog.show(getFragmentManager(), null); return true; } }); }
Example #7
Source File: TalkBackSelectorPreferencesActivity.java From talkback with Apache License 2.0 | 6 votes |
/** * Enables or disables the setting configuration preference category, depending on the on/off * state of the selector. */ private void enableOrDisableSelectorSettings(boolean enable) { PreferenceCategory settingsCategory = (PreferenceCategory) findPreference(getString(R.string.pref_category_selector_settings_configuration_key)); if (settingsCategory == null) { return; } final int count = settingsCategory.getPreferenceCount(); for (int i = 0; i < count; i++) { final Preference preference = settingsCategory.getPreference(i); if (preference instanceof TwoStatePreference) { TwoStatePreference switchPreference = (TwoStatePreference) preference; switchPreference.setEnabled(enable); } } }
Example #8
Source File: TalkBackDeveloperPreferencesActivity.java From talkback with Apache License 2.0 | 6 votes |
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { Activity activity = getActivity(); if (activity == null) { return false; } // If the user is enabling performance statistics... show confirmation dialog. if (Boolean.TRUE.equals(newValue)) { performanceStatsDialog.show(); return false; } // If the user is disabling performance statistics... disable & unassign gesture. disableAndRemoveGesture( activity, R.string.pref_performance_stats_key, R.string.shortcut_value_print_performance_stats); return true; }
Example #9
Source File: SearchPreferenceResult.java From SearchPreference with MIT License | 6 votes |
/** * Alternative (old) highlight method if ripple does not work */ private void highlightFallback(PreferenceFragmentCompat prefsFragment, final Preference prefResult) { TypedValue typedValue = new TypedValue(); Resources.Theme theme = prefsFragment.getActivity().getTheme(); theme.resolveAttribute(android.R.attr.textColorPrimary, typedValue, true); TypedArray arr = prefsFragment.getActivity().obtainStyledAttributes(typedValue.data, new int[]{ android.R.attr.textColorPrimary}); int color = arr.getColor(0, 0xff3F51B5); arr.recycle(); final Drawable oldIcon = prefResult.getIcon(); final boolean oldSpaceReserved = prefResult.isIconSpaceReserved(); Drawable arrow = AppCompatResources.getDrawable(prefsFragment.getContext(), R.drawable.searchpreference_ic_arrow_right); arrow.setColorFilter(color, PorterDuff.Mode.SRC_IN); prefResult.setIcon(arrow); prefsFragment.scrollToPreference(prefResult); new Handler().postDelayed(() -> { prefResult.setIcon(oldIcon); prefResult.setIconSpaceReserved(oldSpaceReserved); }, 1000); }
Example #10
Source File: NotificationsPreferenceFragment.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { Uri value = (Uri) newValue; if (value == null || TextUtils.isEmpty(value.toString())) { preference.setSummary(R.string.preferences__silent); } else { Ringtone tone = RingtoneManager.getRingtone(getActivity(), value); if (tone != null) { preference.setSummary(tone.getTitle(getActivity())); } } return true; }
Example #11
Source File: AppCompatPreferenceActivity.java From onpc with GNU General Public License v3.0 | 6 votes |
static void tintIcons(final Context c, Preference preference) { if (preference instanceof PreferenceGroup) { PreferenceGroup group = ((PreferenceGroup) preference); Utils.setDrawableColorAttr(c, group.getIcon(), android.R.attr.textColorSecondary); for (int i = 0; i < group.getPreferenceCount(); i++) { tintIcons(c, group.getPreference(i)); } } else { Utils.setDrawableColorAttr(c, preference.getIcon(), android.R.attr.textColorSecondary); } }
Example #12
Source File: NotificationsPreferenceFragment.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { Uri value = (Uri) newValue; if (value == null || TextUtils.isEmpty(value.toString())) { preference.setSummary(R.string.pref_silent); } else { Ringtone tone = RingtoneManager.getRingtone(getActivity(), value); if (tone != null) { preference.setSummary(tone.getTitle(getActivity())); } } return true; }
Example #13
Source File: SettingsFragment.java From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 | 6 votes |
@Override protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) { return new PreferenceGroupAdapter(preferenceScreen) { @SuppressLint("RestrictedApi") @Override public void onBindViewHolder(PreferenceViewHolder holder, int position) { super.onBindViewHolder(holder, position); Preference preference = getItem(position); if (preference instanceof PreferenceCategory) setZeroPaddingToLayoutChildren(holder.itemView); else { View iconFrame = holder.itemView.findViewById(R.id.icon_frame); if (iconFrame != null) { iconFrame.setVisibility(preference.getIcon() == null ? View.GONE : View.VISIBLE); } } } }; }
Example #14
Source File: TalkBackVerbosityPreferencesActivity.java From talkback with Apache License 2.0 | 6 votes |
/** Collects all preset-controlled preferences. */ private ArrayList<Preference> collectDetailedPreferences() { ArrayList<Preference> detailedPrefs = new ArrayList<Preference>(); PreferenceGroup prefGroup = (PreferenceGroup) findPreference(R.string.pref_verbosity_category_preset_settings_key); if (prefGroup == null) { return detailedPrefs; } // For each preference... collect for (int p = 0; p < prefGroup.getPreferenceCount(); p++) { Preference preference = prefGroup.getPreference(p); if (preference != null) { detailedPrefs.add(preference); } } return detailedPrefs; }
Example #15
Source File: UsersPreferences.java From openScale with GNU General Public License v3.0 | 6 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.users_preferences, rootKey); setHasOptionsMenu(true); Preference addUser = findPreference(PREFERENCE_KEY_ADD_USER); addUser.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { UsersPreferencesDirections.ActionNavUserPreferencesToNavUsersettings action = UsersPreferencesDirections.actionNavUserPreferencesToNavUsersettings(); action.setMode(UserSettingsFragment.USER_SETTING_MODE.ADD); action.setTitle(getString(R.string.label_add_user)); Navigation.findNavController(getActivity(), R.id.nav_host_fragment).navigate(action); return true; } }); users = (PreferenceCategory) findPreference(PREFERENCE_KEY_USERS); updateUserPreferences(); }
Example #16
Source File: BrapiPreferencesFragment.java From Field-Book with GNU General Public License v2.0 | 6 votes |
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.equals(brapiURLPreference)) { // This is done after this function, but set the value for our brapi function SharedPreferences.Editor editor = prefMgr.getSharedPreferences().edit(); editor.putString(GeneralKeys.BRAPI_BASE_URL, newValue.toString()); editor.apply(); // Call our brapi authorize function if (brapiPrefCategory != null) { // Start our login process BrapiControllerResponse brapiControllerResponse = BrAPIService.authorizeBrAPI(prefMgr.getSharedPreferences(), context, null); // Show our error message if it exists processResponseMessage(brapiControllerResponse); // Set our button visibility and text setButtonView(); } } return true; }
Example #17
Source File: TalkBackDeveloperPreferencesActivity.java From talkback with Apache License 2.0 | 6 votes |
private void updateDumpA11yEventPreferenceSummary() { final Preference prefDumpA11yEvent = findPreference(getString(R.string.pref_dump_a11y_event_key)); if (prefDumpA11yEvent == null || prefs == null) { return; } int count = 0; int[] eventTypes = AccessibilityEventUtils.getAllEventTypes(); int dumpEventMask = prefs.getInt(getString(R.string.pref_dump_event_mask_key), 0); for (int eventType : eventTypes) { if ((eventType & dumpEventMask) != 0) { count++; } } prefDumpA11yEvent.setSummary( getResources() .getQuantityString( R.plurals.template_dump_event_count, /* id */ count, /* quantity */ count /* formatArgs */)); }
Example #18
Source File: EventPreferencesNFC.java From PhoneProfilesPlus with Apache License 2.0 | 6 votes |
@Override void checkPreferences(PreferenceManager prefMng, Context context) { boolean enabled = Event.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; Preference nfcTagsPreference = prefMng.findPreference(PREF_EVENT_NFC_NFC_TAGS); Preference permanentRunPreference = prefMng.findPreference(PREF_EVENT_NFC_PERMANENT_RUN); Preference durationPreference = prefMng.findPreference(PREF_EVENT_NFC_DURATION); if (nfcTagsPreference != null) nfcTagsPreference.setEnabled(enabled); if (permanentRunPreference != null) permanentRunPreference.setEnabled(enabled); SharedPreferences preferences = prefMng.getSharedPreferences(); if (preferences != null) { boolean permanentRun = preferences.getBoolean(PREF_EVENT_NFC_PERMANENT_RUN, false); enabled = enabled && (!permanentRun); if (durationPreference != null) durationPreference.setEnabled(enabled); } }
Example #19
Source File: SettingFragment.java From mhzs with MIT License | 6 votes |
private void globalSet(Preference preference) { // TODO: 2019/3/14 0014 检查模块运行状态2/3 // if (switchPreferenceCompat.isChecked() && !isModuleActive() && !isExpModuleActive()) { // switchPreferenceCompat.setChecked(false); // pcDetailPreferenceGroup.setVisible(false); // ToastUtils.toast(getActivity(), "请在Xposed框架中激活!"); // return; // } if (switchPreferenceCompat.isChecked()) { pcDetailPreferenceGroup.setVisible(true); ToastUtils.toast(getActivity(), "麻花助手已经开启!"); } else { pcDetailPreferenceGroup.setVisible(false); ToastUtils.toast(getActivity(), "麻花助手已经关闭!"); } }
Example #20
Source File: RecipientPreferenceActivity.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override public boolean onPreferenceClick(Preference preference) { Uri current; Uri defaultUri; if (calls) { current = recipient.get().getCallRingtone(); defaultUri = TextSecurePreferences.getCallNotificationRingtone(getContext()); } else { current = recipient.get().getMessageRingtone(); defaultUri = TextSecurePreferences.getNotificationRingtone(getContext()); } if (current == null) current = Settings.System.DEFAULT_NOTIFICATION_URI; else if (current.toString().isEmpty()) current = null; Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true); intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, defaultUri); intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, calls ? RingtoneManager.TYPE_RINGTONE : RingtoneManager.TYPE_NOTIFICATION); intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, current); startActivityForResult(intent, calls ? 2 : 1); return true; }
Example #21
Source File: AppProtectionPreferenceFragment.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override public boolean onPreferenceClick(Preference preference) { new TimeDurationPickerDialog(requireContext(), (view, duration) -> { long timeoutSeconds = TimeUnit.MILLISECONDS.toSeconds(duration); TextSecurePreferences.setPassphraseLockTimeout(requireContext(), timeoutSeconds); preference.setSummary(getLockTimeoutSummary(timeoutSeconds)); }, 0).show(); return true; }
Example #22
Source File: DeveloperPreferences.java From commcare-android with Apache License 2.0 | 5 votes |
private Preference[] getOnScreenPrefs() { PreferenceScreen prefScreen = getPreferenceScreen(); Preference[] prefs = new Preference[prefScreen.getPreferenceCount()]; for (int i = 0; i < prefScreen.getPreferenceCount(); i++) { prefs[i] = prefScreen.getPreference(i); } return prefs; }
Example #23
Source File: AppearancePreferenceFragment.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.appearance_preferences); Preference themePreference = findPreference(getString(R.string.theme_preference_key)); themePreference.setOnPreferenceChangeListener(createThemeChangeListener()); Preference toolbarElevationPreference = findPreference(getString(R.string.toolbar_elevation_preference_key)); toolbarElevationPreference .setOnPreferenceChangeListener(createToolbarElevationChangeListener()); Preference navigationWidthPreference = findPreference(getString(R.string.navigation_width_preference_key)); navigationWidthPreference .setOnPreferenceChangeListener(createNavigationWidthChangeListener()); Preference preferenceScreenElevationPreference = findPreference(getString(R.string.preference_screen_elevation_preference_key)); preferenceScreenElevationPreference .setOnPreferenceChangeListener(createPreferenceScreenElevationChangeListener()); Preference breadCrumbElevationPreference = findPreference(getString(R.string.bread_crumb_elevation_preference_key)); breadCrumbElevationPreference .setOnPreferenceChangeListener(createBreadCrumbElevationChangeListener()); Preference wizardButtonBarElevationPreference = findPreference(getString(R.string.wizard_button_bar_elevation_preference_key)); wizardButtonBarElevationPreference .setOnPreferenceChangeListener(createWizardButtonBarElevationChangeListener()); Preference preferenceFragmentButtonBarElevationPreference = findPreference( getString(R.string.preference_fragment_button_bar_elevation_preference_key)); preferenceFragmentButtonBarElevationPreference.setOnPreferenceChangeListener( createPreferenceFragmentButtonBarElevationChangeListener()); }
Example #24
Source File: SettingsActivity.java From GotoBrowser with GNU General Public License v3.0 | 5 votes |
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); findPreference(PREF_APP_VERSION).setSummary(BuildConfig.VERSION_NAME); Map<String, ?> allEntries = sharedPref.getAll(); for (String key : allEntries.keySet()) { Log.e("GOTO", key); Preference preference = findPreference(key); if (preference == null) continue; if (preference instanceof ListPreference) { Log.e("GOTO", key + ": " + sharedPref.getString(key, "")); } else if (preference instanceof SwitchPreferenceCompat) { Log.e("GOTO", key + ": " + sharedPref.getBoolean(key, false)); SwitchPreferenceCompat sp = (SwitchPreferenceCompat) preference; sp.setChecked(sharedPref.getBoolean(key, false)); } preference.setOnPreferenceChangeListener(this); } String subtitleLocale = sharedPref.getString(PREF_SUBTITLE_LOCALE, ""); if (subtitleLocale.length() > 0) { setSubtitlePreference(subtitleLocale); } else { findPreference(PREF_SUBTITLE_UPDATE).setEnabled(false); findPreference(PREF_SUBTITLE_UPDATE).setSummary(getString(R.string.subtitle_select_language)); } }
Example #25
Source File: NavigationPreferenceAdapter.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
/** * Updates the navigation preferences, which are contained by the adapter. */ private void updateNavigationPreferences() { List<NavigationPreference> oldNavigationPreferences = new ArrayList<>(navigationPreferences); navigationPreferences.clear(); boolean selectedNavigationPreferenceFound = selectedNavigationPreference == null; for (int i = 0; i < getItemCount(); i++) { Preference item = getItem(i); if (item instanceof NavigationPreference) { NavigationPreference navigationPreference = (NavigationPreference) item; navigationPreferences.add(navigationPreference); if (selectedNavigationPreference == navigationPreference) { selectedNavigationPreferenceFound = true; } if (!oldNavigationPreferences.contains(navigationPreference)) { notifyOnNavigationPreferenceAdded(navigationPreference); oldNavigationPreferences.remove(navigationPreference); } } } for (NavigationPreference removedNavigationPreference : oldNavigationPreferences) { notifyOnNavigationPreferenceRemoved(removedNavigationPreference); } if (!selectedNavigationPreferenceFound) { if (getNavigationPreferenceCount() > 0) { selectNavigationPreference(Math.min(selectedNavigationPreferenceIndex, getNavigationPreferenceCount() - 1), null); } else { selectNavigationPreference(null, null); } } }
Example #26
Source File: SearchPreferenceResult.java From SearchPreference with MIT License | 5 votes |
private void doHighlight(final PreferenceFragmentCompat prefsFragment) { final Preference prefResult = prefsFragment.findPreference(getKey()); if (prefResult == null) { Log.e("doHighlight", "Preference not found on given screen"); return; } final RecyclerView recyclerView = prefsFragment.getListView(); final RecyclerView.Adapter<?> adapter = recyclerView.getAdapter(); if (adapter instanceof PreferenceGroup.PreferencePositionCallback) { PreferenceGroup.PreferencePositionCallback callback = (PreferenceGroup.PreferencePositionCallback) adapter; final int position = callback.getPreferenceAdapterPosition(prefResult); if (position != RecyclerView.NO_POSITION) { recyclerView.scrollToPosition(position); recyclerView.postDelayed(() -> { RecyclerView.ViewHolder holder = recyclerView.findViewHolderForAdapterPosition(position); if (holder != null) { Drawable background = holder.itemView.getBackground(); if (Build.VERSION.SDK_INT >= 21 && background instanceof RippleDrawable) { forceRippleAnimation((RippleDrawable) background); return; } } highlightFallback(prefsFragment, prefResult); }, 200); return; } } highlightFallback(prefsFragment, prefResult); }
Example #27
Source File: OverrideApnFragment.java From android-testdpc with Apache License 2.0 | 5 votes |
@Override public boolean onPreferenceClick(Preference preference) { String key = preference.getKey(); switch (key) { case INSERT_OVERRIDE_APN_KEY: showInsertOverrideApnDialog(); return true; case REMOVE_OVERRIDE_APN_KEY: onRemoveOverrideApn(); return true; } return false; }
Example #28
Source File: NumPickerDialog.java From UpdogFarmer with GNU General Public License v3.0 | 5 votes |
public static NumPickerDialog newInstance(Preference preference) { final NumPickerDialog fragment = new NumPickerDialog(); final Bundle args = new Bundle(); args.putString("key", preference.getKey()); fragment.setArguments(args); return fragment; }
Example #29
Source File: SketchPropertiesFragment.java From APDE with GNU General Public License v2.0 | 5 votes |
private static void bindPreferenceSummaryToValue(Preference preference) { // Set the listener to watch for value changes. preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); // Trigger the listener immediately with the preference's // current value. sBindPreferenceSummaryToValueListener.onPreferenceChange( preference, PreferenceManager.getDefaultSharedPreferences( preference.getContext()).getString(preference.getKey(), "")); }
Example #30
Source File: SettingsFragment.java From zapp with MIT License | 5 votes |
@Override public void onDisplayPreferenceDialog(Preference preference) { if (preference instanceof DeleteSearchQueriesPreference) { DialogFragment dialogFragment = DeleteSearchQueriesPreferenceDialog.newInstance(preference.getKey()); dialogFragment.setTargetFragment(this, 0); dialogFragment.show(Objects.requireNonNull(getParentFragmentManager()), null); return; } super.onDisplayPreferenceDialog(preference); }