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

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

Making sure CustomContent is never visible during overview / springloaded

Change-Id: I187f7fcfbd4e24e20959c9e0cf5fd5400d006f45
parent d3ecce91
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -1079,7 +1079,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
    }

    protected boolean shouldDrawChild(View child) {
        return child.getAlpha() > 0;
        return child.getAlpha() > 0 && child.getVisibility() == VISIBLE;
    }

    @Override
@@ -1546,22 +1546,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
        getOverviewModePages(mTempVisiblePagesRange);
        if (!mFreeScroll) {
            snapToPage(snapPage);

            for (int i = 0; i < getPageCount(); ++i) {
                if (i < mTempVisiblePagesRange[0] || i > mTempVisiblePagesRange[1]) {
                    getPageAt(i).setAlpha(1f);
                }
            }
        } else {
            mFreeScrollMinScrollX = getScrollForPage(mTempVisiblePagesRange[0]);
            mFreeScrollMaxScrollX = getScrollForPage(mTempVisiblePagesRange[1]);

            for (int i = 0; i < getPageCount(); ++i) {
                if (i < mTempVisiblePagesRange[0] || i > mTempVisiblePagesRange[1]) {
                    getPageAt(i).setAlpha(0f);
                }
            }

            if (getCurrentPage() < mTempVisiblePagesRange[0]) {
                setCurrentPage(mTempVisiblePagesRange[0]);
            } else if (getCurrentPage() > mTempVisiblePagesRange[1]) {
+22 −8
Original line number Diff line number Diff line
@@ -1756,14 +1756,11 @@ public class Workspace extends SmoothPagedView

        Animator workspaceAnim = getChangeStateAnimation(finalState, animated, 0, snapPage);
        if (workspaceAnim != null) {
            onTransitionPrepare();
            workspaceAnim.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator arg0) {
                    mIsSwitchingState = false;
                }
                @Override
                public void onAnimationStart(Animator arg0) {
                    mIsSwitchingState = true;
                    onTransitionEnd();
                }
            });
            workspaceAnim.start();
@@ -1956,13 +1953,11 @@ public class Workspace extends SmoothPagedView
                view.setVisibility(VISIBLE);
            }
        }

    }

    @Override
    public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) {
        mIsSwitchingState = true;
        updateChildrenLayersEnabled(false);
        onTransitionPrepare();
    }

    @Override
@@ -1976,6 +1971,20 @@ public class Workspace extends SmoothPagedView

    @Override
    public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) {
        onTransitionEnd();
    }

    private void onTransitionPrepare() {
        mIsSwitchingState = true;
        updateChildrenLayersEnabled(false);
        if (mState != Workspace.State.NORMAL) {
            if (hasCustomContent()) {
                mWorkspaceScreens.get(CUSTOM_CONTENT_SCREEN_ID).setVisibility(INVISIBLE);
            }
        }
    }

    private void onTransitionEnd() {
        mIsSwitchingState = false;
        updateChildrenLayersEnabled(false);
        // The code in getChangeStateAnimation to determine initialAlpha and finalAlpha will ensure
@@ -1988,6 +1997,11 @@ public class Workspace extends SmoothPagedView
                cl.setShortcutAndWidgetAlpha(1f);
            }
        }
        if (mState == Workspace.State.NORMAL) {
            if (hasCustomContent()) {
                mWorkspaceScreens.get(CUSTOM_CONTENT_SCREEN_ID).setVisibility(VISIBLE);
            }
        }
    }

    @Override