am a995b6e3: Merge "Getting rid of blue outline in user switcher, instead brighten the user" into jb-mr1-dev
* commit 'a995b6e37f20b3e7eebfb37d8868c1bc14906204': Getting rid of blue outline in user switcher, instead brighten the user
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2012 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/activity_picker_bg_activated" />
|
||||
</selector>
|
||||
@@ -22,9 +22,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="125dp"
|
||||
android:layout_height="125dp"
|
||||
android:background="#550000ff"
|
||||
android:gravity="center_horizontal"
|
||||
android:foreground="@drawable/kg_avatar_overlay">
|
||||
android:gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/keyguard_user_avatar"
|
||||
android:scaleType="centerCrop"
|
||||
|
||||
@@ -45,6 +45,9 @@ class KeyguardMultiUserAvatar extends FrameLayout {
|
||||
private boolean mInit = true;
|
||||
private KeyguardMultiUserSelectorView mUserSelector;
|
||||
|
||||
boolean mPressedStateLocked = false;
|
||||
boolean mTempPressedStateHolder = false;
|
||||
|
||||
public static KeyguardMultiUserAvatar fromXml(int resId, Context context,
|
||||
KeyguardMultiUserSelectorView userSelector, UserInfo info) {
|
||||
KeyguardMultiUserAvatar icon = (KeyguardMultiUserAvatar)
|
||||
@@ -135,25 +138,33 @@ class KeyguardMultiUserAvatar extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
boolean mLockDrawableState = false;
|
||||
|
||||
public void lockDrawableState() {
|
||||
mLockDrawableState = true;
|
||||
public void lockPressedState() {
|
||||
mPressedStateLocked = true;
|
||||
}
|
||||
|
||||
public void resetDrawableState() {
|
||||
mLockDrawableState = false;
|
||||
public void resetPressedState() {
|
||||
mPressedStateLocked = false;
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
refreshDrawableState();
|
||||
KeyguardMultiUserAvatar.this.setPressed(mTempPressedStateHolder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void drawableStateChanged() {
|
||||
if (!mLockDrawableState) {
|
||||
super.drawableStateChanged();
|
||||
@Override
|
||||
public void setPressed(boolean pressed) {
|
||||
if (!mPressedStateLocked) {
|
||||
super.setPressed(pressed);
|
||||
if (pressed) {
|
||||
mUserImage.setColorFilter(Color.argb(0, INACTIVE_COLOR,
|
||||
INACTIVE_COLOR, INACTIVE_COLOR));
|
||||
} else if (!mActive) {
|
||||
mUserImage.setColorFilter(Color.argb(INACTIVE_ALPHA, INACTIVE_COLOR,
|
||||
INACTIVE_COLOR, INACTIVE_COLOR));
|
||||
}
|
||||
} else {
|
||||
mTempPressedStateHolder = pressed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class KeyguardMultiUserSelectorView extends FrameLayout implements View.O
|
||||
return;
|
||||
} else {
|
||||
// Reset the previously active user to appear inactive
|
||||
avatar.lockDrawableState();
|
||||
avatar.lockPressedState();
|
||||
mCallback.hideSecurityView(FADE_OUT_ANIMATION_DURATION);
|
||||
mActiveUserAvatar.setActive(false, true, SWITCH_ANIMATION_DURATION, new Runnable() {
|
||||
@Override
|
||||
@@ -120,7 +120,7 @@ public class KeyguardMultiUserSelectorView extends FrameLayout implements View.O
|
||||
ActivityManagerNative.getDefault().switchUser(avatar.getUserInfo().id);
|
||||
WindowManagerGlobal.getWindowManagerService().lockNow();
|
||||
// Set the new active user, and make it appear active
|
||||
avatar.resetDrawableState();
|
||||
avatar.resetPressedState();
|
||||
mCallback.showSecurityView();
|
||||
mActiveUserAvatar = avatar;
|
||||
mActiveUserAvatar.setActive(true, false, 0, null);
|
||||
|
||||
Reference in New Issue
Block a user