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

Commit 517f861e authored by Ben Lin's avatar Ben Lin
Browse files

Add "Restore" a11y text to maximize button when it's a restore state.

When the maximize button becomes a restore button/action, we should
change it so a11y services announce that.

Bug: 329351829
Test: Manual. Enable talkback, focus on the button when it's in Restore
- hears "Restore"
Flag: EXEMPT bugfix

Change-Id: I253f96d789abb3c891a23aa64f90025faeefafdd
parent f651f687
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -53,6 +53,10 @@ class MaximizeButtonView(
        (stubProgressBarContainer.inflate() as FrameLayout)
            .requireViewById(R.id.progress_bar)
    }
    private val maximizeButtonText =
        context.resources.getString(R.string.desktop_mode_maximize_menu_maximize_button_text)
    private val restoreButtonText =
        context.resources.getString(R.string.desktop_mode_maximize_menu_restore_button_text)

    init {
        LayoutInflater.from(context).inflate(R.layout.maximize_menu_button, this, true)
@@ -154,6 +158,12 @@ class MaximizeButtonView(
    /** Set the drawable resource to use for the maximize button. */
    fun setIcon(@DrawableRes icon: Int) {
        maximizeWindow.setImageResource(icon)
        when (icon) {
            R.drawable.decor_desktop_mode_immersive_or_maximize_exit_button_dark ->
                maximizeWindow.contentDescription = restoreButtonText
            R.drawable.decor_desktop_mode_maximize_button_dark ->
                maximizeWindow.contentDescription = maximizeButtonText
        }
    }

    companion object {