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

Commit 354902f7 authored by Alex Chau's avatar Alex Chau
Browse files

Use grid Rect when calculating clear all position

- This is a follow-up of http://ag/13827968 that uses separate grid Rect to calculate grid layout position
- This fixes the case when there are not enough tasks to fill the screen

Bug: 174464863
Test: Launch overview grid with only one task, clear all should not be shown until scrolled
Change-Id: I4c4f720bc83e6f1feca83285adbe567deea2d063
parent 8ecb5918
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1624,12 +1624,12 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        float clearAllShorterRowCompensation =
                mIsRtl ? -shorterRowCompensation : shorterRowCompensation;

        // If the total width is shorter than one task's width, move ClearAllButton further away
        // If the total width is shorter than one grid's width, move ClearAllButton further away
        // accordingly.
        float clearAllShortTotalCompensation = 0;
        float longRowWidth = Math.max(topRowWidth, bottomRowWidth);
        if (longRowWidth < mTaskWidth) {
            float shortTotalCompensation = mTaskWidth - longRowWidth;
        if (longRowWidth < mLastComputedGridSize.width()) {
            float shortTotalCompensation = mLastComputedGridSize.width() - longRowWidth;
            clearAllShortTotalCompensation =
                    mIsRtl ? -shortTotalCompensation : shortTotalCompensation;
        }