Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66582a88 authored by Peter Kalauskas's avatar Peter Kalauskas Committed by Android (Google) Code Review
Browse files

Merge "Always draw a background for the user avatar" into sc-dev

parents cd2e48c9 a1d1f5a2
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -92,8 +92,6 @@
    <color name="kg_user_switcher_avatar_icon_color">@android:color/background_light</color>
    <!-- Icon color for selected user avatars in keyguard user switcher -->
    <color name="kg_user_switcher_selected_avatar_icon_color">#202124</color>
    <!-- Color of background circle of user avatars in keyguard user switcher -->
    <color name="kg_user_switcher_avatar_background">#3C4043</color>
    <!-- Icon color for user avatars in quick settings user switcher  -->
    <color name="qs_user_switcher_avatar_icon_color">@android:color/background_light</color>
    <!-- Icon color for selected user avatars in quick settings user switcher  -->
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@
         (e.g. cannot be switched to) -->
    <color name="kg_user_switcher_restricted_avatar_icon_color">@color/GM2_grey_600</color>
    <!-- Color of background circle of user avatars in keyguard user switcher -->
    <color name="kg_user_switcher_avatar_background">@color/GM2_grey_300</color>
    <color name="kg_user_switcher_avatar_background">?android:attr/colorBackgroundFloating</color>

    <!-- Icon color for user avatars in user switcher quick settings -->
    <color name="qs_user_switcher_avatar_icon_color">#3C4043</color>
+18 −24
Original line number Diff line number Diff line
@@ -224,35 +224,29 @@ public class KeyguardQsUserSwitchController extends ViewController<UserAvatarVie
            mView.setContentDescription(contentDescription);
        }

        if (mCurrentUser.picture == null) {
            mView.setDrawableWithBadge(getDrawable(mCurrentUser).mutate(),
                    mCurrentUser.resolveId());
        } else {
            int avatarSize =
                    (int) mResources.getDimension(R.dimen.kg_framed_avatar_size);
            Drawable drawable = new CircleFramedDrawable(mCurrentUser.picture, avatarSize);
            drawable.setColorFilter(
                    mCurrentUser.isSwitchToEnabled ? null
                            : mAdapter.getDisabledUserAvatarColorFilter());
            mView.setDrawableWithBadge(drawable, mCurrentUser.info.id);
        }
        mView.setDrawableWithBadge(getCurrentUserIcon().mutate(), mCurrentUser.resolveId());
    }

    Drawable getDrawable(UserSwitcherController.UserRecord item) {
    Drawable getCurrentUserIcon() {
        Drawable drawable;
        if (item.isCurrent && item.isGuest) {
        if (mCurrentUser.picture == null) {
            if (mCurrentUser.isCurrent && mCurrentUser.isGuest) {
                drawable = mContext.getDrawable(R.drawable.ic_avatar_guest_user);
            } else {
            drawable = mAdapter.getIconDrawable(mContext, item);
                drawable = mAdapter.getIconDrawable(mContext, mCurrentUser);
            }

            int iconColorRes;
        if (item.isSwitchToEnabled) {
            if (mCurrentUser.isSwitchToEnabled) {
                iconColorRes = R.color.kg_user_switcher_avatar_icon_color;
            } else {
                iconColorRes = R.color.kg_user_switcher_restricted_avatar_icon_color;
            }
            drawable.setTint(mResources.getColor(iconColorRes, mContext.getTheme()));
        } else {
            int avatarSize =
                    (int) mResources.getDimension(R.dimen.kg_framed_avatar_size);
            drawable = new CircleFramedDrawable(mCurrentUser.picture, avatarSize);
        }

        Drawable bg = mContext.getDrawable(R.drawable.kg_bg_avatar);
        drawable = new LayerDrawable(new Drawable[]{bg, drawable});