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

Commit e628c474 authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Fixing Recents sometimes restoring in Clear-all-reveal position.

This happened if a task was added between openings of Recents.

Bug: 72222505
Test: Manual
Change-Id: Id4cc8e7cbdb493973d329466369b62e4ac8ee0b3
parent 77bf622c
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -345,14 +345,22 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl

    private float calculateClearAllButtonAlpha() {
        final int childCount = getChildCount();
        if (mShowEmptyMessage || childCount == 0) return 0;
        if (mShowEmptyMessage || childCount == 0 || mPageScrolls == null
                || childCount != mPageScrolls.length) {
            return 0;
        }

        final int scrollEnd = getScrollEnd();
        final int oldestChildScroll = getScrollForPage(childCount - 1);

        return Utilities.boundToRange(
                ((float) (getScrollX() - oldestChildScroll)) /
                        (scrollEnd - oldestChildScroll), 0, 1);
        final int clearAllButtonMotionRange = scrollEnd - oldestChildScroll;
        if (clearAllButtonMotionRange == 0) return 0;

        final float alphaUnbound = ((float) (getScrollX() - oldestChildScroll)) /
                clearAllButtonMotionRange;
        if (alphaUnbound > 1) return 0;

        return Math.max(alphaUnbound, 0);
    }

    private void updateClearAllButtonAlpha() {
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
    private float mLastMotionXRemainder;
    private float mTotalMotionX;

    private int[] mPageScrolls;
    protected int[] mPageScrolls;

    protected final static int TOUCH_STATE_REST = 0;
    protected final static int TOUCH_STATE_SCROLLING = 1;