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

Commit 96543290 authored by Adam Cohen's avatar Adam Cohen
Browse files

Getting rid of blue outline in user switcher, instead brighten the user

Change-Id: I4817615cc28eb1fea35ecb5c3d69c4298c9cf2cf
parent 42517367
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+1 −3
Original line number Diff line number Diff line
@@ -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"
+21 −10
Original line number Diff line number Diff line
@@ -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;
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -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);