diff options
| author | 2023-02-17 19:30:31 +0000 | |
|---|---|---|
| committer | 2023-02-17 19:37:50 +0000 | |
| commit | 2c9f4857c5de720794a719f805607cafa1d9eb67 (patch) | |
| tree | 00d40fa841fbd179df5b7950310e64ec60b3cb02 | |
| parent | b0830a8f80d732c3de626e9ec5b647122eed1b2f (diff) | |
Add the ability to disable the resource cache for a particular lottie illustration.
This is required so that when we override the animation based on device configuration (e.g. using /res/raw-land) the animation actually reloads.
Test: manual by changing the device configuration and seeing the animation update
Bug: 269233648
Change-Id: Ic1c9b023013608580f9f8186fd4b6d0b995180f0
| -rw-r--r-- | packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java | 4 |
1 files changed, 4 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 3b902757c43e..37ae2d45e614 100644 --- a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +++ b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java @@ -55,6 +55,7 @@ public class IllustrationPreference extends Preference { private int mMaxHeight = SIZE_UNSPECIFIED; private int mImageResId; + private boolean mCacheComposition = true; private boolean mIsAutoScale; private Uri mImageUri; private Drawable mImageDrawable; @@ -133,6 +134,7 @@ public class IllustrationPreference extends Preference { lp.width = screenWidth < screenHeight ? screenWidth : screenHeight; illustrationFrame.setLayoutParams(lp); + illustrationView.setCacheComposition(mCacheComposition); handleImageWithAnimation(illustrationView); handleImageFrameMaxHeight(backgroundView, illustrationView); @@ -427,6 +429,8 @@ public class IllustrationPreference extends Preference { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LottieAnimationView, 0 /*defStyleAttr*/, 0 /*defStyleRes*/); mImageResId = a.getResourceId(R.styleable.LottieAnimationView_lottie_rawRes, 0); + mCacheComposition = a.getBoolean( + R.styleable.LottieAnimationView_lottie_cacheComposition, true); a = context.obtainStyledAttributes(attrs, R.styleable.IllustrationPreference, 0 /*defStyleAttr*/, 0 /*defStyleRes*/); |