diff options
author | Setup Wizard Team <android-setup-team-eng@google.com> | 2021-06-29 02:13:40 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-06-29 02:13:40 +0000 |
commit | 379a98ee85f07d48394bbe17229574fd87578d01 (patch) | |
tree | fa0429fae76936b9bc212aa5ddd323759bc005fc | |
parent | ba849a91fe4a3fced85b0aeec90792439019536b (diff) | |
parent | b69685d83962dc1a0cec92a1637b7794c395e2d0 (diff) | |
download | setupdesign-android-mainline-12.0.0_r122.tar.gz |
Import updated Android Setupdesign Library 381429150 am: b69685d839android-mainline-12.0.0_r99android-mainline-12.0.0_r77android-mainline-12.0.0_r70android-mainline-12.0.0_r63android-mainline-12.0.0_r59android-mainline-12.0.0_r49android-mainline-12.0.0_r122android-mainline-12.0.0_r100android12-mainline-networkstack-release
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/setupdesign/+/15090010
Change-Id: I9f848e0a0d0338f4c2b7076cb2728e47ff1937a2
-rw-r--r-- | lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java | 23 | ||||
-rw-r--r-- | main/src/com/google/android/setupdesign/util/DynamicColorPalette.java | 5 |
2 files changed, 26 insertions, 2 deletions
diff --git a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java index c6b2b2a..d239e3d 100644 --- a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java +++ b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java @@ -32,6 +32,8 @@ import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.provider.Settings.Global; +import android.provider.Settings.SettingNotFoundException; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; @@ -785,7 +787,8 @@ public class GlifLoadingLayout extends GlifLayout { } }; - private LottieAnimationFinishListener( + @VisibleForTesting + LottieAnimationFinishListener( GlifLoadingLayout glifLoadingLayout, Runnable runnable, long finishWithMinimumDuration) { if (runnable == null) { throw new NullPointerException("Runnable can not be null"); @@ -795,7 +798,7 @@ public class GlifLoadingLayout extends GlifLayout { this.handler = new Handler(Looper.getMainLooper()); this.lottieAnimationView = glifLoadingLayout.findLottieAnimationView(); - if (glifLoadingLayout.isLottieLayoutVisible()) { + if (glifLoadingLayout.isLottieLayoutVisible() && !isZeroAnimatorDurationScale()) { lottieAnimationView.setRepeatCount(0); lottieAnimationView.addAnimatorListener(animatorListener); if (finishWithMinimumDuration > 0) { @@ -807,6 +810,22 @@ public class GlifLoadingLayout extends GlifLayout { } @VisibleForTesting + boolean isZeroAnimatorDurationScale() { + try { + if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) { + return Global.getFloat( + glifLoadingLayout.getContext().getContentResolver(), Global.ANIMATOR_DURATION_SCALE) + == 0f; + } else { + return false; + } + + } catch (SettingNotFoundException e) { + return false; + } + } + + @VisibleForTesting public void onAnimationFinished() { handler.removeCallbacks(runnable); runnable.run(); diff --git a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java index 2541c66..2db8c75 100644 --- a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java +++ b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java @@ -41,6 +41,7 @@ public final class DynamicColorPalette { ColorType.ERROR_WARNING, ColorType.SUCCESS_DONE, ColorType.FALLBACK_ACCENT, + ColorType.BACKGROUND_SURFACE, }) public @interface ColorType { int ACCENT = 0; @@ -50,6 +51,7 @@ public final class DynamicColorPalette { int ERROR_WARNING = 4; int SUCCESS_DONE = 5; int FALLBACK_ACCENT = 6; + int BACKGROUND_SURFACE = 7; } @ColorInt @@ -76,6 +78,9 @@ public final class DynamicColorPalette { case ColorType.FALLBACK_ACCENT: colorRes = R.color.sud_system_fallback_accent; break; + case ColorType.BACKGROUND_SURFACE: + colorRes = R.color.sud_system_background_surface; + break; // fall out } |