summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java23
-rw-r--r--main/src/com/google/android/setupdesign/util/DynamicColorPalette.java5
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
}