summaryrefslogtreecommitdiff
path: root/core/java/android/view/InsetsAnimationControlImpl.java
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2020-01-20 17:24:51 +0100
committerJorim Jaggi <jjaggi@google.com>2020-01-23 00:36:28 +0100
commitdd3304ec3bb7ca651b79a2878149b47b95e1e521 (patch)
tree277241400e4127f0d3fa277899949ca514ca54ad /core/java/android/view/InsetsAnimationControlImpl.java
parent0da8fd165fed21f26b2b10ddcf4bd1a89d9981c3 (diff)
Fix fraction, and other cleanup
Fraction is now from animation start to end state. This makes it more in line with other animation fraction meaning. Also, the app can figure out the animation direction on its own by inspecting the visibility state when the animation gets prepared. Also fix some other stuff in WindowInsetsAnimationCallback. Test: CTS coming soon Bug: 118118435 Change-Id: I81d36159817719a9b0ee25bb78cfbfddc2029270
Diffstat (limited to 'core/java/android/view/InsetsAnimationControlImpl.java')
-rw-r--r--core/java/android/view/InsetsAnimationControlImpl.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index f5afd106a4a7..405eccd56e3c 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -40,6 +40,7 @@ import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowInsetsAnimationCallback.AnimationBounds;
import android.view.WindowInsetsAnimationCallback.InsetsAnimation;
import android.view.WindowManager.LayoutParams;
+import android.view.animation.Interpolator;
import com.android.internal.annotations.VisibleForTesting;
@@ -84,8 +85,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
public InsetsAnimationControlImpl(SparseArray<InsetsSourceControl> controls, Rect frame,
InsetsState state, WindowInsetsAnimationControlListener listener,
@InsetsType int types,
- InsetsAnimationControlCallbacks controller, long durationMs, boolean fade,
- @LayoutInsetsDuringAnimation int layoutInsetsDuringAnimation) {
+ InsetsAnimationControlCallbacks controller, long durationMs, Interpolator interpolator,
+ boolean fade, @LayoutInsetsDuringAnimation int layoutInsetsDuringAnimation) {
mControls = controls;
mListener = listener;
mTypes = types;
@@ -101,8 +102,8 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
mFrame = new Rect(frame);
buildTypeSourcesMap(mTypeSideMap, mSideSourceMap, mControls);
- mAnimation = new WindowInsetsAnimationCallback.InsetsAnimation(mTypes,
- InsetsController.INTERPOLATOR, durationMs);
+ mAnimation = new WindowInsetsAnimationCallback.InsetsAnimation(mTypes, interpolator,
+ durationMs);
mAnimation.setAlpha(getCurrentAlpha());
mController.startAnimation(this, listener, types, mAnimation,
new AnimationBounds(mHiddenInsets, mShownInsets), layoutInsetsDuringAnimation);
@@ -196,7 +197,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
state.getSource(control.getType()).setVisible(shown);
}
Insets insets = getInsetsFromState(state, mFrame, null /* typeSideMap */);
- setInsetsAndAlpha(insets, 1f /* alpha */, shown ? 1f : 0f /* fraction */);
+ setInsetsAndAlpha(insets, 1f /* alpha */, 1f /* fraction */);
mFinished = true;
mShownOnFinish = shown;
}