use of com.android.settingslib.accounts.AuthenticatorHelper in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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 Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountPreferenceBase method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
final Activity activity = getActivity();
mUserHandle = Utils.getSecureTargetUser(activity.getActivityToken(), mUm, getArguments(), activity.getIntent().getExtras());
mAuthenticatorHelper = new AuthenticatorHelper(activity, mUserHandle, this);
mAccountTypePreferenceLoader = new AccountTypePreferenceLoader(this, mAuthenticatorHelper, mUserHandle);
}
use of com.android.settingslib.accounts.AuthenticatorHelper in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TopLevelAccountEntryPreferenceController method getSummary.
@Override
public CharSequence getSummary() {
final AuthenticatorHelper authHelper = new AuthenticatorHelper(mContext, UserHandle.of(UserHandle.myUserId()), null);
final String[] types = authHelper.getEnabledAccountTypes();
final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
final List<CharSequence> summaries = new ArrayList<>();
if (types == null || types.length == 0) {
summaries.add(mContext.getString(R.string.account_dashboard_default_summary));
} else {
// Show up to 3 account types, ignore any null value
int accountToAdd = Math.min(3, types.length);
for (int i = 0; i < types.length && accountToAdd > 0; i++) {
final CharSequence label = authHelper.getLabelForType(mContext, types[i]);
if (TextUtils.isEmpty(label)) {
continue;
}
summaries.add(bidiFormatter.unicodeWrap(label));
accountToAdd--;
}
}
return ListFormatter.getInstance().format(summaries);
}
use of com.android.settingslib.accounts.AuthenticatorHelper in project android_packages_apps_Settings by omnirom.
the class AccountPreferenceController method updateProfileUi.
private void updateProfileUi(final UserInfo userInfo) {
if (mFragment.getPreferenceManager() == null) {
return;
}
final ProfileData data = mProfiles.get(userInfo.id);
if (data != null) {
data.pendingRemoval = false;
data.userInfo = userInfo;
if (userInfo.isEnabled()) {
// recreate the authentication helper to refresh the list of enabled accounts
data.authenticatorHelper = new AuthenticatorHelper(mContext, userInfo.getUserHandle(), this);
}
return;
}
final Context context = mContext;
final ProfileData profileData = new ProfileData();
profileData.userInfo = userInfo;
AccessiblePreferenceCategory preferenceGroup = mHelper.createAccessiblePreferenceCategory(mFragment.getPreferenceManager().getContext());
preferenceGroup.setOrder(mAccountProfileOrder++);
// default title; may be modified below
preferenceGroup.setTitle(R.string.account_settings);
if (isSingleProfile()) {
final String title = context.getString(R.string.account_for_section_header, BidiFormatter.getInstance().unicodeWrap(userInfo.name));
preferenceGroup.setTitle(title);
preferenceGroup.setContentDescription(title);
} else if (userInfo.isManagedProfile()) {
if (mType == ProfileSelectFragment.ProfileType.ALL) {
preferenceGroup.setTitle(R.string.category_work);
final String workGroupSummary = getWorkGroupSummary(context, userInfo);
preferenceGroup.setSummary(workGroupSummary);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_work, workGroupSummary));
}
profileData.removeWorkProfilePreference = newRemoveWorkProfilePreference();
mHelper.enforceRestrictionOnPreference(profileData.removeWorkProfilePreference, DISALLOW_REMOVE_MANAGED_PROFILE, UserHandle.myUserId());
profileData.managedProfilePreference = newManagedProfileSettings();
} else {
if (mType == ProfileSelectFragment.ProfileType.ALL) {
preferenceGroup.setTitle(R.string.category_personal);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_personal));
}
}
final PreferenceScreen screen = mFragment.getPreferenceScreen();
if (screen != null) {
screen.addPreference(preferenceGroup);
}
profileData.preferenceGroup = preferenceGroup;
if (userInfo.isEnabled()) {
profileData.authenticatorHelper = new AuthenticatorHelper(context, userInfo.getUserHandle(), this);
profileData.addAccountPreference = newAddAccountPreference();
mHelper.enforceRestrictionOnPreference(profileData.addAccountPreference, DISALLOW_MODIFY_ACCOUNTS, userInfo.id);
}
mProfiles.put(userInfo.id, profileData);
}
use of com.android.settingslib.accounts.AuthenticatorHelper in project android_packages_apps_Settings by omnirom.
the class AccountPreferenceBase method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
final Activity activity = getActivity();
mUserHandle = Utils.getSecureTargetUser(activity.getActivityToken(), mUm, getArguments(), activity.getIntent().getExtras());
mAuthenticatorHelper = new AuthenticatorHelper(activity, mUserHandle, this);
mAccountTypePreferenceLoader = new AccountTypePreferenceLoader(this, mAuthenticatorHelper, mUserHandle);
}
Aggregations