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

Commit 6d0be503 authored by Daniel Akinola's avatar Daniel Akinola
Browse files

Update App Handle strings to announce Desktop View

Currently there is no indication that users are actually in desktop mode
when using Talkback, so updating the app handle content description to
announce "<app name> - Desktop View". Also updating the announce text
for the app handle buttons to use "Desktop View" insted of "desktop
windowing mode"

Bug: 329030507
Test: manual testing
Flag: EXEMPT bug fix
Change-Id: I85aec10b173e6f8d1743e7550d0189a49cac100b
parent 34c706fb
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@
    <!-- Accessibility text for the handle fullscreen button [CHAR LIMIT=NONE] -->
    <string name="fullscreen_text">Fullscreen</string>
    <!-- Accessibility text for the handle desktop button [CHAR LIMIT=NONE] -->
    <string name="desktop_text">Desktop Mode</string>
    <string name="desktop_text">Desktop View</string>
    <!-- Accessibility text for the handle split screen button [CHAR LIMIT=NONE] -->
    <string name="split_screen_text">Split Screen</string>
    <!-- Accessibility text for the handle more options button [CHAR LIMIT=NONE] -->
@@ -316,7 +316,7 @@
    <!-- Accessibility text for the handle menu close menu button [CHAR LIMIT=NONE] -->
    <string name="collapse_menu_text">Close Menu</string>
    <!-- Accessibility text for the App Header's App Chip [CHAR LIMIT=NONE] -->
    <string name="desktop_mode_app_header_chip_text">Open Menu</string>
    <string name="desktop_mode_app_header_chip_text"><xliff:g id="app_name" example="Chrome">%1$s</xliff:g> (Desktop View)</string>
    <!-- Maximize menu maximize button string. -->
    <string name="desktop_mode_maximize_menu_maximize_text">Maximize Screen</string>
    <!-- Maximize menu snap buttons string. -->
@@ -342,10 +342,10 @@
    <!-- Accessibility text for the Maximize Menu's snap maximize/restore [CHAR LIMIT=NONE] -->
    <string name="desktop_mode_a11y_action_maximize_restore">Maximize or restore window size</string>

    <!-- Accessibility action replacement for caption handle menu split screen button [CHAR LIMIT=NONE] -->
    <string name="app_handle_menu_talkback_split_screen_mode_button_text">Enter split screen mode</string>
    <!-- Accessibility action replacement for caption handle menu enter desktop mode button [CHAR LIMIT=NONE] -->
    <string name="app_handle_menu_talkback_desktop_mode_button_text">Enter desktop windowing mode</string>
    <!-- Accessibility action replacement for caption handle app chip buttons [CHAR LIMIT=NONE] -->
    <string name="app_handle_chip_accessibility_announce">Open Menu</string>
    <!-- Accessibility action replacement for caption handle menu buttons [CHAR LIMIT=NONE] -->
    <string name="app_handle_menu_accessibility_announce">Enter <xliff:g id="windowing_mode" example="Desktop View">%1$s</xliff:g></string>
    <!-- Accessibility action replacement for maximize menu enter snap left button [CHAR LIMIT=NONE] -->
    <string name="maximize_menu_talkback_action_snap_left_text">Resize window to left</string>
    <!-- Accessibility action replacement for maximize menu enter snap right button [CHAR LIMIT=NONE] -->
