Java Code Examples for org.chromium.chrome.browser.preferences.ChromeBasePreference#setTitle()

The following examples show how to use org.chromium.chrome.browser.preferences.ChromeBasePreference#setTitle() . 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 vote down vote up
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 vote down vote up
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 vote down vote up
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);
    }
}