summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java6
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt19
2 files changed, 19 insertions, 6 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
index 7e75e4072878..66e70ef5ce61 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
@@ -1098,8 +1098,10 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
final float menuRight = menuLeft + menuWidth;
final float menuBottom = menuTop + menuHeight;
- // If the menu is out of screen bounds, shift it up/left as needed
- if (menuRight > displayWidth) {
+ // If the menu is out of screen bounds, shift it as needed
+ if (menuLeft < 0) {
+ menuLeft = 0;
+ } else if (menuRight > displayWidth) {
menuLeft = (displayWidth - menuWidth);
}
if (menuBottom > displayHeight) {
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt
index be3ea4e7b71e..38accce82999 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/MaximizeMenu.kt
@@ -291,13 +291,24 @@ class MaximizeMenu(
requireViewById(R.id.maximize_menu_snap_container) as View
private val snapWindowText =
requireViewById(R.id.maximize_menu_snap_window_text) as TextView
- private val snapRightButton =
- requireViewById(R.id.maximize_menu_snap_right_button) as Button
- private val snapLeftButton =
- requireViewById(R.id.maximize_menu_snap_left_button) as Button
private val snapButtonsLayout =
requireViewById(R.id.maximize_menu_snap_menu_layout)
+ // If layout direction is RTL, maximize menu will be mirrored, switching the order of the
+ // snap right/left buttons.
+ val isRtl: Boolean =
+ (context.resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_RTL)
+ private val snapRightButton = if (isRtl) {
+ requireViewById(R.id.maximize_menu_snap_left_button) as Button
+ } else {
+ requireViewById(R.id.maximize_menu_snap_right_button) as Button
+ }
+ private val snapLeftButton = if (isRtl) {
+ requireViewById(R.id.maximize_menu_snap_right_button) as Button
+ } else {
+ requireViewById(R.id.maximize_menu_snap_left_button) as Button
+ }
+
private val decorThemeUtil = DecorThemeUtil(context)
private val outlineRadius = context.resources