From 354902f725e6946dda0e4539ceb30dd342e01a64 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Mon, 15 Mar 2021 12:03:15 +0000 Subject: [PATCH] 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 --- quickstep/src/com/android/quickstep/views/RecentsView.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 9a903dc124..ad98071346 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1624,12 +1624,12 @@ public abstract class RecentsView 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; }