From 2fda02b3b4a90115d92670085d8ce48f637a12b0 Mon Sep 17 00:00:00 2001 From: Peter Liang Date: Tue, 20 Dec 2022 15:24:40 +0800 Subject: [PATCH] Support the RTL mode of the message view. Actions: 1) Force the menu view layer set layout direction as LTR to simplify the translation positioning and animations. Besides, the floating menu would also recover the last position when users turn it on. 2) Set the layout direction of the message view as LOCALE. Bug: 244622119 Test: manual test Change-Id: I5199305b1df39f88bd31307a58fd08390ec8120e --- .../systemui/accessibility/floatingmenu/MenuMessageView.java | 1 + .../systemui/accessibility/floatingmenu/MenuViewLayer.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java index 9875ad06f1ed5..bc56f3b714f15 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuMessageView.java @@ -61,6 +61,7 @@ class MenuMessageView extends LinearLayout implements MenuMessageView(Context context) { super(context); + setLayoutDirection(LAYOUT_DIRECTION_LOCALE); setVisibility(GONE); mTextView = new TextView(context); diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java index 6f5b39cc7d56c..0c5d9afa38535 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java @@ -150,6 +150,9 @@ class MenuViewLayer extends FrameLayout implements AccessibilityManager accessibilityManager, IAccessibilityFloatingMenu floatingMenu) { super(context); + // Simplifies the translation positioning and animations + setLayoutDirection(LAYOUT_DIRECTION_LTR); + mWindowManager = windowManager; mAccessibilityManager = accessibilityManager; mFloatingMenu = floatingMenu;