Java Code Examples for androidx.preference.Preference#OnPreferenceClickListener
The following examples show how to use
androidx.preference.Preference#OnPreferenceClickListener .
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: PreferenceClickOnSubscribe.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void call(Subscriber<? super Preference> subscriber) { verifyMainThread(); Preference.OnPreferenceClickListener listener = new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(preference); return true; } return true; } }; subscriber.add(new MainThreadSubscription() { @Override protected void onUnsubscribe() { preference.setOnPreferenceClickListener(null); } }); preference.setOnPreferenceClickListener(listener); }
Example 2
Source File: PreferenceOnCheckOnSubscribe.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void call(Subscriber<? super Boolean> subscriber) { verifyMainThread(); Preference.OnPreferenceClickListener listener = new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(((CheckBoxPreference) preference).isChecked()); return true; } return true; } }; subscriber.add(new MainThreadSubscription() { @Override protected void onUnsubscribe() { preference.setOnPreferenceClickListener(null); } }); preference.setOnPreferenceClickListener(listener); }
Example 3
Source File: PreferenceFragment.java From AndroidMaterialPreferences with Apache License 2.0 | 5 votes |
/** * Creates and returns a listener, which allows to show a toast, when the {@link * ActionPreference} has been clicked. * * @return The listener, which has been created, as an instance of the type {@link * Preference.OnPreferenceClickListener} */ private Preference.OnPreferenceClickListener createActionPreferenceClickListener() { return new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Toast.makeText(getActivity(), R.string.action_preference_toast, Toast.LENGTH_SHORT) .show(); return true; } }; }
Example 4
Source File: SwitchPreferenceCompat.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public void setOnPreferenceClickListener(Preference.OnPreferenceClickListener listener) { this.listener = listener; }
Example 5
Source File: DialogEnabledPreferenceFragment.java From TowerCollector with Mozilla Public License 2.0 | 4 votes |
protected void setupOnClick(final int preferenceKey, final Preference.OnPreferenceClickListener clickAction) { PreferenceScreen preference = findPreference(getString(preferenceKey)); preference.setOnPreferenceClickListener(clickAction); }
Example 6
Source File: SwitchPreferenceCompat.java From deltachat-android with GNU General Public License v3.0 | 4 votes |
@Override public void setOnPreferenceClickListener(Preference.OnPreferenceClickListener listener) { this.listener = listener; }