Merge "UX polishing for profile switcher. - Adjust the badge size. - Add badge to 'Add profile' button." into sc-v2-dev

This commit is contained in:
BK Choi
2021-10-27 16:07:14 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 1 deletions

View File

@@ -17,7 +17,7 @@
-->
<resources>
<dimen name="car_large_avatar_size">96dp</dimen>
<dimen name="car_large_avatar_badge_size">32dp</dimen>
<dimen name="car_large_avatar_badge_size">24dp</dimen>
<!-- Application Bar -->
<dimen name="car_app_bar_height">80dp</dimen>
<!-- Margin -->

View File

@@ -183,6 +183,20 @@ public class UserIconDrawable extends Drawable implements Drawable.Callback {
return setBadge(badge);
}
/**
* Sets the managed badge to this user icon if the device has a device owner.
*/
public UserIconDrawable setBadgeIfManagedDevice(Context context) {
Drawable badge = null;
boolean deviceOwnerExists = context.getSystemService(DevicePolicyManager.class)
.getDeviceOwnerComponentOnAnyUser() != null;
if (deviceOwnerExists) {
badge = getDrawableForDisplayDensity(
context, com.android.internal.R.drawable.ic_corp_badge_case);
}
return setBadge(badge);
}
public void setBadgeRadius(float radius) {
mBadgeRadius = radius;
onBoundsChange(getBounds());