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

Commit 5fee8123 authored by Alex Chau's avatar Alex Chau
Browse files

Calculate ClearAllButton's scroll offset after it's laid out

- ClearAllButton's width is 0 before it's laid out, making the calcualtion incorrect

Bug: 184570027
Test: Restart device or change screen size, ClearAllButton is in correct position
Change-Id: I2cefccbe18925cb3d9dac705b333400639b7049e
parent 01b5d5e3
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1228,11 +1228,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        mClearAllButton.setFullscreenTranslationPrimary(
                accumulatedTranslationX - fullscreenTranslations[firstNonHomeTaskIndex]);

        // Align ClearAllButton to the left (RTL) or right (non-RTL), which is different from other
        // TaskViews.
        int clearAllWidthDiff = mTaskWidth - mClearAllButton.getWidth();
        mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff);

        updateGridProperties(false);
    }

@@ -3020,6 +3015,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        boolean pageScrollChanged = super.getPageScrolls(outPageScrolls, layoutChildren,
                scrollLogic);

        // Align ClearAllButton to the left (RTL) or right (non-RTL), which is different from other
        // TaskViews. This must be called after laying out ClearAllButton.
        if (layoutChildren) {
            int clearAllWidthDiff = mTaskWidth - mClearAllButton.getWidth();
            mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff);
        }

        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);