Update icon and text for a managed profile

Bug: 16369104
Change-Id: I15d25910332d92e1638cdc63422e7e28c2f07d85
This commit is contained in:
Alexandra Gherghina
2014-07-25 21:34:04 +01:00
parent 86bf735aae
commit 6b3b751492
3 changed files with 12 additions and 8 deletions

View File

@@ -4816,8 +4816,6 @@
<string name="data_usage_cycle">Data usage cycle</string>
<!-- Title for application data usage separator in data usage list. [CHAR LIMIT=25] -->
<string name="data_usage_app_items_header_text">App usage</string>
<!-- Title for managed user in data usage list. [CHAR LIMIT=25] -->
<string name="data_usage_managed_user_text">Work profile</string>
<!-- Title for menu option to enable mobile data when roaming. [CHAR LIMIT=26] -->
<string name="data_usage_menu_roaming">Data roaming</string>
<!-- Title for menu option to restrict background data usage. [CHAR LIMIT=26] -->
@@ -5846,4 +5844,6 @@
<!-- [CHAR LIMIT=300] Screen pinning description -->
<string name="screen_pinning_description">When this setting is turned on, you can put the device in a state that keeps the current screen in view.\n\nTo pin a screen:\n\n1. Turn this setting on.\n\n2. Open an app.\n\n3. Touch the Recents button.\n\n4. Touch the pin icon.</string>
<!-- Title for a managed (work) profile. [CHAR LIMIT=25] -->
<string name="managed_user_title">Work profile</string>
</resources>

View File

@@ -18,6 +18,7 @@ package com.android.settings;
import android.content.Context;
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
@@ -31,6 +32,7 @@ import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.android.settings.drawable.CircleFramedDrawable;
import com.android.settings.R;
import java.util.ArrayList;
@@ -48,12 +50,14 @@ public class UserSpinnerAdapter implements SpinnerAdapter {
public UserDetails(UserHandle userHandle, UserManager um, Context context) {
mUserHandle = userHandle;
UserInfo userInfo = um.getUserInfo(mUserHandle.getIdentifier());
name = userInfo.name;
Bitmap bitmap = um.getUserIcon(userHandle.getIdentifier());
if (bitmap != null) {
icon = CircleFramedDrawable.getInstance(context, bitmap);
if (userInfo.isManagedProfile()) {
name = context.getString(R.string.managed_user_title);
icon = Resources.getSystem().getDrawable(
com.android.internal.R.drawable.ic_corp_icon);
} else {
icon = null;
name = userInfo.name;
Bitmap bitmap = um.getUserIcon(userHandle.getIdentifier());
icon = (bitmap == null) ? null : CircleFramedDrawable.getInstance(context, bitmap);
}
}
}

View File

@@ -132,7 +132,7 @@ public class UidDetailProvider {
final UserInfo info = um.getUserInfo(userHandle);
if (info != null) {
if (info.isManagedProfile()) {
detail.label = res.getString(R.string.data_usage_managed_user_text);
detail.label = res.getString(R.string.managed_user_title);
detail.icon = Resources.getSystem().getDrawable(
com.android.internal.R.drawable.ic_corp_icon);
} else {