From e0ccb4e61858a8e5d9e7e5f0e3a2f125f0765481 Mon Sep 17 00:00:00 2001 From: Sergey Pinkevich Date: Mon, 11 Dec 2023 14:44:08 +0000 Subject: [PATCH] Split tasks in RTL mode For `translationX` in RTL (right to left layout) mode we should take into account `secondarySnapshotWidth`, not the primary one. The same for `translationY` for foldable phone in folded mode Known issue: there is still a wrong position for overview app icon, but it is not related to the task thumbnail, and will be fixed in a dedicated task (Screenshot of the issue: https://screenshot.googleplex.com/9GHNWxQ5H6vJPn5) Known issue task: b/315787393 Bug: 309452423 Flag: NONE Test: manual Tablet: https://drive.google.com/file/d/1WGUVcFq0sFTJYsAwcjE6E1SHMRe7_TaV/view?usp=sharing Foldable phone: https://drive.google.com/file/d/1GvDgYg8R9OEoMSDKZaZVXSlsxh_qS-wW/view?usp=sharing Change-Id: Iefe7fec586592e6a72c0f3be5933307213d92c7f --- .../launcher3/touch/LandscapePagedViewHandler.java | 14 +++++++++----- .../launcher3/touch/PortraitPagedViewHandler.java | 3 ++- .../launcher3/touch/SeascapePagedViewHandler.java | 8 +++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 51c047c67c..f7afcb9df3 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -543,15 +543,19 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { secondarySnapshotWidth = parentWidth; secondarySnapshotHeight = totalThumbnailHeight - primarySnapshotHeight - dividerBar; - secondarySnapshot.setTranslationY(0); - primarySnapshot.setTranslationY(secondarySnapshotHeight + spaceAboveSnapshot + dividerBar); + + int translationY = primarySnapshotHeight + spaceAboveSnapshot + dividerBar; + primarySnapshot.setTranslationY(spaceAboveSnapshot); + secondarySnapshot.setTranslationY(translationY - spaceAboveSnapshot); + primarySnapshot.measure( View.MeasureSpec.makeMeasureSpec(primarySnapshotWidth, View.MeasureSpec.EXACTLY), - View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY)); + View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY) + ); secondarySnapshot.measure( View.MeasureSpec.makeMeasureSpec(secondarySnapshotWidth, View.MeasureSpec.EXACTLY), - View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight, - View.MeasureSpec.EXACTLY)); + View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight, View.MeasureSpec.EXACTLY) + ); } @Override diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 04b6710064..87437bd418 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -644,11 +644,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { secondarySnapshotHeight = totalThumbnailHeight; secondarySnapshotWidth = parentWidth - primarySnapshotWidth - scaledDividerBar; - int translationX = primarySnapshotWidth + scaledDividerBar; if (isRtl) { + int translationX = secondarySnapshotWidth + scaledDividerBar; primarySnapshot.setTranslationX(-translationX); secondarySnapshot.setTranslationX(0); } else { + int translationX = primarySnapshotWidth + scaledDividerBar; secondarySnapshot.setTranslationX(translationX); primarySnapshot.setTranslationX(0); } diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java index 06526a876e..dcbf7d1a12 100644 --- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java @@ -343,13 +343,15 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { secondarySnapshotHeight = totalThumbnailHeight - primarySnapshotHeight - dividerBar; secondarySnapshot.setTranslationY(0); primarySnapshot.setTranslationY(secondarySnapshotHeight + spaceAboveSnapshot + dividerBar); + primarySnapshot.measure( View.MeasureSpec.makeMeasureSpec(primarySnapshotWidth, View.MeasureSpec.EXACTLY), - View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY)); + View.MeasureSpec.makeMeasureSpec(primarySnapshotHeight, View.MeasureSpec.EXACTLY) + ); secondarySnapshot.measure( View.MeasureSpec.makeMeasureSpec(secondarySnapshotWidth, View.MeasureSpec.EXACTLY), - View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight, - View.MeasureSpec.EXACTLY)); + View.MeasureSpec.makeMeasureSpec(secondarySnapshotHeight, View.MeasureSpec.EXACTLY) + ); } /* ---------- The following are only used by TaskViewTouchHandler. ---------- */