Merge "Calculate ClearAllButton's scroll offset after it's laid out" into sc-dev am: 21784eaf08
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14112622
Change-Id: I2222de7a9d72fe0b276bb374735c1e22bb0180e4
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 66d621e..c39e7df 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1228,11 +1228,6 @@
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 @@
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);