Eliminate duplicated code for creating circled user icons in Settings.
Use Utils.getUserIcon instead. Change-Id: Id653f8c89ac041e925464c88bbc0c7c43d3ce632
This commit is contained in:
@@ -327,16 +327,6 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
|
||||
return getPreferenceScreen();
|
||||
}
|
||||
|
||||
Drawable getCircularUserIcon() {
|
||||
Bitmap userIcon = mUserManager.getUserIcon(mUser.getIdentifier());
|
||||
if (userIcon == null) {
|
||||
return null;
|
||||
}
|
||||
CircleFramedDrawable circularIcon =
|
||||
CircleFramedDrawable.getInstance(this.getActivity(), userIcon);
|
||||
return circularIcon;
|
||||
}
|
||||
|
||||
protected void clearSelectedApps() {
|
||||
mSelectedPackages.clear();
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.drawable.CircleFramedDrawable;
|
||||
|
||||
/**
|
||||
@@ -98,16 +99,6 @@ public class EditUserInfoController {
|
||||
}
|
||||
}
|
||||
|
||||
Drawable getCircularUserIcon(Activity activity) {
|
||||
Bitmap userIcon = mUserManager.getUserIcon(mUser.getIdentifier());
|
||||
if (userIcon == null) {
|
||||
return null;
|
||||
}
|
||||
CircleFramedDrawable circularIcon =
|
||||
CircleFramedDrawable.getInstance(activity, userIcon);
|
||||
return circularIcon;
|
||||
}
|
||||
|
||||
public Dialog createDialog(final Fragment fragment, final Drawable currentUserIcon,
|
||||
final CharSequence currentUserName,
|
||||
int titleResId, final OnContentChangedCallback callback, UserHandle user) {
|
||||
@@ -131,7 +122,7 @@ public class EditUserInfoController {
|
||||
} else {
|
||||
drawable = currentUserIcon;
|
||||
if (drawable == null) {
|
||||
drawable = getCircularUserIcon(activity);
|
||||
drawable = Utils.getUserIcon(activity, mUserManager, info);
|
||||
}
|
||||
}
|
||||
userPhotoView.setImageDrawable(drawable);
|
||||
|
@@ -93,7 +93,7 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
} else {
|
||||
((TextView) mHeaderView.findViewById(android.R.id.title)).setText(info.name);
|
||||
((ImageView) mHeaderView.findViewById(android.R.id.icon)).setImageDrawable(
|
||||
getCircularUserIcon());
|
||||
Utils.getUserIcon(getActivity(), mUserManager, info));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user