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

Commit 0088b5e6 authored by Yining Liu's avatar Yining Liu
Browse files

Improve accessibility on notification on ls settings page

Improve accessibility on notification on ls settings page by making
the minimalism setting buttons not focusable when already selected.
This change reduces the confuses and improve usability for both
talkback and voice access.

Fix: 415946053
Fix: 415944893
Test: manual in the Settings App
Flag: com.android.server.notification.notification_lock_screen_settings
Change-Id: I339c09480440d705153373630e84b2f4fbc1330c
parent c69c5e7c
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.settings.notification.lockscreen;

import static android.provider.Settings.Secure.LOCK_SCREEN_NOTIFICATION_MINIMALISM;
import static android.provider.Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS;
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES;

import android.content.ContentResolver;
import android.content.Context;
@@ -60,7 +62,8 @@ public class MinimalismPreferenceController
    private static final Uri URI_LOCK_SCREEN_SHOW_NOTIFICATIONS =
            Settings.Secure.getUriFor(LOCK_SCREEN_SHOW_NOTIFICATIONS);

    @Nullable private LayoutPreference mPreference;
    @Nullable
    private LayoutPreference mPreference;
    private Map<Integer, LinearLayout> mButtons = new HashMap<>();
    private Map<Integer, IllustrationPreference> mIllustrations = new HashMap<>();

@@ -150,7 +153,17 @@ public class MinimalismPreferenceController
    }

    private void highlightButton(int currentValue) {
        mButtons.forEach((value, button) -> button.setSelected(currentValue == value));
        mButtons.forEach(
                (value, button) -> {
                    button.setSelected(currentValue == value);
                    if (currentValue == value) {
                        button.setImportantForAccessibility(
                                IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
                    } else {
                        button.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
                    }
                }
        );
    }

    private void highlightIllustration(int currentValue) {