summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2014-05-07 21:42:40 +0200
committerJorim Jaggi <jjaggi@google.com>2014-05-08 01:18:00 +0000
commit5aa045cc6bca84f5c11f1a99999546ba5e5949a5 (patch)
treec3004fad4a945ef40ba39841a0bc6e65ee751a2f /packages
parentfe6bfa644c5287069468b1141cec7ee510a22382 (diff)
downloadframeworks_base-5aa045cc6bca84f5c11f1a99999546ba5e5949a5.zip
frameworks_base-5aa045cc6bca84f5c11f1a99999546ba5e5949a5.tar.gz
frameworks_base-5aa045cc6bca84f5c11f1a99999546ba5e5949a5.tar.bz2
Allow different animation lengths in StackStateAnimator.
Combine them using the maximum length. Change-Id: Idc1e6e52f7f36ed46fbfba013c23773eeed95cd6
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java44
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java8
2 files changed, 50 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index e83c3b5..afd5068 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -1315,6 +1315,33 @@ public class NotificationStackScrollLayout extends ViewGroup
.animateDimmed()
};
+ static int[] LENGTHS = new int[] {
+
+ // ANIMATION_TYPE_ADD
+ StackStateAnimator.ANIMATION_DURATION_STANDARD,
+
+ // ANIMATION_TYPE_REMOVE
+ StackStateAnimator.ANIMATION_DURATION_STANDARD,
+
+ // ANIMATION_TYPE_REMOVE_SWIPED_OUT
+ StackStateAnimator.ANIMATION_DURATION_STANDARD,
+
+ // ANIMATION_TYPE_TOP_PADDING_CHANGED
+ StackStateAnimator.ANIMATION_DURATION_STANDARD,
+
+ // ANIMATION_TYPE_START_DRAG
+ StackStateAnimator.ANIMATION_DURATION_STANDARD,
+
+ // ANIMATION_TYPE_SNAP_BACK
+ StackStateAnimator.ANIMATION_DURATION_STANDARD,
+
+ // ANIMATION_TYPE_ACTIVATED_CHILD
+ StackStateAnimator.ANIMATION_DURATION_DIMMED_ACTIVATED,
+
+ // ANIMATION_TYPE_DIMMED
+ StackStateAnimator.ANIMATION_DURATION_DIMMED_ACTIVATED,
+ };
+
static int ANIMATION_TYPE_ADD = 0;
static int ANIMATION_TYPE_REMOVE = 1;
static int ANIMATION_TYPE_REMOVE_SWIPED_OUT = 2;
@@ -1328,12 +1355,29 @@ public class NotificationStackScrollLayout extends ViewGroup
final View changingView;
final int animationType;
final AnimationFilter filter;
+ final long length;
AnimationEvent(View view, int type) {
eventStartTime = AnimationUtils.currentAnimationTimeMillis();
changingView = view;
animationType = type;
filter = FILTERS[type];
+ length = LENGTHS[type];
+ }
+
+ /**
+ * Combines the length of several animation events into a single value.
+ *
+ * @param events The events of the lengths to combine.
+ * @return The combined length. This is just the maximum of all length.
+ */
+ static long combineLength(ArrayList<AnimationEvent> events) {
+ long length = 0;
+ int size = events.size();
+ for (int i = 0; i < size; i++) {
+ length = Math.max(length, events.get(i).length);
+ }
+ return length;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
index 695a0db..c952698 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java
@@ -39,7 +39,9 @@ import java.util.Stack;
*/
public class StackStateAnimator {
- private static final int ANIMATION_DURATION = 360;
+ public static final int ANIMATION_DURATION_STANDARD = 360;
+ public static final int ANIMATION_DURATION_DIMMED_ACTIVATED = 220;
+
private static final int TAG_ANIMATOR_TRANSLATION_Y = R.id.translation_y_animator_tag;
private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_animator_tag;
private static final int TAG_ANIMATOR_SCALE = R.id.scale_animator_tag;
@@ -63,6 +65,7 @@ public class StackStateAnimator {
private Stack<AnimatorListenerAdapter> mAnimationListenerPool
= new Stack<AnimatorListenerAdapter>();
private AnimationFilter mAnimationFilter = new AnimationFilter();
+ private long mCurrentLength;
public StackStateAnimator(NotificationStackScrollLayout hostLayout) {
mHostLayout = hostLayout;
@@ -82,6 +85,7 @@ public class StackStateAnimator {
int childCount = mHostLayout.getChildCount();
mAnimationFilter.applyCombination(mNewEvents);
+ mCurrentLength = NotificationStackScrollLayout.AnimationEvent.combineLength(mNewEvents);
for (int i = 0; i < childCount; i++) {
final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i);
StackScrollState.ViewState viewState = finalState.getViewStateForView(child);
@@ -410,7 +414,7 @@ public class StackStateAnimator {
*/
private long cancelAnimatorAndGetNewDuration(ValueAnimator previousAnimator,
boolean newAnimationNeeded) {
- long newDuration = ANIMATION_DURATION;
+ long newDuration = mCurrentLength;
if (previousAnimator != null) {
if (!newAnimationNeeded) {
// This is only an update, no new event came in. lets just take the remaining