use of android.preference.PreferenceGroup in project android_packages_apps_Settings by LineageOS.
the class SettingsHookTests method testOperatorPreferenceAvailable.
/**
* Test that the operator preference is available in the Settings
* application.
*/
public void testOperatorPreferenceAvailable() {
PreferenceGroup root = (PreferenceGroup) mSettings.findPreference(KEY_SETTINGS_ROOT);
Preference operatorPreference = root.findPreference(KEY_SETTINGS_OPERATOR);
assertNotNull(operatorPreference);
}
use of android.preference.PreferenceGroup in project android_packages_apps_Settings by LineageOS.
the class SettingsHookTests method testManufacturerPreferenceAvailable.
/**
* Test that the manufacturer preference is available in the Settings
* application.
*/
public void testManufacturerPreferenceAvailable() {
PreferenceGroup root = (PreferenceGroup) mSettings.findPreference(KEY_SETTINGS_ROOT);
Preference manufacturerHook = root.findPreference(KEY_SETTINGS_MANUFACTURER);
assertNotNull(manufacturerHook);
}
use of android.preference.PreferenceGroup in project android_packages_apps_Settings by LineageOS.
the class TextToSpeechSettings method addEngineSpecificSettings.
private void addEngineSpecificSettings() {
PreferenceGroup enginesCategory = (PreferenceGroup) findPreference("tts_engines_section");
Intent intent = new Intent("android.intent.action.START_TTS_ENGINE");
ResolveInfo[] enginesArray = new ResolveInfo[0];
PackageManager pm = getPackageManager();
enginesArray = pm.queryIntentActivities(intent, 0).toArray(enginesArray);
for (int i = 0; i < enginesArray.length; i++) {
String prefKey = "";
final String pluginPackageName = enginesArray[i].activityInfo.packageName;
if (!enginesArray[i].activityInfo.packageName.equals(SYSTEM_TTS)) {
CheckBoxPreference chkbxPref = new CheckBoxPreference(this);
prefKey = KEY_PLUGIN_ENABLED_PREFIX + pluginPackageName;
chkbxPref.setKey(prefKey);
chkbxPref.setTitle(enginesArray[i].loadLabel(pm));
enginesCategory.addPreference(chkbxPref);
}
if (pluginHasSettings(pluginPackageName)) {
Preference pref = new Preference(this);
prefKey = KEY_PLUGIN_SETTINGS_PREFIX + pluginPackageName;
pref.setKey(prefKey);
pref.setTitle(enginesArray[i].loadLabel(pm));
CharSequence settingsLabel = getResources().getString(R.string.tts_engine_name_settings, enginesArray[i].loadLabel(pm));
pref.setSummary(settingsLabel);
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
Intent i = new Intent();
i.setClassName(pluginPackageName, pluginPackageName + ".EngineSettings");
startActivity(i);
return true;
}
});
enginesCategory.addPreference(pref);
}
}
}
use of android.preference.PreferenceGroup in project xabber-android by redsolution.
the class PreferenceSummaryHelper 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 WordPress-Android by wordpress-mobile.
the class WPPrefUtils method removePreference.
/**
* Removes a {@link Preference} from the {@link PreferenceCategory} with the given key.
*/
public static void removePreference(PreferenceFragment prefFrag, int parentKey, int prefKey) {
String parentName = prefFrag.getString(parentKey);
String prefName = prefFrag.getString(prefKey);
PreferenceGroup parent = (PreferenceGroup) prefFrag.findPreference(parentName);
Preference child = prefFrag.findPreference(prefName);
if (parent != null && child != null) {
parent.removePreference(child);
}
}
Aggregations