diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-08-01 05:36:22 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-08-04 14:01:03 +0200 |
commit | ff9c9c473f9cf4e273c9cfeeb595c5870d1053b8 (patch) | |
tree | 00f9fb69172116a7676a68a4a6eba15ded329bcb /packages | |
parent | ae44128776410abd11bd06ae700db9cc4606a773 (diff) | |
download | frameworks_base-ff9c9c473f9cf4e273c9cfeeb595c5870d1053b8.zip frameworks_base-ff9c9c473f9cf4e273c9cfeeb595c5870d1053b8.tar.gz frameworks_base-ff9c9c473f9cf4e273c9cfeeb595c5870d1053b8.tar.bz2 |
Faster timings when a notification comes out from more card
Change-Id: I1cc759aa8a2c235c4ca1962b41a406480b4277b2
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 2 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java | 28 |
2 files changed, 24 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 03508ea..17c6276 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1402,7 +1402,7 @@ public abstract class BaseStatusBar extends SystemUI implements entry.row.setVisibility(View.VISIBLE); if (wasGone) { // notify the scroller of a child addition - mStackScroller.generateAddAnimation(entry.row); + mStackScroller.generateAddAnimation(entry.row, true /* fromMoreCard */); } visibleNotifications++; } 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 a4d2021..943ee21 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -43,6 +43,7 @@ import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.stack.StackScrollState.ViewState; import java.util.ArrayList; +import java.util.HashSet; /** * A layout which handles a dynamic amount of notifications and presents them in a scrollable stack. @@ -108,6 +109,7 @@ public class NotificationStackScrollLayout extends ViewGroup private ArrayList<View> mSnappedBackChildren = new ArrayList<View>(); private ArrayList<View> mDragAnimPendingChildren = new ArrayList<View>(); private ArrayList<View> mChildrenChangingPositions = new ArrayList<View>(); + private HashSet<View> mFromMoreCardAdditions = new HashSet<>(); private ArrayList<AnimationEvent> mAnimationEvents = new ArrayList<AnimationEvent>(); private ArrayList<View> mSwipedOutViews = new ArrayList<View>(); @@ -1456,6 +1458,7 @@ public class NotificationStackScrollLayout extends ViewGroup return true; } else { mChildrenToAddAnimated.remove(child); + mFromMoreCardAdditions.remove(child); return false; } } @@ -1512,7 +1515,7 @@ public class NotificationStackScrollLayout extends ViewGroup super.onViewAdded(child); mStackScrollAlgorithm.notifyChildrenChanged(this); ((ExpandableView) child).setOnHeightChangedListener(this); - generateAddAnimation(child); + generateAddAnimation(child, false /* fromMoreCard */); } public void setAnimationsEnabled(boolean animationsEnabled) { @@ -1527,11 +1530,15 @@ public class NotificationStackScrollLayout extends ViewGroup * Generate an animation for an added child view. * * @param child The view to be added. + * @param fromMoreCard Whether this add is coming from the "more" card on lockscreen. */ - public void generateAddAnimation(View child) { + public void generateAddAnimation(View child, boolean fromMoreCard) { if (mIsExpanded && mAnimationsEnabled && !mChangePositionInProgress) { // Generate Animations mChildrenToAddAnimated.add(child); + if (fromMoreCard) { + mFromMoreCardAdditions.add(child); + } mNeedsAnimation = true; } } @@ -1628,10 +1635,17 @@ public class NotificationStackScrollLayout extends ViewGroup private void generateChildAdditionEvents() { for (View child : mChildrenToAddAnimated) { - mAnimationEvents.add(new AnimationEvent(child, - AnimationEvent.ANIMATION_TYPE_ADD)); + if (mFromMoreCardAdditions.contains(child)) { + mAnimationEvents.add(new AnimationEvent(child, + AnimationEvent.ANIMATION_TYPE_ADD, + StackStateAnimator.ANIMATION_DURATION_STANDARD)); + } else { + mAnimationEvents.add(new AnimationEvent(child, + AnimationEvent.ANIMATION_TYPE_ADD)); + } } mChildrenToAddAnimated.clear(); + mFromMoreCardAdditions.clear(); } private void generateTopPaddingEvent() { @@ -2249,11 +2263,15 @@ public class NotificationStackScrollLayout extends ViewGroup View viewAfterChangingView; AnimationEvent(View view, int type) { + this(view, type, LENGTHS[type]); + } + + AnimationEvent(View view, int type, long length) { eventStartTime = AnimationUtils.currentAnimationTimeMillis(); changingView = view; animationType = type; filter = FILTERS[type]; - length = LENGTHS[type]; + this.length = length; } /** |