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);
}
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));
}
}
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);
}
}
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);
}
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()]);
}
Aggregations