use of android.support.v7.preference.TwoStatePreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SoundSettings method initIncreasingRing.
// === Increasing ringtone ===
private void initIncreasingRing() {
PreferenceScreen root = getPreferenceScreen();
mIncreasingRing = (TwoStatePreference) root.findPreference(CMSettings.System.INCREASING_RING);
mIncreasingRingVolume = (IncreasingRingVolumePreference) root.findPreference(KEY_INCREASING_RING_VOLUME);
if (mIncreasingRing == null || mIncreasingRingVolume == null || !mVoiceCapable) {
if (mIncreasingRing != null) {
root.removePreference(mIncreasingRing);
mIncreasingRing = null;
}
if (mIncreasingRingVolume != null) {
root.removePreference(mIncreasingRingVolume);
mIncreasingRingVolume = null;
}
} else {
mIncreasingRingVolume.setCallback(mIncreasingRingVolumeCallback);
}
}
use of android.support.v7.preference.TwoStatePreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InputMethodAndSubtypeEnabler method updateImplicitlyEnabledSubtypes.
private void updateImplicitlyEnabledSubtypes(final String targetImiId, final boolean check) {
// When targetImiId is null, apply to all subtypes of all IMEs
for (final InputMethodInfo imi : mInputMethodInfoList) {
final String imiId = imi.getId();
final TwoStatePreference autoSelectionPref = mAutoSelectionPrefsMap.get(imiId);
// "subtype auto selection".
if (autoSelectionPref == null || !autoSelectionPref.isChecked()) {
continue;
}
if (imiId.equals(targetImiId) || targetImiId == null) {
updateImplicitlyEnabledSubtypesOf(imi, check);
}
}
}
use of android.support.v7.preference.TwoStatePreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InputMethodAndSubtypeUtil method setSubtypesPreferenceEnabled.
static void setSubtypesPreferenceEnabled(final SettingsPreferenceFragment context, final List<InputMethodInfo> inputMethodProperties, final String id, final boolean enabled) {
final PreferenceScreen preferenceScreen = context.getPreferenceScreen();
for (final InputMethodInfo imi : inputMethodProperties) {
if (id.equals(imi.getId())) {
final int subtypeCount = imi.getSubtypeCount();
for (int i = 0; i < subtypeCount; ++i) {
final InputMethodSubtype subtype = imi.getSubtypeAt(i);
final TwoStatePreference pref = (TwoStatePreference) preferenceScreen.findPreference(id + subtype.hashCode());
if (pref != null) {
pref.setEnabled(enabled);
}
}
}
}
}
use of android.support.v7.preference.TwoStatePreference in project android_packages_apps_Settings by LineageOS.
the class AssistFlashScreenPreferenceController method updatePreference.
private void updatePreference() {
if (mPreference == null || !(mPreference instanceof TwoStatePreference)) {
return;
}
if (isAvailable()) {
if (mScreen.findPreference(getPreferenceKey()) == null) {
// add it if it's not on scree
mScreen.addPreference(mPreference);
}
} else {
mScreen.removePreference(mPreference);
}
ComponentName assistant = getCurrentAssist();
boolean isContextChecked = AssistContextPreferenceController.isChecked(mContext);
mPreference.setEnabled(isContextChecked && isPreInstalledAssistant(assistant));
((TwoStatePreference) mPreference).setChecked(willShowFlash(assistant));
}
use of android.support.v7.preference.TwoStatePreference in project android_packages_apps_Settings by LineageOS.
the class GesturePreferenceControllerTest method updateState_preferenceSetCheckedWhenSettingIsOn.
@Test
public void updateState_preferenceSetCheckedWhenSettingIsOn() {
// Mock a TwoStatePreference
final TwoStatePreference preference = mock(TwoStatePreference.class);
// Set the setting to be enabled.
mController.mIsPrefEnabled = true;
// Run through updateState
mController.updateState(preference);
// Verify pref is checked (as setting is enabled).
verify(preference).setChecked(true);
}
Aggregations