Loading packages/SettingsLib/IllustrationPreference/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,6 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.settingslib.widget"> <uses-sdk android:minSdkVersion="21" /> <uses-sdk android:minSdkVersion="28" /> </manifest> packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/ColorUtils.java +0 −20 Original line number Diff line number Diff line Loading @@ -39,13 +39,6 @@ import java.util.HashMap; public class ColorUtils { private static HashMap<String, Integer> sSysColors; static { sSysColors = new HashMap<>(); sSysColors.put(".colorAccent", android.R.attr.colorAccent); sSysColors.put(".colorPrimary", android.R.attr.colorPrimary); sSysColors.put(".colorPrimaryDark", android.R.attr.colorPrimaryDark); sSysColors.put(".colorSecondary", android.R.attr.colorSecondary); } private static HashMap<String, Pair<Integer, Integer>> sFixedColors; static { Loading Loading @@ -110,19 +103,6 @@ public class ColorUtils { * Apply the color of tags to the animation. */ public static void applyDynamicColors(Context context, LottieAnimationView animationView) { for (String key : sSysColors.keySet()) { final int color = sSysColors.get(key); animationView.addValueCallback( new KeyPath("**", key, "**"), LottieProperty.COLOR_FILTER, new SimpleLottieValueCallback<ColorFilter>() { @Override public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) { return new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN); } } ); } for (String key : sFixedColors.keySet()) { final Pair<Integer, Integer> fixedColorPair = sFixedColors.get(key); final int color = isDarkMode(context) ? fixedColorPair.second : fixedColorPair.first; Loading packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +6 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,9 @@ import com.airbnb.lottie.LottieAnimationView; */ public class IllustrationPreference extends Preference { static final String TAG = "IllustrationPreference"; private static final String TAG = "IllustrationPreference"; private static final boolean IS_ENABLED_LOTTIE_ADAPTIVE_COLOR = false; private int mAnimationId; private boolean mIsAutoScale; Loading Loading @@ -70,7 +72,6 @@ public class IllustrationPreference extends Preference { mIllustrationView = (LottieAnimationView) holder.findViewById(R.id.lottie_view); mIllustrationView.setAnimation(mAnimationId); mIllustrationView.loop(true); ColorUtils.applyDynamicColors(getContext(), mIllustrationView); mIllustrationView.playAnimation(); if (mIsAutoScale) { enableAnimationAutoScale(mIsAutoScale); Loading @@ -78,6 +79,9 @@ public class IllustrationPreference extends Preference { if (mMiddleGroundView != null) { enableMiddleGroundView(); } if (IS_ENABLED_LOTTIE_ADAPTIVE_COLOR) { ColorUtils.applyDynamicColors(getContext(), mIllustrationView); } } @VisibleForTesting Loading Loading
packages/SettingsLib/IllustrationPreference/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,6 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.settingslib.widget"> <uses-sdk android:minSdkVersion="21" /> <uses-sdk android:minSdkVersion="28" /> </manifest>
packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/ColorUtils.java +0 −20 Original line number Diff line number Diff line Loading @@ -39,13 +39,6 @@ import java.util.HashMap; public class ColorUtils { private static HashMap<String, Integer> sSysColors; static { sSysColors = new HashMap<>(); sSysColors.put(".colorAccent", android.R.attr.colorAccent); sSysColors.put(".colorPrimary", android.R.attr.colorPrimary); sSysColors.put(".colorPrimaryDark", android.R.attr.colorPrimaryDark); sSysColors.put(".colorSecondary", android.R.attr.colorSecondary); } private static HashMap<String, Pair<Integer, Integer>> sFixedColors; static { Loading Loading @@ -110,19 +103,6 @@ public class ColorUtils { * Apply the color of tags to the animation. */ public static void applyDynamicColors(Context context, LottieAnimationView animationView) { for (String key : sSysColors.keySet()) { final int color = sSysColors.get(key); animationView.addValueCallback( new KeyPath("**", key, "**"), LottieProperty.COLOR_FILTER, new SimpleLottieValueCallback<ColorFilter>() { @Override public ColorFilter getValue(LottieFrameInfo<ColorFilter> frameInfo) { return new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN); } } ); } for (String key : sFixedColors.keySet()) { final Pair<Integer, Integer> fixedColorPair = sFixedColors.get(key); final int color = isDarkMode(context) ? fixedColorPair.second : fixedColorPair.first; Loading
packages/SettingsLib/IllustrationPreference/src/com/android/settingslib/widget/IllustrationPreference.java +6 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,9 @@ import com.airbnb.lottie.LottieAnimationView; */ public class IllustrationPreference extends Preference { static final String TAG = "IllustrationPreference"; private static final String TAG = "IllustrationPreference"; private static final boolean IS_ENABLED_LOTTIE_ADAPTIVE_COLOR = false; private int mAnimationId; private boolean mIsAutoScale; Loading Loading @@ -70,7 +72,6 @@ public class IllustrationPreference extends Preference { mIllustrationView = (LottieAnimationView) holder.findViewById(R.id.lottie_view); mIllustrationView.setAnimation(mAnimationId); mIllustrationView.loop(true); ColorUtils.applyDynamicColors(getContext(), mIllustrationView); mIllustrationView.playAnimation(); if (mIsAutoScale) { enableAnimationAutoScale(mIsAutoScale); Loading @@ -78,6 +79,9 @@ public class IllustrationPreference extends Preference { if (mMiddleGroundView != null) { enableMiddleGroundView(); } if (IS_ENABLED_LOTTIE_ADAPTIVE_COLOR) { ColorUtils.applyDynamicColors(getContext(), mIllustrationView); } } @VisibleForTesting Loading