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

Commit 779a56f0 authored by Josh's avatar Josh
Browse files

updated dialog title to include title + description for A11y

Test: manual - using talkback ensure that when a customization dialog
pops in the title and the description is announced.
Flag: com.android.systemui.keyboard_shortcut_helper_shortcut_customizer
Fix: 390316097
Fix: 390311388

Change-Id: I6530886e3848a3603791619e61c6fc4d6af7f5fe
parent f91c2f1e
Loading
Loading
Loading
Loading
+22 −11
Original line number Diff line number Diff line
@@ -108,20 +108,31 @@ constructor(

    private fun setDialogProperties(dialog: SystemUIDialog, uiState: ShortcutCustomizationUiState) {
        dialog.setOnDismissListener { viewModel.onDialogDismissed() }
        dialog.setTitle(
            resources.getString(
        dialog.setTitle("${getDialogTitle(uiState)}. ${getDialogDescription(uiState)}")
        // By default, apps cannot intercept action key. The system always handles it. This
        // flag is needed to enable customisation dialog window to intercept action key
        dialog.window?.addPrivateFlags(PRIVATE_FLAG_ALLOW_ACTION_KEY_EVENTS)
    }

    private fun getDialogTitle(uiState: ShortcutCustomizationUiState): String {
        return when (uiState) {
            is AddShortcutDialog -> uiState.shortcutLabel
            is DeleteShortcutDialog ->
                resources.getString(R.string.shortcut_customize_mode_remove_shortcut_dialog_title)
            else ->
                resources.getString(R.string.shortcut_customize_mode_reset_shortcut_dialog_title)
        }
    }

    private fun getDialogDescription(uiState: ShortcutCustomizationUiState): String {
        return resources.getString(
            when (uiState) {
                    is AddShortcutDialog ->
                        R.string.shortcut_customize_mode_add_shortcut_description
                is AddShortcutDialog -> R.string.shortcut_customize_mode_add_shortcut_description
                is DeleteShortcutDialog ->
                    R.string.shortcut_customize_mode_remove_shortcut_description
                else -> R.string.shortcut_customize_mode_reset_shortcut_description
            }
        )
        )
        // By default, apps cannot intercept action key. The system always handles it. This
        // flag is needed to enable customisation dialog window to intercept action key
        dialog.window?.addPrivateFlags(PRIVATE_FLAG_ALLOW_ACTION_KEY_EVENTS)
    }

    @AssistedFactory