Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f458d951 authored by Maryam Dehaini's avatar Maryam Dehaini Committed by Android (Google) Code Review
Browse files

Merge "Account for RTL languages for maximize menu" into main

parents 944d40f2 d23ccace
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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) {
+15 −4
Original line number Diff line number Diff line
@@ -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