diff options
author | Selim Cinek <cinek@google.com> | 2014-08-11 17:40:42 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-08-11 17:40:42 +0000 |
commit | 99afb198955387708520cb84b9f363163c2d0a32 (patch) | |
tree | 776c82127a53aaa7a95113d9388cf35b7d99937e | |
parent | 59c2cf504ab22ea5588a48e573dfd5d7107aeb40 (diff) | |
parent | 5685c12481ff4d9d75d818a955e2cc50995a61b1 (diff) | |
download | frameworks_base-99afb198955387708520cb84b9f363163c2d0a32.zip frameworks_base-99afb198955387708520cb84b9f363163c2d0a32.tar.gz frameworks_base-99afb198955387708520cb84b9f363163c2d0a32.tar.bz2 |
am d8dd29f9: am 68597329: Merge "Fixed an animation bug with inline view updates" into lmp-dev
* commit 'd8dd29f9864662028cbde11711447649ce261a98':
Fixed an animation bug with inline view updates
5 files changed, 57 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 1cd18a0..6ac0bef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -660,6 +660,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } public void reset() { + super.reset(); setTintColor(0); setShowingLegacyBackground(false); setBelowSpeedBump(false); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 0960c00..a275572 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -59,6 +59,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private boolean mClearable; private ExpansionLogger mLogger; private String mLoggingKey; + private boolean mWasReset; public interface ExpansionLogger { public void logNotificationExpansion(String key, boolean userAction, boolean expanded); @@ -88,6 +89,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mPublicLayout.reset(); mPrivateLayout.reset(); mMaxExpandHeight = 0; + mWasReset = true; logExpansionEvent(false, wasExpanded); } @@ -246,11 +248,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - boolean updateExpandHeight = mMaxExpandHeight == 0; + boolean updateExpandHeight = mMaxExpandHeight == 0 && !mWasReset; mMaxExpandHeight = mPrivateLayout.getMaxHeight(); if (updateExpandHeight) { applyExpansionToLayout(); } + mWasReset = false; } public void setSensitive(boolean sensitive) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 46d4a9a..df64edf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -255,6 +255,10 @@ public abstract class ExpandableView extends FrameLayout { public void setBelowSpeedBump(boolean below) { } + public void reset() { + mOnHeightChangedListener.onReset(this); + } + /** * A listener notifying when {@link #getActualHeight} changes. */ @@ -265,5 +269,12 @@ public abstract class ExpandableView extends FrameLayout { * padding or the padding between the elements changed */ void onHeightChanged(ExpandableView view); + + /** + * Called when the view is reset and therefore the height will change abruptly + * + * @param view The view which was reset. + */ + void onReset(ExpandableView view); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a07bc5c..1d08658 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -1469,6 +1469,10 @@ public class NotificationPanelView extends PanelView implements } @Override + public void onReset(ExpandableView view) { + } + + @Override public void onScrollChanged() { if (mQsExpanded) { requestScrollerTopPaddingUpdate(false /* animate */); 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 fec5e74..d2b97d1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -163,6 +163,8 @@ public class NotificationStackScrollLayout extends ViewGroup private int mNotificationTopPadding; private float mTopPaddingOverflow; private boolean mDontReportNextOverScroll; + private boolean mRequestViewResizeAnimationOnLayout; + private boolean mNeedViewResizeAnimation; /** * The maximum scrollPosition which we are allowed to reach when a notification was expanded. @@ -319,9 +321,18 @@ public class NotificationStackScrollLayout extends ViewGroup setMaxLayoutHeight(getHeight()); updateContentHeight(); clampScrollPosition(); + requestAnimationOnViewResize(); requestChildrenUpdate(); } + private void requestAnimationOnViewResize() { + if (mRequestViewResizeAnimationOnLayout && mIsExpanded && mAnimationsEnabled) { + mNeedViewResizeAnimation = true; + mNeedsAnimation = true; + } + mRequestViewResizeAnimationOnLayout = false; + } + public void updateSpeedBumpIndex(int newIndex) { int currentIndex = indexOfChild(mSpeedBumpView); @@ -1598,9 +1609,18 @@ public class NotificationStackScrollLayout extends ViewGroup generateHideSensitiveEvent(); generateDarkEvent(); generateGoToFullShadeEvent(); + generateViewResizeEvent(); mNeedsAnimation = false; } + private void generateViewResizeEvent() { + if (mNeedViewResizeAnimation) { + mAnimationEvents.add( + new AnimationEvent(null, AnimationEvent.ANIMATION_TYPE_VIEW_RESIZE)); + } + mNeedViewResizeAnimation = false; + } + private void generateSnapBackEvents() { for (View child : mSnappedBackChildren) { mAnimationEvents.add(new AnimationEvent(child, @@ -1892,6 +1912,11 @@ public class NotificationStackScrollLayout extends ViewGroup requestChildrenUpdate(); } + @Override + public void onReset(ExpandableView view) { + mRequestViewResizeAnimationOnLayout = true; + } + private void updateScrollPositionOnExpandInBottom(ExpandableView view) { if (view instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; @@ -2258,6 +2283,14 @@ public class NotificationStackScrollLayout extends ViewGroup // ANIMATION_TYPE_HIDE_SENSITIVE new AnimationFilter() .animateHideSensitive(), + + // ANIMATION_TYPE_VIEW_RESIZE + new AnimationFilter() + .animateAlpha() + .animateHeight() + .animateTopInset() + .animateY() + .animateZ(), }; static int[] LENGTHS = new int[] { @@ -2297,6 +2330,9 @@ public class NotificationStackScrollLayout extends ViewGroup // ANIMATION_TYPE_HIDE_SENSITIVE StackStateAnimator.ANIMATION_DURATION_STANDARD, + + // ANIMATION_TYPE_VIEW_RESIZE + StackStateAnimator.ANIMATION_DURATION_STANDARD, }; static final int ANIMATION_TYPE_ADD = 0; @@ -2311,6 +2347,7 @@ public class NotificationStackScrollLayout extends ViewGroup static final int ANIMATION_TYPE_DARK = 9; static final int ANIMATION_TYPE_GO_TO_FULL_SHADE = 10; static final int ANIMATION_TYPE_HIDE_SENSITIVE = 11; + static final int ANIMATION_TYPE_VIEW_RESIZE = 12; final long eventStartTime; final View changingView; |