From fcfa14c2f77ebb433edde586e0cbe72f01814d77 Mon Sep 17 00:00:00 2001 From: jasonwshsu Date: Wed, 28 Jul 2021 10:24:25 +0800 Subject: [PATCH] Add the getter APIs to fetch the drawable / resId easily Fix: 193081959 Test: atest AccessibilityButtonPreviewPreferenceControllerTest Change-Id: Iff29eff28ce85644b9301be89256a639ce99b8e1 --- .../widget/IllustrationPreference.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 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 f04b0e338959f..b0f37acc9d984 100644 --- a/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +++ b/packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java @@ -170,7 +170,14 @@ public class IllustrationPreference extends Preference { } /** - * Sets image drawable to display image in {@link LottieAnimationView} + * Gets the lottie illustration resource id. + */ + public int getLottieAnimationResId() { + return mImageResId; + } + + /** + * Sets the image drawable to display image in {@link LottieAnimationView}. * * @param imageDrawable the drawable of an image */ @@ -183,7 +190,16 @@ public class IllustrationPreference extends Preference { } /** - * Sets image uri to display image in {@link LottieAnimationView} + * Gets the image drawable from display image in {@link LottieAnimationView}. + * + * @return the drawable of an image + */ + public Drawable getImageDrawable() { + return mImageDrawable; + } + + /** + * Sets the image uri to display image in {@link LottieAnimationView}. * * @param imageUri the Uri of an image */ @@ -195,6 +211,15 @@ public class IllustrationPreference extends Preference { } } + /** + * Gets the image uri from display image in {@link LottieAnimationView}. + * + * @return the Uri of an image + */ + public Uri getImageUri() { + return mImageUri; + } + private void resetImageResourceCache() { mImageDrawable = null; mImageUri = null;