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

Commit 4c4d48f2 authored by Peter Kalauskas's avatar Peter Kalauskas
Browse files

Fix visibility bugs in QS user detail panel

- Fix bug that prevented user from accessing QS user panel using Switch
  Control

- Fix bug that caused QS user panel to sometimes not show

Bug: 184072778
Bug: 182404283
Test: Build with config_keyguard_user_switch_opens_qs_details=true, turn
      on Switch Control, navigate to QS user panel from the lock screen,
      add guest user
Test: Build with config_keyguard_user_switch_opens_qs_details=true,
      unlock phone, open QS, lock phone, tap QS user panel shortcut on
      lock screen
Change-Id: Idbf04e77a01b741d2ecd8d5db863cdf0bc5cedbc
parent 8316505a
Loading
Loading
Loading
Loading
+3 −23
Original line number Diff line number Diff line
@@ -225,16 +225,7 @@ public class QSDetail extends LinearLayout {
            mQsPanelCallback.onScanStateChanged(false);
        }
        sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);

        if (mShouldAnimate) {
        animateDetailVisibleDiff(x, y, visibleDiff, listener);
        } else {
            if (showingDetail) {
                showImmediately();
            } else {
                hideImmediately();
            }
        }
    }

    protected void animateDetailVisibleDiff(int x, int y, boolean visibleDiff, AnimatorListener listener) {
@@ -242,27 +233,16 @@ public class QSDetail extends LinearLayout {
            mAnimatingOpen = mDetailAdapter != null;
            if (mFullyExpanded || mDetailAdapter != null) {
                setAlpha(1);
                mClipper.animateCircularClip(x, y, mDetailAdapter != null, listener);
                mClipper.updateCircularClip(mShouldAnimate, x, y, mDetailAdapter != null, listener);
            } else {
                animate().alpha(0)
                        .setDuration(FADE_DURATION)
                        .setDuration(mShouldAnimate ? FADE_DURATION : 0)
                        .setListener(listener)
                        .start();
            }
        }
    }

    void showImmediately() {
        setVisibility(VISIBLE);
        mClipper.cancelAnimator();
        mClipper.showBackground();
    }

    public void hideImmediately() {
        mClipper.cancelAnimator();
        setVisibility(View.GONE);
    }

    protected void setupDetailFooter(DetailAdapter adapter) {
        final Intent settingsIntent = adapter.getSettingsIntent();
        mDetailSettingsButton.setVisibility(settingsIntent != null ? VISIBLE : GONE);
+17 −3
Original line number Diff line number Diff line
@@ -37,6 +37,19 @@ public class QSDetailClipper {
    }

    public void animateCircularClip(int x, int y, boolean in, AnimatorListener listener) {
        updateCircularClip(true /* animate */, x, y, in, listener);
    }

    /**
     * @param animate whether or not animation has a duration of 0. Either way, {@code listener}
     *               will be called.
     * @param x x position where animation should originate
     * @param y y position where animation should originate
     * @param in whether animating in or out
     * @param listener Animation listener. Called whether or not {@code animate} is true.
     */
    public void updateCircularClip(boolean animate, int x, int y, boolean in,
            AnimatorListener listener) {
        if (mAnimator != null) {
            mAnimator.cancel();
        }
@@ -58,15 +71,16 @@ public class QSDetailClipper {
        } else {
            mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, r, innerR);
        }
        mAnimator.setDuration((long)(mAnimator.getDuration() * 1.5));
        mAnimator.setDuration(animate ? (long) (mAnimator.getDuration() * 1.5) : 0);
        if (listener != null) {
            mAnimator.addListener(listener);
        }
        if (in) {
            mBackground.startTransition((int)(mAnimator.getDuration() * 0.6));
            mBackground.startTransition(animate ? (int) (mAnimator.getDuration() * 0.6) : 0);
            mAnimator.addListener(mVisibleOnStart);
        } else {
            mDetail.postDelayed(mReverseBackground, (long)(mAnimator.getDuration() * 0.65));
            mDetail.postDelayed(mReverseBackground,
                    animate ? (long) (mAnimator.getDuration() * 0.65) : 0);
            mAnimator.addListener(mGoneOnEnd);
        }
        mAnimator.start();