use of com.android.settingslib.accounts.AuthenticatorHelper in project android_packages_apps_Settings by omnirom.
the class AccountDetailDashboardFragment method updateUi.
@VisibleForTesting
void updateUi() {
final Context context = getContext();
UserHandle userHandle = null;
Bundle args = getArguments();
if (args != null && args.containsKey(KEY_USER_HANDLE)) {
userHandle = args.getParcelable(KEY_USER_HANDLE);
}
final AuthenticatorHelper helper = new AuthenticatorHelper(context, userHandle, null);
final AccountTypePreferenceLoader accountTypePreferenceLoader = new AccountTypePreferenceLoader(this, helper, userHandle);
PreferenceScreen prefs = accountTypePreferenceLoader.addPreferencesForType(mAccountType, getPreferenceScreen());
if (prefs != null) {
accountTypePreferenceLoader.updatePreferenceIntents(prefs, mAccountType, mAccount);
}
}
use of com.android.settingslib.accounts.AuthenticatorHelper in project android_packages_apps_Settings by omnirom.
the class AccountHeaderPreferenceController method onResume.
@Override
public void onResume() {
final AuthenticatorHelper helper = new AuthenticatorHelper(mContext, mUserHandle, null);
EntityHeaderController.newInstance(mActivity, mHost, mHeaderPreference.findViewById(R.id.entity_header)).setLabel(mAccount.name).setIcon(helper.getDrawableForType(mContext, mAccount.type)).done(mActivity, true);
}
use of com.android.settingslib.accounts.AuthenticatorHelper in project android_packages_apps_Settings by omnirom.
the class AccountTypePreferenceLoaderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
ShadowApplication shadowContext = ShadowApplication.getInstance();
shadowContext.setSystemService(Context.ACCOUNT_SERVICE, mAccountManager);
when(mAccountManager.getAuthenticatorTypesAsUser(anyInt())).thenReturn(new AuthenticatorDescription[0]);
when(mAccountManager.getAccountsAsUser(anyInt())).thenReturn(new Account[0]);
when(mPreferenceFragment.getActivity().getPackageManager()).thenReturn(mPackageManager);
mContext = RuntimeEnvironment.application;
mAccount = new Account("name", "type");
final AuthenticatorHelper helper = new AuthenticatorHelper(mContext, UserHandle.CURRENT, null);
mPrefLoader = spy(new AccountTypePreferenceLoader(mPreferenceFragment, helper, UserHandle.CURRENT));
}
Aggregations