+23 −7
Original line number Diff line number Diff line
@@ -35,10 +35,8 @@ import android.view.SurfaceControl
import android.view.View
import android.view.WindowInsets.Type.systemBars
import android.view.WindowManager
import android.widget.Button
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import android.window.DesktopModeFlags
import android.window.SurfaceSyncGroup
import androidx.annotation.StringRes
@@ -540,17 +538,35 @@ class HandleMenu(
                return@setOnTouchListener true
            }

            with(context.resources) {
                // Update a11y read out to say "double tap to enter desktop windowing mode"
            with(context) {
                // Update a11y announcement out to say "double tap to enter Fullscreen"
                ViewCompat.replaceAccessibilityAction(
                    fullscreenBtn, ACTION_CLICK,
                    getString(
                        R.string.app_handle_menu_accessibility_announce,
                        getString(R.string.fullscreen_text)
                    ),
                    null,
                )

                // Update a11y announcement out to say "double tap to enter Desktop View"
                ViewCompat.replaceAccessibilityAction(
                    desktopBtn, ACTION_CLICK,
                    getString(R.string.app_handle_menu_talkback_desktop_mode_button_text), null
                    getString(
                        R.string.app_handle_menu_accessibility_announce,
                        getString(R.string.desktop_text)
                    ),
                    null,
                )

                // Update a11y read out to say "double tap to enter split screen mode"
                // Update a11y announcement to say "double tap to enter Split Screen"
                ViewCompat.replaceAccessibilityAction(
                    splitscreenBtn, ACTION_CLICK,
                    getString(R.string.app_handle_menu_talkback_split_screen_mode_button_text), null
                    getString(
                        R.string.app_handle_menu_accessibility_announce,
                        getString(R.string.split_screen_text)
                    ),
                    null,
                )
            }
        }
+23 −31
Original line number Diff line number Diff line
@@ -93,9 +93,6 @@ class AppHeaderViewHolder(
    private val lightColors = dynamicLightColorScheme(context)
    private val darkColors = dynamicDarkColorScheme(context)

    private val headerButtonOpenMenuA11yText = context.resources
        .getString(R.string.desktop_mode_app_header_chip_text)

    /**
     * The corner radius to apply to the app chip, maximize and close button's background drawable.
     **/
@@ -231,36 +228,30 @@ class AppHeaderViewHolder(
            }
        }

        val a11yActionOpenHeaderMenu = AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK,
            headerButtonOpenMenuA11yText)
        openMenuButton.accessibilityDelegate = object : View.AccessibilityDelegate() {
            override fun onInitializeAccessibilityNodeInfo(
                host: View,
                info: AccessibilityNodeInfo
            ) {
                super.onInitializeAccessibilityNodeInfo(host, info)
                info.addAction(a11yActionOpenHeaderMenu)
            }
        }
        // Update a11y announcement to say "double tap to open menu"
        ViewCompat.replaceAccessibilityAction(
            openMenuButton,
            AccessibilityActionCompat.ACTION_CLICK,
            context.getString(R.string.app_handle_chip_accessibility_announce),
            null
        )

        with(context.resources) {
            // Update a11y read out to say "double tap to maximize or restore window size"
        // Update a11y announcement to say "double tap to maximize or restore window size"
        ViewCompat.replaceAccessibilityAction(
            maximizeWindowButton,
            AccessibilityActionCompat.ACTION_CLICK,
                getString(R.string.maximize_button_talkback_action_maximize_restore_text),
            context.getString(R.string.maximize_button_talkback_action_maximize_restore_text),
            null
        )

            // Update a11y read out to say "double tap to minimize app window"
        // Update a11y announcement out to say "double tap to minimize app window"
        ViewCompat.replaceAccessibilityAction(
            minimizeWindowButton,
            AccessibilityActionCompat.ACTION_CLICK,
                getString(R.string.minimize_button_talkback_action_maximize_restore_text),
            context.getString(R.string.minimize_button_talkback_action_maximize_restore_text),
            null
        )
    }
    }

    override fun bindData(data: HeaderData) {
        bindData(
@@ -275,7 +266,8 @@ class AppHeaderViewHolder(
    /** Sets the app's name in the header. */
    fun setAppName(name: CharSequence) {
        appNameTextView.text = name
        openMenuButton.contentDescription = name
        openMenuButton.contentDescription =
            context.getString(R.string.desktop_mode_app_header_chip_text, name)
    }

    /** Sets the app's icon in the header. */