Java Code Examples for androidx.preference.TwoStatePreference#setEnabled()
The following examples show how to use
androidx.preference.TwoStatePreference#setEnabled() .
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: 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 2
Source File: TalkBackPreferencesActivity.java From talkback with Apache License 2.0 | 5 votes |
private void updateTalkBackShortcutStatus() { final TwoStatePreference preference = (TwoStatePreference) findPreferenceByResId(R.string.pref_two_volume_long_press_key); if (preference == null) { return; } preference.setEnabled(TalkBackService.getInstance() != null || preference.isChecked()); }