KeyguardMultiUserSelectorViewpublic class KeyguardMultiUserSelectorView extends android.widget.FrameLayout implements View.OnClickListener
Fields Summary |
---|
private static final String | TAG | private android.view.ViewGroup | mUsersGrid | private KeyguardMultiUserAvatar | mActiveUserAvatar | private KeyguardHostView.UserSwitcherCallback | mCallback | private static final int | FADE_OUT_ANIMATION_DURATION | Comparator | mOrderAddedComparator |
Methods Summary |
---|
public void | addUsers(java.util.Collection userList)
UserInfo activeUser;
try {
activeUser = ActivityManagerNative.getDefault().getCurrentUser();
} catch (RemoteException re) {
activeUser = null;
}
ArrayList<UserInfo> users = new ArrayList<UserInfo>(userList);
Collections.sort(users, mOrderAddedComparator);
for (UserInfo user: users) {
if (user.supportsSwitchTo()) {
KeyguardMultiUserAvatar uv = createAndAddUser(user);
if (user.id == activeUser.id) {
mActiveUserAvatar = uv;
}
uv.setActive(false, false, null);
}
}
mActiveUserAvatar.lockPressed(true);
| private KeyguardMultiUserAvatar | createAndAddUser(android.content.pm.UserInfo user)
KeyguardMultiUserAvatar uv = KeyguardMultiUserAvatar.fromXml(
R.layout.keyguard_multi_user_avatar, mContext, this, user);
mUsersGrid.addView(uv);
return uv;
| void | finalizeActiveUserNow(boolean animate)
mActiveUserAvatar.lockPressed(false);
mActiveUserAvatar.setActive(true, animate, null);
| public void | finalizeActiveUserView(boolean animate)
if (animate) {
getHandler().postDelayed(new Runnable() {
@Override
public void run() {
finalizeActiveUserNow(true);
}
}, 500);
} else {
finalizeActiveUserNow(animate);
}
| public void | onClick(android.view.View v)
if (!(v instanceof KeyguardMultiUserAvatar)) return;
final KeyguardMultiUserAvatar avatar = (KeyguardMultiUserAvatar) v;
if (avatar.isClickable()) { // catch race conditions
if (mActiveUserAvatar == avatar) {
// If they click the currently active user, show the unlock hint
mCallback.showUnlockHint();
return;
} else {
// Reset the previously active user to appear inactive
mCallback.hideSecurityView(FADE_OUT_ANIMATION_DURATION);
setAllClickable(false);
avatar.lockPressed(true);
mActiveUserAvatar.setActive(false, true, new Runnable() {
@Override
public void run() {
mActiveUserAvatar = avatar;
try {
ActivityManagerNative.getDefault()
.switchUser(avatar.getUserInfo().id);
} catch (RemoteException re) {
Log.e(TAG, "Couldn't switch user " + re);
}
}
});
}
}
| protected void | onFinishInflate()
mUsersGrid = (ViewGroup) findViewById(R.id.keyguard_users_grid);
mUsersGrid.removeAllViews();
setClipChildren(false);
setClipToPadding(false);
| public boolean | onInterceptTouchEvent(android.view.MotionEvent event)
if(event.getActionMasked() != MotionEvent.ACTION_CANCEL && mCallback != null) {
mCallback.userActivity();
}
return false;
| private void | setAllClickable(boolean clickable)
for(int i = 0; i < mUsersGrid.getChildCount(); i++) {
View v = mUsersGrid.getChildAt(i);
v.setClickable(clickable);
v.setPressed(false);
}
| public void | setCallback(KeyguardHostView.UserSwitcherCallback callback)
mCallback = callback;
|
|