Search in sources :

Example 1 with AccountFeatureProvider

use of com.android.settings.accounts.AccountFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BrandedAccountPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    final AccountFeatureProvider accountFeatureProvider = FeatureFactory.getFactory(mContext).getAccountFeatureProvider();
    final Preference accountPreference = screen.findPreference(getPreferenceKey());
    if (accountPreference != null && (mAccounts == null || mAccounts.length == 0)) {
        screen.removePreference(accountPreference);
        return;
    }
    accountPreference.setSummary(mAccounts[0].name);
    accountPreference.setOnPreferenceClickListener(preference -> {
        final Bundle args = new Bundle();
        args.putParcelable(AccountDetailDashboardFragment.KEY_ACCOUNT, mAccounts[0]);
        args.putParcelable(AccountDetailDashboardFragment.KEY_USER_HANDLE, android.os.Process.myUserHandle());
        args.putString(AccountDetailDashboardFragment.KEY_ACCOUNT_TYPE, accountFeatureProvider.getAccountType());
        new SubSettingLauncher(mContext).setDestination(AccountDetailDashboardFragment.class.getName()).setTitleRes(R.string.account_sync_title).setArguments(args).setSourceMetricsCategory(SettingsEnums.DEVICEINFO).launch();
        return true;
    });
}
Also used : AccountDetailDashboardFragment(com.android.settings.accounts.AccountDetailDashboardFragment) Preference(androidx.preference.Preference) SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) AccountFeatureProvider(com.android.settings.accounts.AccountFeatureProvider)

Aggregations

Bundle (android.os.Bundle)1 Preference (androidx.preference.Preference)1 AccountDetailDashboardFragment (com.android.settings.accounts.AccountDetailDashboardFragment)1 AccountFeatureProvider (com.android.settings.accounts.AccountFeatureProvider)1 SubSettingLauncher (com.android.settings.core.SubSettingLauncher)1