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

Commit 45adaa70 authored by Adam Cohen's avatar Adam Cohen
Browse files

Making screen hints just side page outlines, as per new design (issue 7467968)

Change-Id: Iff66e0b01cca89337227e54033f6245d6833a5ff
parent 196cde97
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -172,8 +172,6 @@ public class KeyguardHostView extends KeyguardViewBase {
        mKeyguardSelectorView = (KeyguardSelectorView) findViewById(R.id.keyguard_selector_view);
        mViewStateManager.setSecurityViewContainer(mSecurityViewContainer);

        mViewStateManager.showUsabilityHints();

        if (!(mContext instanceof Activity)) {
            setSystemUiVisibility(getSystemUiVisibility() | View.STATUS_BAR_DISABLE_BACK);
        }
@@ -182,6 +180,9 @@ public class KeyguardHostView extends KeyguardViewBase {
        addWidgetsFromSettings();
        mSwitchPageRunnable.run();

        // This needs to be called after the pages are all added.
        mViewStateManager.showUsabilityHints();

        showPrimarySecurityScreen(false);
        updateSecurityViews();
    }
+16 −55
Original line number Diff line number Diff line
@@ -58,10 +58,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
    private static final int CHILDREN_OUTLINE_FADE_OUT_DURATION = 375;
    private static final int CHILDREN_OUTLINE_FADE_IN_DURATION = 75;
    protected AnimatorSet mChildrenOutlineFadeAnimation;
    private float mChildrenOutlineAlpha = 0;
    private float mSidePagesAlpha = 1f;
    protected int mScreenCenter;
    private boolean mHasLayout = false;
    private boolean mHasMeasure = false;
    boolean showHintsAfterLayout = false;

@@ -526,34 +523,33 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
    }

    public void showInitialPageHints() {
        if (mHasLayout) {
            showOutlinesAndSidePages();
        int count = getChildCount();
        for (int i = 0; i < count; i++) {
            KeyguardWidgetFrame child = getWidgetPageAt(i);
            if (i != mCurrentPage) {
                child.fadeFrame(this, true, KeyguardWidgetFrame.OUTLINE_ALPHA_MULTIPLIER,
                        CHILDREN_OUTLINE_FADE_IN_DURATION);
                child.setContentAlpha(0f);
            } else {
            // The layout hints depend on layout being run once
            showHintsAfterLayout = true;
                child.setBackgroundAlpha(0f);
                child.setContentAlpha(1f);
            }
        }
    }

    public void showSidePageHints() {
        animateOutlinesAndSidePages(true, -1);
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        mHasMeasure = false;
        mHasLayout = false;
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        if (showHintsAfterLayout) {
            post(new Runnable() {
                @Override
                public void run() {
                    showOutlinesAndSidePages();
                }
            });
            showHintsAfterLayout = false;
        }
        mHasLayout = true;
    }

    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
@@ -616,6 +612,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
                finalContentAlpha = 0f;
            }
            KeyguardWidgetFrame child = getWidgetPageAt(i);

            alpha = PropertyValuesHolder.ofFloat("contentAlpha", finalContentAlpha);
            ObjectAnimator a = ObjectAnimator.ofPropertyValuesHolder(child, alpha);
            anims.add(a);
@@ -645,42 +642,6 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
        mChildrenOutlineFadeAnimation.start();
    }

    public void setChildrenOutlineAlpha(float alpha) {
        mChildrenOutlineAlpha = alpha;
        for (int i = 0; i < getChildCount(); i++) {
            getWidgetPageAt(i).setBackgroundAlpha(alpha);
        }
    }

    public void setSidePagesAlpha(float alpha) {
        // This gives the current page, or the destination page if in transit.
        int curPage = getNextPage();
        mSidePagesAlpha = alpha;
        for (int i = 0; i < getChildCount(); i++) {
            if (curPage != i) {
                getWidgetPageAt(i).setContentAlpha(alpha);
            } else {
                // We lock the current page alpha to 1.
                getWidgetPageAt(i).setContentAlpha(1.0f);
            }
        }
    }

    public void setChildrenOutlineMultiplier(float alpha) {
        mChildrenOutlineAlpha = alpha;
        for (int i = 0; i < getChildCount(); i++) {
            getWidgetPageAt(i).setBackgroundAlphaMultiplier(alpha);
        }
    }

    public float getSidePagesAlpha() {
        return mSidePagesAlpha;
    }

    public float getChildrenOutlineAlpha() {
        return mChildrenOutlineAlpha;
    }

    @Override
    public boolean onLongClick(View v) {
        // Disallow long pressing to reorder if the challenge is showing