Search in sources :

Example 11 with TwoStatePreference

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);
    }
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen)

Example 12 with TwoStatePreference

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);
        }
    }
}
Also used : TwoStatePreference(android.support.v7.preference.TwoStatePreference) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 13 with TwoStatePreference

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);
                }
            }
        }
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) TwoStatePreference(android.support.v7.preference.TwoStatePreference) PreferenceScreen(android.support.v7.preference.PreferenceScreen) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Aggregations

TwoStatePreference (android.support.v7.preference.TwoStatePreference)12 Preference (android.support.v7.preference.Preference)8 InputMethodInfo (android.view.inputmethod.InputMethodInfo)5 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)5 OnPreferenceChangeListener (android.support.v7.preference.Preference.OnPreferenceChangeListener)3 PreferenceScreen (android.support.v7.preference.PreferenceScreen)3 Context (android.content.Context)2 PreferenceCategory (android.support.v7.preference.PreferenceCategory)2 HashSet (java.util.HashSet)2 NotificationManager (android.app.NotificationManager)1 PackageManager (android.content.pm.PackageManager)1 DropDownPreference (android.support.v7.preference.DropDownPreference)1 RingtonePreference (com.android.settings.RingtonePreference)1 RestrictedPreference (com.android.settingslib.RestrictedPreference)1 ArrayList (java.util.ArrayList)1