summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2016-01-14 17:04:47 -0800
committer Selim Cinek <cinek@google.com> 2016-01-21 19:42:49 -0800
commit3bdbf28b496094b012a63f1d38b823e8c205909b (patch)
treed1497f8b50f3049964fe624bda5ad4f09289f3b7
parentfa0a2d3d90fdde14784ec6351a0798bc21c2f126 (diff)
Fixed the animation on the music template by introducing scale
The notification images can now animate in scale. Change-Id: I7cc90e13f31208c76a490dd94a1ccbc05a4f8bd3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageTransformState.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java24
2 files changed, 29 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageTransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageTransformState.java
index 25dbfbae9bca..e891a977abce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageTransformState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageTransformState.java
@@ -62,6 +62,11 @@ public class ImageTransformState extends TransformState {
}
@Override
+ protected boolean animateScale() {
+ return true;
+ }
+
+ @Override
public void recycle() {
super.recycle();
sInstancePool.release(this);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java
index 039a907e522a..388ba0e70bc9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/TransformState.java
@@ -91,6 +91,24 @@ public class TransformState {
transformedView.setTranslationY(otherPosition[1] - ownStablePosition[1]);
transformedView.animate().translationY(0);
}
+ if (animateScale()) {
+ // we also want to animate the scale if we're the same
+ View otherView = otherState.getTransformedView();
+ if (otherView.getWidth() != transformedView.getWidth()) {
+ float scaleX = (otherView.getWidth() * otherView.getScaleX()
+ / (float) transformedView.getWidth());
+ transformedView.setScaleX(scaleX);
+ transformedView.setPivotX(0);
+ transformedView.animate().scaleX(1.0f);
+ }
+ if (otherView.getHeight() != transformedView.getHeight()) {
+ float scaleY = (otherView.getHeight() * otherView.getScaleY()
+ / (float) transformedView.getHeight());
+ transformedView.setScaleY(scaleY);
+ transformedView.setPivotY(0);
+ transformedView.animate().scaleY(1.0f);
+ }
+ }
transformedView.animate()
.setInterpolator(TransformState.FAST_OUT_SLOW_IN)
.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD)
@@ -103,6 +121,10 @@ public class TransformState {
setClippingDeactivated(transformedView, true);
}
+ protected boolean animateScale() {
+ return false;
+ }
+
/**
* Transforms the {@link #mTransformedView} to the given transformviewstate
* @param otherState the state to transform from
@@ -272,6 +294,8 @@ public class TransformState {
if (visible) {
mTransformedView.setTranslationX(0);
mTransformedView.setTranslationY(0);
+ mTransformedView.setScaleX(1.0f);
+ mTransformedView.setScaleY(1.0f);
}
}