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
This commit is contained in:
Alex Chau
2021-03-15 12:03:15 +00:00
parent 8ecb59189f
commit 354902f725

View File

@@ -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;
}