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

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

Enrich illustration preference control

- Add pause animation control
- Add resume animation control

Fix: 391701916
Test: visual test
Flag: EXEMPT bug fix
Change-Id: I9f08e3ef0a0f1a91fcc13f5dbd9105aedeb232c0
parent 6c3be6f2
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public class IllustrationPreference extends Preference implements GroupSectionDi
    private boolean mLottieDynamicColor;
    private CharSequence mContentDescription;
    private boolean mIsTablet;
    private boolean mIsAnimationPaused;

    /**
     * Interface to listen in on when {@link #onBindViewHolder(PreferenceViewHolder)} occurs.
@@ -143,6 +144,16 @@ public class IllustrationPreference extends Preference implements GroupSectionDi
                (FrameLayout) holder.findViewById(R.id.middleground_layout);
        final LottieAnimationView illustrationView =
                (LottieAnimationView) holder.findViewById(R.id.lottie_view);
        // Pause and resume animation
        illustrationFrame.setOnClickListener(v -> {
            mIsAnimationPaused = !mIsAnimationPaused;
            if (mIsAnimationPaused) {
                illustrationView.pauseAnimation();
            } else {
                illustrationView.resumeAnimation();
            }
        });

        if (illustrationView != null && !TextUtils.isEmpty(mContentDescription)) {
            illustrationView.setContentDescription(mContentDescription);
            illustrationView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);