diff options
author | Setup Wizard Team <android-setup-team-eng@google.com> | 2021-06-25 17:25:49 +0800 |
---|---|---|
committer | Cating Lin <catinglin@google.com> | 2021-06-29 00:41:40 +0000 |
commit | b69685d83962dc1a0cec92a1637b7794c395e2d0 (patch) | |
tree | fa0429fae76936b9bc212aa5ddd323759bc005fc | |
parent | 649d1e8b9cdfeb2382d96cbc89fa58873cada13b (diff) | |
download | setupdesign-b69685d83962dc1a0cec92a1637b7794c395e2d0.tar.gz |
Import updated Android Setupdesign Library 381429150android-12.0.0_r32android-12.0.0_r29android-12.0.0_r28android-12.0.0_r27android-12.0.0_r26android-12.0.0_r21android-12.0.0_r20android-12.0.0_r19android-12.0.0_r18android-12.0.0_r16android12-qpr1-releaseandroid12-qpr1-d-s3-releaseandroid12-qpr1-d-s2-releaseandroid12-qpr1-d-s1-releaseandroid12-qpr1-d-releaseandroid12-dev
Copied from google3/third_party/java_src/android_libs/setupdesign
Test: mm
BUG: b/191230767
Included changes:
- 381429150 [GlifLoadingLayout] Fix ErrorPron Since API Settings.getF...
- 380143326 [GlifLoadingLayout] Fix GlifloadingLayout will not finish...
- 379668624 Add system background surface for 1p
PiperOrigin-RevId: 381429150
Change-Id: I0a94bae9820a12cbbc692fcbf1dc4e7aabbbaa29
-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 } |