use of org.chromium.chrome.browser.preferences.Preferences in project AndroidChromium by JackyAndroid.
the class AccountManagementFragment method updateAccountsList.
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);
}
}
use of org.chromium.chrome.browser.preferences.Preferences in project AndroidChromium by JackyAndroid.
the class AccountManagementFragment method configureSyncSettings.
private void configureSyncSettings() {
final Preferences preferences = (Preferences) getActivity();
final Account account = ChromeSigninController.get(getActivity()).getSignedInUser();
findPreference(PREF_SYNC_SETTINGS).setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!isVisible() || !isResumed())
return false;
if (ProfileSyncService.get() == null)
return true;
Bundle args = new Bundle();
args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT, account.name);
preferences.startFragment(SyncCustomizationFragment.class.getName(), args);
return true;
}
});
}
Aggregations