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

Commit b8b28829 authored by Mill Chen's avatar Mill Chen Committed by Android (Google) Code Review
Browse files

Merge "Add default content description to animating illustration" into main

parents 561b8aee c5943473
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
@@ -474,6 +474,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());
            }
@@ -493,8 +497,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) {
@@ -515,14 +517,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 =