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

Commit 84258e56 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add Handle Menu RTL support" into main

parents 53357ba9 a47957a8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
    android:clipChildren="false"
    android:clipToPadding="false"
    android:paddingBottom="@dimen/desktop_mode_handle_menu_pill_elevation"
    android:paddingRight="@dimen/desktop_mode_handle_menu_pill_elevation"
    android:paddingEnd="@dimen/desktop_mode_handle_menu_pill_elevation"
    android:orientation="vertical">

    <LinearLayout
+20 −6
Original line number Diff line number Diff line
@@ -238,8 +238,12 @@ class HandleMenu(
        val taskBounds = taskInfo.getConfiguration().windowConfiguration.bounds
        updateGlobalMenuPosition(taskBounds, captionX, captionY)
        if (layoutResId == R.layout.desktop_mode_app_header) {
            // Align the handle menu to the left side of the caption.
            menuX = marginMenuStart
            // Align the handle menu to the start of the header.
            menuX = if (context.isRtl()) {
                taskBounds.width() - menuWidth - marginMenuStart
            } else {
                marginMenuStart
            }
            menuY = captionY + marginMenuTop
        } else {
            if (DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) {
@@ -261,11 +265,18 @@ class HandleMenu(
        val nonFreeformX = captionX + (captionWidth / 2) - (menuWidth / 2)
        when {
            taskInfo.isFreeform -> {
                if (context.isRtl()) {
                    globalMenuPosition.set(
                        /* x= */ taskBounds.right - menuWidth - marginMenuStart,
                        /* y= */ taskBounds.top + captionY + marginMenuTop
                    )
                } else {
                    globalMenuPosition.set(
                        /* x= */ taskBounds.left + marginMenuStart,
                        /* y= */ taskBounds.top + captionY + marginMenuTop
                    )
                }
            }
            taskInfo.isFullscreen -> {
                globalMenuPosition.set(
                    /* x = */ nonFreeformX,
@@ -430,6 +441,9 @@ class HandleMenu(
        return context.resources.getDimensionPixelSize(resourceId)
    }

    private fun Context.isRtl() =
        resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_RTL

    fun close() {
        handleMenuView?.animateCloseMenu {
            handleMenuViewContainer?.releaseView()