Mark/unmark activated state before the user switch begins.
This makes the screen freeze appear more fluid while switching users. Bug: 146426568 Test: Manual Change-Id: I7f18a560ce00c9037b182db1a5fc546480c43d91
This commit is contained in:
@@ -59,6 +59,7 @@ public class UserDetailView extends PseudoGridView {
|
||||
|
||||
private final Context mContext;
|
||||
protected UserSwitcherController mController;
|
||||
private View mCurrentUserView;
|
||||
|
||||
public Adapter(Context context, UserSwitcherController controller) {
|
||||
super(controller);
|
||||
@@ -89,6 +90,9 @@ public class UserDetailView extends PseudoGridView {
|
||||
v.bind(name, item.picture, item.info.id);
|
||||
}
|
||||
v.setActivated(item.isCurrent);
|
||||
if (item.isCurrent) {
|
||||
mCurrentUserView = v;
|
||||
}
|
||||
v.setDisabledByAdmin(item.isDisabledByAdmin);
|
||||
if (!item.isSwitchToEnabled) {
|
||||
v.setEnabled(false);
|
||||
@@ -107,6 +111,12 @@ public class UserDetailView extends PseudoGridView {
|
||||
mController.startActivity(intent);
|
||||
} else if (tag.isSwitchToEnabled) {
|
||||
MetricsLogger.action(mContext, MetricsEvent.QS_SWITCH_USER);
|
||||
if (!tag.isAddUser && !tag.isRestricted && !tag.isDisabledByAdmin) {
|
||||
if (mCurrentUserView != null) {
|
||||
mCurrentUserView.setActivated(false);
|
||||
}
|
||||
view.setActivated(true);
|
||||
}
|
||||
switchTo(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,12 @@ public class UserAvatarView extends View {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActivated(boolean activated) {
|
||||
super.setActivated(activated);
|
||||
mDrawable.invalidateSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setAvatar(Bitmap)} instead.
|
||||
*/
|
||||
|
||||
@@ -257,6 +257,7 @@ public class KeyguardUserSwitcher {
|
||||
|
||||
private Context mContext;
|
||||
private KeyguardUserSwitcher mKeyguardUserSwitcher;
|
||||
private View mCurrentUserView;
|
||||
|
||||
public Adapter(Context context, UserSwitcherController controller,
|
||||
KeyguardUserSwitcher kgu) {
|
||||
@@ -285,6 +286,9 @@ public class KeyguardUserSwitcher {
|
||||
// Disable the icon if switching is disabled
|
||||
v.setAvatarEnabled(item.isSwitchToEnabled);
|
||||
convertView.setActivated(item.isCurrent);
|
||||
if (item.isCurrent) {
|
||||
mCurrentUserView = convertView;
|
||||
}
|
||||
convertView.setTag(item);
|
||||
return convertView;
|
||||
}
|
||||
@@ -297,6 +301,12 @@ public class KeyguardUserSwitcher {
|
||||
// tapping the guest user while it's current clears the session.
|
||||
mKeyguardUserSwitcher.hideIfNotSimple(true /* animate */);
|
||||
} else if (user.isSwitchToEnabled) {
|
||||
if (!user.isAddUser && !user.isRestricted && !user.isDisabledByAdmin) {
|
||||
if (mCurrentUserView != null) {
|
||||
mCurrentUserView.setActivated(false);
|
||||
}
|
||||
v.setActivated(true);
|
||||
}
|
||||
switchTo(user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user