本文整理汇总了Java中android.preference.PreferenceGroup.removeAll方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceGroup.removeAll方法的具体用法?Java PreferenceGroup.removeAll怎么用?Java PreferenceGroup.removeAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.PreferenceGroup
的用法示例。
在下文中一共展示了PreferenceGroup.removeAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceAllCheckBoxPreferencesBySwitchPreferences
import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private static void replaceAllCheckBoxPreferencesBySwitchPreferences(
final PreferenceGroup group) {
final ArrayList<Preference> preferences = new ArrayList<>();
final int count = group.getPreferenceCount();
for (int index = 0; index < count; index++) {
preferences.add(group.getPreference(index));
}
group.removeAll();
for (int index = 0; index < count; index++) {
final Preference preference = preferences.get(index);
if (preference instanceof CheckBoxPreference) {
addSwitchPreferenceBasedOnCheckBoxPreference((CheckBoxPreference)preference, group);
} else {
group.addPreference(preference);
if (preference instanceof PreferenceGroup) {
replaceAllCheckBoxPreferencesBySwitchPreferences((PreferenceGroup)preference);
}
}
}
}
示例2: rebuildProfileList
import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private void rebuildProfileList() {
// Add an edit preference for each current Chrome profile.
PreferenceGroup profileCategory = (PreferenceGroup) findPreference(PREF_AUTOFILL_PROFILES);
profileCategory.removeAll();
for (AutofillProfile profile : PersonalDataManager.getInstance().getProfilesForSettings()) {
// Add an item on the current page...
Preference pref = new Preference(getActivity());
pref.setTitle(profile.getFullName());
pref.setSummary(profile.getLabel());
if (profile.getIsLocal()) {
pref.setFragment(AutofillProfileEditor.class.getName());
} else {
pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
pref.setFragment(AutofillServerProfilePreferences.class.getName());
}
Bundle args = pref.getExtras();
args.putString(AUTOFILL_GUID, profile.getGUID());
profileCategory.addPreference(pref);
}
}
示例3: rebuildCreditCardList
import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private void rebuildCreditCardList() {
PreferenceGroup profileCategory =
(PreferenceGroup) findPreference(PREF_AUTOFILL_CREDIT_CARDS);
profileCategory.removeAll();
for (CreditCard card : PersonalDataManager.getInstance().getCreditCardsForSettings()) {
// Add an item on the current page...
Preference pref = new Preference(getActivity());
pref.setTitle(card.getObfuscatedNumber());
pref.setSummary(card.getFormattedExpirationDate(getActivity()));
if (card.getIsLocal()) {
pref.setFragment(AutofillLocalCardEditor.class.getName());
} else {
pref.setFragment(AutofillServerCardEditor.class.getName());
pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
}
Bundle args = pref.getExtras();
args.putString(AUTOFILL_GUID, card.getGUID());
profileCategory.addPreference(pref);
}
}
示例4: createUserDictSettings
import android.preference.PreferenceGroup; //导入方法依赖的package包/类
/**
* Creates the entries that allow the user to go into the user dictionary for each locale.
* @param userDictGroup The group to put the settings in.
*/
protected void createUserDictSettings(final PreferenceGroup userDictGroup) {
final Activity activity = getActivity();
userDictGroup.removeAll();
final TreeSet<String> localeSet =
UserDictionaryList.getUserDictionaryLocalesSet(activity);
if (localeSet.size() > 1) {
// Have an "All languages" entry in the languages list if there are two or more active
// languages
localeSet.add("");
}
if (localeSet.isEmpty()) {
userDictGroup.addPreference(createUserDictionaryPreference(null));
} else {
for (String locale : localeSet) {
userDictGroup.addPreference(createUserDictionaryPreference(locale));
}
}
}
示例5: rebuildProfileList
import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private void rebuildProfileList() {
// Add an edit preference for each current Chrome profile.
PreferenceGroup profileCategory = (PreferenceGroup) findPreference(PREF_AUTOFILL_PROFILES);
profileCategory.removeAll();
for (AutofillProfile profile : PersonalDataManager.getInstance().getProfiles()) {
// Add an item on the current page...
Preference pref = new Preference(getActivity());
pref.setTitle(profile.getFullName());
pref.setSummary(profile.getLabel());
if (profile.getIsLocal()) {
pref.setFragment(AutofillProfileEditor.class.getName());
} else {
pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
pref.setFragment(AutofillServerProfilePreferences.class.getName());
}
Bundle args = pref.getExtras();
args.putString(AUTOFILL_GUID, profile.getGUID());
profileCategory.addPreference(pref);
}
}
示例6: rebuildCreditCardList
import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private void rebuildCreditCardList() {
PreferenceGroup profileCategory =
(PreferenceGroup) findPreference(PREF_AUTOFILL_CREDIT_CARDS);
profileCategory.removeAll();
for (CreditCard card : PersonalDataManager.getInstance().getCreditCards()) {
// Add an item on the current page...
Preference pref = new Preference(getActivity());
pref.setTitle(card.getObfuscatedNumber());
pref.setSummary(card.getFormattedExpirationDate(getActivity()));
if (card.getIsLocal()) {
pref.setFragment(AutofillCreditCardEditor.class.getName());
} else {
pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
pref.setFragment(AutofillServerCardPreferences.class.getName());
}
Bundle args = pref.getExtras();
args.putString(AUTOFILL_GUID, card.getGUID());
profileCategory.addPreference(pref);
}
}
示例7: setPrefSubtypes
import android.preference.PreferenceGroup; //导入方法依赖的package包/类
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);
}
}