summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mill Chen <millchen@google.com> 2025-02-03 10:58:56 +0000
committer Mill Chen <millchen@google.com> 2025-02-03 10:58:56 +0000
commitfce0437f46e3ae970c96c09267f0a6e5a0b37856 (patch)
tree795e925e43993032fb96c55048d29e2b7a5b88fc
parent6c3be6f202dcd77a8359330e30a6e27ebd594f06 (diff)
Enrich illustration preference control
- Add pause animation control - Add resume animation control Fix: 391701916 Test: visual test Flag: EXEMPT bug fix Change-Id: I9f08e3ef0a0f1a91fcc13f5dbd9105aedeb232c0
-rw-r--r--packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java
index 4b407c50bbd5..af40c647e805 100644
--- a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java
+++ b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java
@@ -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);