Misc fixes for account/users fragments
- Hide add user button when it's not functional - Display "No accounts added" under accounts setting when there is no account. Change-Id: Iefede9939d206eb3064fa22bdcfbcb1e826f29ab Fixes: 72643060 Test: robotest Test: 72713118
This commit is contained in:
@@ -91,17 +91,20 @@ public class AccountDashboardFragment extends DashboardFragment {
|
||||
final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
|
||||
|
||||
CharSequence summary = null;
|
||||
if (types == null || types.length == 0) {
|
||||
summary = mContext.getString(R.string.account_dashboard_default_summary);
|
||||
} else {
|
||||
// Show up to 3 account types
|
||||
final int size = Math.min(3, types.length);
|
||||
|
||||
// Show up to 3 account types
|
||||
final int size = Math.min(3, types.length);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
final CharSequence label = authHelper.getLabelForType(mContext, types[i]);
|
||||
if (summary == null) {
|
||||
summary = bidiFormatter.unicodeWrap(label);
|
||||
} else {
|
||||
summary = mContext.getString(R.string.join_many_items_middle, summary,
|
||||
bidiFormatter.unicodeWrap(label));
|
||||
for (int i = 0; i < size; i++) {
|
||||
final CharSequence label = authHelper.getLabelForType(mContext, types[i]);
|
||||
if (summary == null) {
|
||||
summary = bidiFormatter.unicodeWrap(label);
|
||||
} else {
|
||||
summary = mContext.getString(R.string.join_many_items_middle, summary,
|
||||
bidiFormatter.unicodeWrap(label));
|
||||
}
|
||||
}
|
||||
}
|
||||
mSummaryLoader.setSummary(this, summary);
|
||||
|
@@ -249,11 +249,14 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
mAddUser.useAdminDisabledSummary(false);
|
||||
// Determine if add user/profile button should be visible
|
||||
if (mUserCaps.mCanAddUser && Utils.isDeviceProvisioned(getActivity())) {
|
||||
mAddUser.setVisible(true);
|
||||
mAddUser.setOnPreferenceClickListener(this);
|
||||
// change label to only mention user, if restricted profiles are not supported
|
||||
if (!mUserCaps.mCanAddRestrictedProfile) {
|
||||
mAddUser.setTitle(R.string.user_add_user_menu);
|
||||
}
|
||||
} else {
|
||||
mAddUser.setVisible(false);
|
||||
}
|
||||
final IntentFilter filter = new IntentFilter(Intent.ACTION_USER_REMOVED);
|
||||
filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
|
||||
|
Reference in New Issue
Block a user