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

Commit c5943473 authored by Mill Chen's avatar Mill Chen
Browse files

Add default content description to animating illustration

Fix: 395821692
Test: manual test with Talkback
Flag: EXEMPT bugfix
Change-Id: I764a5cb337696a704d92fc16cf55459b1f9cbb26
parent 1c413e4d
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@
    <string name="settingslib_action_label_resume">resume</string>
    <!-- Label for an accessibility action that stops an animation [CHAR LIMIT=30] -->
    <string name="settingslib_action_label_pause">pause</string>
    <!-- Label for an accessibility action that stops an animation [CHAR LIMIT=50] -->
    <string name="settingslib_state_animation_playing">Animation playing</string>
    <!-- Label for an accessibility action that stops an animation [CHAR LIMIT=50] -->
    <string name="settingslib_state_animation_paused">Animation paused</string>
    <!-- Default content description attached to the illustration if there is no content description. [CHAR LIMIT=NONE] -->
    <string name="settingslib_illustration_content_description">Animation</string>
</resources>
+4 −10
Original line number Diff line number Diff line
@@ -464,6 +464,10 @@ public class IllustrationPreference extends Preference implements GroupSectionDi
        if (mIsAnimatable) {
            // TODO(b/397340540): list out pages having illustration without a content description.
            if (TextUtils.isEmpty(mContentDescription)) {
                // Default content description will be attached if there's no content description.
                illustrationView.setContentDescription(
                        getContext().getString(
                                R.string.settingslib_illustration_content_description));
                Log.w(TAG, "Illustration should have a content description. preference key = "
                        + getKey());
            }
@@ -483,8 +487,6 @@ public class IllustrationPreference extends Preference implements GroupSectionDi
    }

    private void updateAccessibilityAction(ViewGroup container) {
        // Setting the state of animation
        container.setStateDescription(getStateDescriptionForAnimation());
        container.setAccessibilityDelegate(new View.AccessibilityDelegate() {
            @Override
            public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
@@ -505,14 +507,6 @@ public class IllustrationPreference extends Preference implements GroupSectionDi
        }
    }

    private String getStateDescriptionForAnimation() {
        if (mIsAnimationPaused) {
            return getContext().getString(R.string.settingslib_state_animation_paused);
        } else {
            return getContext().getString(R.string.settingslib_state_animation_playing);
        }
    }

    private static void startLottieAnimationWith(LottieAnimationView illustrationView,
            Uri imageUri) {
        final InputStream inputStream =