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

Commit efde04ce authored by Alex Cruz's avatar Alex Cruz Committed by Gerrit Code Review
Browse files

Fix leftAffordanceView visibility bug

When you disable the left bottom lockscreen target, is suppose to be completely disabled like the right target.
While the icon itself disappears, the preview and hint are still present. This fixes that :-)

See images to see bug:
http://i.imgur.com/WhBvZkc.jpg & http://i.imgur.com/otyOn6m.png

Change-Id: If5b30f03649d5081409a98dbd36c49b99a5095d7
parent db1b4e6e
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mShortcutHelper = new LockscreenShortcutsHelper(mContext, this);
        watchForCameraPolicyChanges();
        updateCameraVisibility();
        updateLeftButtonVisibility();
        mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
        mUnlockMethodCache.addListener(this);
        mLockIcon.update();
@@ -257,6 +258,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mCameraImageView.setContentDescription(contentDescription);
        mCameraImageView.setDefaultFilter(shouldGrayScale ? mGrayScaleFilter : null);
        updateCameraVisibility();
        updateLeftButtonVisibility();
    }

    private void initAccessibility() {
@@ -299,11 +301,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
    public void setPhoneStatusBar(PhoneStatusBar phoneStatusBar) {
        mPhoneStatusBar = phoneStatusBar;
        updateCameraVisibility(); // in case onFinishInflate() was called too early
        updateLeftButtonVisibility();
    }

    public void setUserSetupComplete(boolean userSetupComplete) {
        mUserSetupComplete = userSetupComplete;
        updateCameraVisibility();
        updateLeftButtonVisibility();
        updateLeftAffordanceIcon();
    }

@@ -324,6 +328,21 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
                KeyguardUpdateMonitor.getCurrentUser());
    }

    private void updateLeftButtonVisibility() {
        if (mLeftAffordanceView == null) {
            return;
        }
        boolean visible = mUserSetupComplete;
        if (visible) {
            if (isTargetCustom(Shortcuts.LEFT_SHORTCUT)) {
                visible = !mShortcutHelper.isTargetEmpty(Shortcuts.LEFT_SHORTCUT);
            } else {
                // Display left shortcut
            }
        }
        mLeftAffordanceView.setVisibility(visible ? View.VISIBLE : View.GONE);
    }

    private void updateCameraVisibility() {
        if (mCameraImageView == null) {
            // Things are not set up yet; reply hazy, ask again later
@@ -364,6 +383,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mLeftAffordanceView.setImageDrawable(drawable);
        mLeftAffordanceView.setContentDescription(contentDescription);
        mLeftAffordanceView.setDefaultFilter(shouldGrayScale ? mGrayScaleFilter : null);
        updateLeftButtonVisibility();
    }

    public boolean isLeftVoiceAssist() {
@@ -592,6 +612,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        if (changedView == this && visibility == VISIBLE) {
            mLockIcon.update();
            updateCameraVisibility();
            updateLeftButtonVisibility();
        }
    }

@@ -628,6 +649,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
    public void onUnlockMethodStateChanged() {
        mLockIcon.update();
        updateCameraVisibility();
        updateLeftButtonVisibility();
    }

    private void inflateCameraPreview() {
@@ -699,6 +721,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
                @Override
                public void run() {
                    updateCameraVisibility();
                    updateLeftButtonVisibility();
                }
            });
        }
@@ -709,6 +732,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        @Override
        public void onUserSwitchComplete(int userId) {
            updateCameraVisibility();
            updateLeftButtonVisibility();
        }

        @Override