Merge changes from topics "presubmit-am-c4b3e098a67f4aae8d09beafad040d77", "presubmit-am-c919318fbc2d413296f77381098694db" into tm-dev
* changes: Guest icon color Fix logcat view layout warnings
This commit is contained in:
committed by
Android (Google) Code Review
commit
5462556c37
@@ -27,7 +27,7 @@
|
||||
</shape>
|
||||
</item>
|
||||
<!-- When an item is selected, this layer will show a ring around the icon -->
|
||||
<item>
|
||||
<item android:id="@+id/ring">
|
||||
<shape android:shape="oval">
|
||||
<stroke
|
||||
android:width="@dimen/user_switcher_icon_selected_width"
|
||||
@@ -35,7 +35,7 @@
|
||||
</shape>
|
||||
</item>
|
||||
<!-- Where the user drawable/bitmap will be placed -->
|
||||
<item
|
||||
<item android:id="@+id/user_avatar"
|
||||
android:drawable="@drawable/user_avatar_bg"
|
||||
android:width="@dimen/bouncer_user_switcher_icon_size"
|
||||
android:height="@dimen/bouncer_user_switcher_icon_size"
|
||||
|
||||
@@ -152,6 +152,7 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
private SwipeListener mSwipeListener;
|
||||
private ViewMode mViewMode = new DefaultViewMode();
|
||||
private @Mode int mCurrentMode = MODE_DEFAULT;
|
||||
private int mWidth = -1;
|
||||
|
||||
private final WindowInsetsAnimation.Callback mWindowInsetsAnimationCallback =
|
||||
new WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) {
|
||||
@@ -649,9 +650,11 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
|
||||
// After a layout pass, we need to re-place the inner bouncer, as our bounds may have
|
||||
// changed.
|
||||
mViewMode.updateSecurityViewLocation();
|
||||
int width = right - left;
|
||||
if (changed && mWidth != width) {
|
||||
mWidth = width;
|
||||
mViewMode.updateSecurityViewLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.content.IntentFilter
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.InsetDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Bundle
|
||||
import android.os.UserManager
|
||||
@@ -149,8 +148,8 @@ class UserSwitcherActivity @Inject constructor(
|
||||
}
|
||||
|
||||
private fun getDrawable(item: UserRecord): Drawable {
|
||||
var drawable = if (item.isCurrent && item.isGuest) {
|
||||
getDrawable(R.drawable.ic_avatar_guest_user)
|
||||
var drawable = if (item.isGuest) {
|
||||
getDrawable(R.drawable.ic_account_circle)
|
||||
} else {
|
||||
findUserIcon(item)
|
||||
}
|
||||
@@ -168,7 +167,7 @@ class UserSwitcherActivity @Inject constructor(
|
||||
val ld = getDrawable(R.drawable.user_switcher_icon_large).mutate()
|
||||
as LayerDrawable
|
||||
if (item == userSwitcherController.getCurrentUserRecord()) {
|
||||
(ld.getDrawable(1) as GradientDrawable).apply {
|
||||
(ld.findDrawableByLayerId(R.id.ring) as GradientDrawable).apply {
|
||||
val stroke = resources
|
||||
.getDimensionPixelSize(R.dimen.user_switcher_icon_selected_width)
|
||||
val color = Utils.getColorAttrDefaultColor(
|
||||
@@ -180,15 +179,7 @@ class UserSwitcherActivity @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
ld.addLayer(
|
||||
InsetDrawable(
|
||||
drawable,
|
||||
resources.getDimensionPixelSize(
|
||||
R.dimen.user_switcher_icon_large_margin
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
ld.setDrawableByLayerId(R.id.user_avatar, drawable)
|
||||
return ld
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user