From d768f73f37549b7bf556c012c0f0c4d11ca1808d Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Fri, 16 Sep 2022 18:52:44 +0000 Subject: [PATCH] Correctly position the landscape / rtl FloatingIconView's background drawable when swiping back to home. Bug: 235812580 Test: Verified the correct "Swipe Back to Home" position for the floating icon view in landscape and portrait (rtl and ltr for both orientations) with a tablet. There is a screen recording on the bug. Change-Id: Id06f43e70ef617e39e1b26d0c8b7466147e325d2 --- src/com/android/launcher3/views/FloatingIconView.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index efc83ebcc9..55af6221d8 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.views; +import static android.view.Gravity.LEFT; + import static com.android.launcher3.Utilities.getBadge; import static com.android.launcher3.Utilities.getFullDrawable; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; @@ -181,8 +183,10 @@ public class FloatingIconView extends FrameLayout implements updatePosition(positionOut, lp); setLayoutParams(lp); - mClipIconView.setLayoutParams(new FrameLayout.LayoutParams(lp.width, lp.height)); - mBtvDrawable.setLayoutParams(new FrameLayout.LayoutParams(lp.width, lp.height)); + // For code simplicity, we always layout the child views using Gravity.LEFT + // and manually handle RTL for FloatingIconView when positioning it on the screen. + mClipIconView.setLayoutParams(new FrameLayout.LayoutParams(lp.width, lp.height, LEFT)); + mBtvDrawable.setLayoutParams(new FrameLayout.LayoutParams(lp.width, lp.height, LEFT)); } private void updatePosition(RectF pos, InsettableFrameLayout.LayoutParams lp) {