org.chromium.chrome.browser.preferences.ChromeBasePreference Java Examples
The following examples show how to use
org.chromium.chrome.browser.preferences.ChromeBasePreference.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccountManagementFragment.java From delion with Apache License 2.0 | 5 votes |
private void updateAccountsList() { PreferenceScreen prefScreen = getPreferenceScreen(); if (prefScreen == null) return; for (int i = 0; i < mAccountsListPreferences.size(); i++) { prefScreen.removePreference(mAccountsListPreferences.get(i)); } mAccountsListPreferences.clear(); final Preferences activity = (Preferences) getActivity(); Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts(); int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER; for (Account account : accounts) { ChromeBasePreference pref = new ChromeBasePreference(activity); pref.setSelectable(false); pref.setTitle(account.name); boolean isChildAccount = ChildAccountService.isChildAccount(); pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources()))); pref.setOrder(nextPrefOrder++); prefScreen.addPreference(pref); mAccountsListPreferences.add(pref); } }
Example #2
Source File: AccountManagementFragment.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void updateAccountsList() { PreferenceScreen prefScreen = getPreferenceScreen(); if (prefScreen == null) return; for (int i = 0; i < mAccountsListPreferences.size(); i++) { prefScreen.removePreference(mAccountsListPreferences.get(i)); } mAccountsListPreferences.clear(); final Preferences activity = (Preferences) getActivity(); Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts(); int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER; for (Account account : accounts) { ChromeBasePreference pref = new ChromeBasePreference(activity); pref.setSelectable(false); pref.setTitle(account.name); boolean isChildAccount = ChildAccountService.isChildAccount(); pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources()))); pref.setOrder(nextPrefOrder++); prefScreen.addPreference(pref); mAccountsListPreferences.add(pref); } }
Example #3
Source File: AccountManagementFragment.java From 365browser with Apache License 2.0 | 5 votes |
private void updateAccountsList() { PreferenceScreen prefScreen = getPreferenceScreen(); if (prefScreen == null) return; for (int i = 0; i < mAccountsListPreferences.size(); i++) { prefScreen.removePreference(mAccountsListPreferences.get(i)); } mAccountsListPreferences.clear(); final Preferences activity = (Preferences) getActivity(); Account[] accounts = AccountManagerHelper.get().getGoogleAccounts(); int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER; for (Account account : accounts) { ChromeBasePreference pref = new ChromeBasePreference(activity); pref.setSelectable(false); pref.setTitle(account.name); boolean isChildAccount = mProfile.isChild(); pref.setUseReducedPadding(isChildAccount); pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources()))); pref.setOrder(nextPrefOrder++); prefScreen.addPreference(pref); mAccountsListPreferences.add(pref); } }
Example #4
Source File: AccountManagementFragment.java From 365browser with Apache License 2.0 | 4 votes |
private void configureChildAccountPreferences() { Preference parentAccounts = findPreference(PREF_PARENT_ACCOUNTS); Preference childContent = findPreference(PREF_CHILD_CONTENT); if (mProfile.isChild()) { 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); ((ChromeBasePreference) parentAccounts).setUseReducedPadding(true); final int childContentSummary; int defaultBehavior = prefService.getDefaultSupervisedUserFilteringBehavior(); if (defaultBehavior == PrefServiceBridge.SUPERVISED_USER_FILTERING_BLOCK) { childContentSummary = R.string.account_management_child_content_approved; } else if (prefService.isSupervisedUserSafeSitesEnabled()) { childContentSummary = R.string.account_management_child_content_filter_mature; } else { childContentSummary = R.string.account_management_child_content_all; } childContent.setSummary(childContentSummary); // TODO(dgn): made selectable to show the dividers. Find a way to avoid this. A side // effect is that it shows a tap ripple on an item that is not interactive. // childContent.setSelectable(false); Drawable newIcon = ApiCompatibilityUtils.getDrawable( getResources(), R.drawable.ic_drive_site_white_24dp); newIcon.mutate().setColorFilter( ApiCompatibilityUtils.getColor(getResources(), R.color.google_grey_600), PorterDuff.Mode.SRC_IN); childContent.setIcon(newIcon); } else { PreferenceScreen prefScreen = getPreferenceScreen(); prefScreen.removePreference(findPreference(PREF_PARENTAL_SETTINGS)); prefScreen.removePreference(parentAccounts); prefScreen.removePreference(childContent); } }