summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorWei Sheng Shih <wilsonshih@google.com>2022-03-02 06:24:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2022-03-02 06:24:50 +0000
commit172ea326deb316b052bed4975eaefe8bb8d45bee (patch)
tree828fa7b793151d79a3b1f688fba7205ddaaa76a2 /core/java/android
parent96c65d7c31042f02c48b1fa22647a194592129e0 (diff)
parent5e0c72a2c593de712debf7294e39fb36553a2b30 (diff)
Merge "Estimate animation duration for AVD and AnimationDrawable" into tm-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/window/SplashScreenView.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/window/SplashScreenView.java b/core/java/android/window/SplashScreenView.java
index 34a34180b227..232248b6fab3 100644
--- a/core/java/android/window/SplashScreenView.java
+++ b/core/java/android/window/SplashScreenView.java
@@ -65,6 +65,7 @@ import com.android.internal.util.ContrastColorUtil;
import java.time.Duration;
import java.time.Instant;
import java.util.function.Consumer;
+import java.util.function.LongConsumer;
/**
* <p>The view which allows an activity to customize its splash screen exit animation.</p>
@@ -234,7 +235,7 @@ public final class SplashScreenView extends FrameLayout {
/**
* Set the animation duration if icon is animatable.
*/
- public Builder setAnimationDurationMillis(int duration) {
+ public Builder setAnimationDurationMillis(long duration) {
mIconAnimationDuration = Duration.ofMillis(duration);
return this;
}
@@ -521,8 +522,11 @@ public final class SplashScreenView extends FrameLayout {
});
}
- private void animationStartCallback() {
+ private void animationStartCallback(long animDuration) {
mIconAnimationStart = Instant.now();
+ if (animDuration > 0) {
+ mIconAnimationDuration = Duration.ofMillis(animDuration);
+ }
}
/**
@@ -693,9 +697,8 @@ public final class SplashScreenView extends FrameLayout {
* Prepare the animation if this drawable also be animatable.
* @param duration The animation duration.
* @param startListener The callback listener used to receive the start of the animation.
- * @return true if this drawable object can also be animated and it can be played now.
*/
- boolean prepareAnimate(long duration, Runnable startListener);
+ void prepareAnimate(long duration, LongConsumer startListener);
/**
* Stop animation.