Search in sources :

Example 31 with PreferenceGroup

use of android.preference.PreferenceGroup in project android_packages_apps_Settings by LineageOS.

the class Settings method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);
    PreferenceGroup parent = (PreferenceGroup) findPreference(KEY_PARENT);
    Utils.updatePreferenceToSpecificActivityOrRemove(this, parent, KEY_SYNC_SETTINGS, 0);
    mLauncherSettings = parent.findPreference(KEY_LAUNCHER);
    Preference dockSettings = parent.findPreference(KEY_DOCK_SETTINGS);
    if (getResources().getBoolean(R.bool.has_dock_settings) == false && dockSettings != null) {
        parent.removePreference(dockSettings);
    }
    Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(this, parent, KEY_OPERATOR_SETTINGS);
    Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(this, parent, KEY_MANUFACTURER_SETTINGS);
}
Also used : Preference(android.preference.Preference) PreferenceGroup(android.preference.PreferenceGroup)

Example 32 with PreferenceGroup

use of android.preference.PreferenceGroup in project xabber-android by redsolution.

the class PreferenceSummaryHelperActivity method updateSummary.

public static void updateSummary(PreferenceGroup group) {
    for (int index = 0; index < group.getPreferenceCount(); index++) {
        Preference preference = group.getPreference(index);
        if (preference instanceof PreferenceGroup) {
            updateSummary((PreferenceGroup) preference);
        }
        String titleAndSummary = preference.getTitle().toString();
        if (!isTitleAndSummary(titleAndSummary)) {
            continue;
        }
        preference.setTitle(getPreferenceTitle(titleAndSummary));
        if (preference instanceof DialogPreference) {
            ((DialogPreference) preference).setDialogTitle(preference.getTitle());
        }
        preference.setSummary(getPreferenceSummary(titleAndSummary));
    }
}
Also used : Preference(android.preference.Preference) DialogPreference(android.preference.DialogPreference) DialogPreference(android.preference.DialogPreference) PreferenceGroup(android.preference.PreferenceGroup)

Example 33 with PreferenceGroup

use of android.preference.PreferenceGroup in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class CustomInputStyleSettingsFragment method setPrefSubtypes.

private void setPrefSubtypes(final String prefSubtypes, final Context context) {
    final PreferenceGroup group = getPreferenceScreen();
    group.removeAll();
    final InputMethodSubtype[] subtypesArray = AdditionalSubtypeUtils.createAdditionalSubtypesArray(prefSubtypes);
    for (final InputMethodSubtype subtype : subtypesArray) {
        final CustomInputStylePreference pref = new CustomInputStylePreference(context, subtype, this);
        group.addPreference(pref);
    }
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) PreferenceGroup(android.preference.PreferenceGroup)

Example 34 with PreferenceGroup

use of android.preference.PreferenceGroup in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class CustomInputStyleSettingsFragment method onAddCustomInputStyle.

@Override
public void onAddCustomInputStyle(final CustomInputStylePreference stylePref) {
    mIsAddingNewSubtype = false;
    final InputMethodSubtype subtype = stylePref.getSubtype();
    if (findDuplicatedSubtype(subtype) == null) {
        mRichImm.setAdditionalInputMethodSubtypes(getSubtypes());
        mSubtypePreferenceKeyForSubtypeEnabler = stylePref.getKey();
        mSubtypeEnablerNotificationDialog = createDialog();
        mSubtypeEnablerNotificationDialog.show();
        return;
    }
    // Newly added subtype is duplicated.
    final PreferenceGroup group = getPreferenceScreen();
    group.removePreference(stylePref);
    showSubtypeAlreadyExistsToast(subtype);
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) PreferenceGroup(android.preference.PreferenceGroup)

Example 35 with PreferenceGroup

use of android.preference.PreferenceGroup in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class CustomInputStyleSettingsFragment method getSubtypes.

private InputMethodSubtype[] getSubtypes() {
    final PreferenceGroup group = getPreferenceScreen();
    final ArrayList<InputMethodSubtype> subtypes = new ArrayList<>();
    final int count = group.getPreferenceCount();
    for (int i = 0; i < count; i++) {
        final Preference pref = group.getPreference(i);
        if (pref instanceof CustomInputStylePreference) {
            final CustomInputStylePreference subtypePref = (CustomInputStylePreference) pref;
            // We should not save newly adding subtype to preference because it is incomplete.
            if (subtypePref.isIncomplete())
                continue;
            subtypes.add(subtypePref.getSubtype());
        }
    }
    return subtypes.toArray(new InputMethodSubtype[subtypes.size()]);
}
Also used : InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) Preference(android.preference.Preference) ArrayList(java.util.ArrayList) PreferenceGroup(android.preference.PreferenceGroup)

Aggregations

PreferenceGroup (android.preference.PreferenceGroup)38 Preference (android.preference.Preference)26 ListPreference (android.preference.ListPreference)7 SharedPreferences (android.content.SharedPreferences)6 CheckBoxPreference (android.preference.CheckBoxPreference)6 PreferenceScreen (android.preference.PreferenceScreen)6 Intent (android.content.Intent)5 Bundle (android.os.Bundle)4 TwoStatePreference (android.preference.TwoStatePreference)4 ArrayList (java.util.ArrayList)4 EditTextPreference (android.preference.EditTextPreference)3 MultiSelectListPreference (android.preference.MultiSelectListPreference)3 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)3 ChromeSwitchPreference (org.chromium.chrome.browser.preferences.ChromeSwitchPreference)3 Point (android.graphics.Point)2 DialogPreference (android.preference.DialogPreference)2 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)2 PreferenceCategory (android.preference.PreferenceCategory)2 SpannableString (android.text.SpannableString)2 View (android.view.View)2