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

Commit 16ebac2b authored by Catherine Liang's avatar Catherine Liang
Browse files

Hide clock click delegate view for A11y when not interactable (2/2)

Clock face click delegate view is not interactable outside of clock
picker, and when the selected clock is not interactable, therefore it
should be hidden.

Also make sure view content description is set correctly on the view,
for the case that the default clock is selected and it should be shown.

Flag: com.android.systemui.shared.new_customization_picker_ui
Bug: 418202194
Test: manually verified with Talkback, switch access
Change-Id: I4c0bfd9b1321ecbe82b695a436dc04f743bdca5e
parent 8a0638c6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@
    <!-- Description for clock font editor axis revert button. [CHAR LIMIT=NONE] -->
    <string name="clock_font_editor_revert">Undo clock font changes</string>

    <!-- Description for a clock style setting that toggles the clock font between one with rounded corners and one without. [CHAR LIMIT=NONE] -->
    <string name="clock_style_round_clock">Round clock</string>

    <!-- Toast message to notify that the clock style is updated when they tap on the clock face. They can tap again to undo. [CHAR LIMIT=NONE] -->
    <string name="clock_style_update_toast">Style changed to <xliff:g name="font_name">%1$s</xliff:g>. Tap again to undo.</string>

+13 −4
Original line number Diff line number Diff line
@@ -645,11 +645,20 @@ constructor(private val defaultCustomizationOptionsBinder: DefaultCustomizationO
                            ::Pair,
                        )
                        .collect { (selectedOption, onClockFaceClicked) ->
                            clockFaceClickDelegateView.isVisible =
                                selectedOption == ThemePickerLockCustomizationOption.CLOCK
                            if (
                                selectedOption == ThemePickerLockCustomizationOption.CLOCK &&
                                    onClockFaceClicked != null
                            ) {
                                clockFaceClickDelegateView.isVisible = true
                                clockFaceClickDelegateView.setOnClickListener {
                                    onClockFaceClicked.invoke()
                                }
                            } else {
                                clockFaceClickDelegateView.isVisible = false
                                clockFaceClickDelegateView.setOnClickListener(null)
                            }
                            clockFaceClickDelegateView.contentDescription =
                                context.getString(R.string.clock_style_round_clock)
                        }
                }

+3 −3
Original line number Diff line number Diff line
@@ -259,14 +259,14 @@ constructor(
    // and the clock style preset group index changes. The integer is the updated group index.
    val showClockFacePresetGroupIndexUpdateToast: Flow<Int> =
        _showClockFacePresetGroupIndexUpdateToast.asStateFlow().filterNotNull()
    val onClockFaceClicked: Flow<() -> Unit> =
    val onClockFaceClicked: Flow<(() -> Unit)?> =
        combine(groups, previewingClockPresetIndexedStyle) { groups, previewingIndexedStyle ->
            if (groups.isNullOrEmpty()) {
                {}
                null
            } else {
                val groupCount = groups.size
                if (groupCount == 1) {
                    {}
                    null
                } else {
                    val currentGroupIndex = previewingIndexedStyle?.groupIndex ?: 0
                    val nextGroupIndex = (currentGroupIndex + 1) % groupCount