From 1322fc37101ca9015dd9d1ce9111e7d995007613 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 29 Mar 2022 15:41:23 -0700 Subject: [PATCH] Fix translation for secondary split thumbnail in RTL Fix: 225157531 Test: Swipe up in RTL shows both thumbnails were expected. Change-Id: I87d286b6ce6542c7cffadf86e3d4d99a3618f984 --- .../android/quickstep/views/GroupedTaskView.java | 2 +- .../launcher3/touch/LandscapePagedViewHandler.java | 4 ++-- .../launcher3/touch/PagedOrientationHandler.java | 2 +- .../launcher3/touch/PortraitPagedViewHandler.java | 13 ++++++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index b9615abf1d..955fffcdb4 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -237,7 +237,7 @@ public class GroupedTaskView extends TaskView { } getPagedOrientationHandler().measureGroupedTaskViewThumbnailBounds(mSnapshotView, mSnapshotView2, widthSize, heightSize, mSplitBoundsConfig, - mActivity.getDeviceProfile()); + mActivity.getDeviceProfile(), getLayoutDirection() == LAYOUT_DIRECTION_RTL); updateIconPlacement(); } diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 88a4d66273..cba5be5e8e 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -454,8 +454,8 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { @Override public void measureGroupedTaskViewThumbnailBounds(View primarySnapshot, View secondarySnapshot, - int parentWidth, int parentHeight, - StagedSplitBounds splitBoundsConfig, DeviceProfile dp) { + int parentWidth, int parentHeight, StagedSplitBounds splitBoundsConfig, + DeviceProfile dp, boolean isRtl) { int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; int dividerBar = splitBoundsConfig.appsStackedVertically diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index 510a728765..911f2b0575 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -158,7 +158,7 @@ public interface PagedOrientationHandler { void measureGroupedTaskViewThumbnailBounds(View primarySnapshot, View secondarySnapshot, int parentWidth, int parentHeight, - StagedSplitBounds splitBoundsConfig, DeviceProfile dp); + StagedSplitBounds splitBoundsConfig, DeviceProfile dp, boolean isRtl); // Overview TaskMenuView methods void setTaskIconParams(FrameLayout.LayoutParams iconParams, diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index d88656c9f0..2ca236ee80 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -571,8 +571,8 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override public void measureGroupedTaskViewThumbnailBounds(View primarySnapshot, View secondarySnapshot, - int parentWidth, int parentHeight, - StagedSplitBounds splitBoundsConfig, DeviceProfile dp) { + int parentWidth, int parentHeight, StagedSplitBounds splitBoundsConfig, + DeviceProfile dp, boolean isRtl) { int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; int dividerBar = splitBoundsConfig.appsStackedVertically @@ -591,7 +591,13 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { secondarySnapshotHeight = totalThumbnailHeight; secondarySnapshotWidth = parentWidth - primarySnapshotWidth - dividerBar; int translationX = primarySnapshotWidth + dividerBar; - secondarySnapshot.setTranslationX(translationX); + if (isRtl) { + primarySnapshot.setTranslationX(-translationX); + secondarySnapshot.setTranslationX(0); + } else { + secondarySnapshot.setTranslationX(translationX); + primarySnapshot.setTranslationX(0); + } secondarySnapshot.setTranslationY(spaceAboveSnapshot); } else { primarySnapshotWidth = parentWidth; @@ -602,6 +608,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { int translationY = primarySnapshotHeight + spaceAboveSnapshot + dividerBar; secondarySnapshot.setTranslationY(translationY); secondarySnapshot.setTranslationX(0); + primarySnapshot.setTranslationX(0); } primarySnapshot.measure( View.MeasureSpec.makeMeasureSpec(primarySnapshotWidth, View.MeasureSpec.EXACTLY),