本文整理汇总了Java中android.preference.Preference.setSelectable方法的典型用法代码示例。如果您正苦于以下问题:Java Preference.setSelectable方法的具体用法?Java Preference.setSelectable怎么用?Java Preference.setSelectable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.Preference
的用法示例。
在下文中一共展示了Preference.setSelectable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureChildAccountPreferences
import android.preference.Preference; //导入方法依赖的package包/类
private void configureChildAccountPreferences() {
Preference parentAccounts = findPreference(PREF_PARENT_ACCOUNTS);
Preference childContent = findPreference(PREF_CHILD_CONTENT);
Preference childSafeSites = findPreference(PREF_CHILD_SAFE_SITES);
if (ChildAccountService.isChildAccount()) {
Resources res = getActivity().getResources();
PrefServiceBridge prefService = PrefServiceBridge.getInstance();
String firstParent = prefService.getSupervisedUserCustodianEmail();
String secondParent = prefService.getSupervisedUserSecondCustodianEmail();
String parentText;
if (!secondParent.isEmpty()) {
parentText = res.getString(R.string.account_management_two_parent_names,
firstParent, secondParent);
} else if (!firstParent.isEmpty()) {
parentText = res.getString(R.string.account_management_one_parent_name,
firstParent);
} else {
parentText = res.getString(R.string.account_management_no_parental_data);
}
parentAccounts.setSummary(parentText);
parentAccounts.setSelectable(false);
final boolean unapprovedContentBlocked =
prefService.getDefaultSupervisedUserFilteringBehavior()
== PrefServiceBridge.SUPERVISED_USER_FILTERING_BLOCK;
final String contentText = res.getString(
unapprovedContentBlocked ? R.string.account_management_child_content_approved
: R.string.account_management_child_content_all);
childContent.setSummary(contentText);
childContent.setSelectable(false);
final String safeSitesText = res.getString(
prefService.isSupervisedUserSafeSitesEnabled()
? R.string.text_on : R.string.text_off);
childSafeSites.setSummary(safeSitesText);
childSafeSites.setSelectable(false);
} else {
PreferenceScreen prefScreen = getPreferenceScreen();
prefScreen.removePreference(findPreference(PREF_PARENTAL_SETTINGS));
prefScreen.removePreference(parentAccounts);
prefScreen.removePreference(childContent);
prefScreen.removePreference(childSafeSites);
}
}