am 5ef3d8aa: am d8dd29f9: am 68597329: Merge "Fixed an animation bug with inline view updates" into lmp-dev

* commit '5ef3d8aa73269520f4195f874e80f46a8e07668e':
  Fixed an animation bug with inline view updates
This commit is contained in:
Selim Cinek
2014-08-11 17:45:04 +00:00
committed by Android Git Automerger
5 changed files with 57 additions and 1 deletions

View File

@@ -660,6 +660,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
}
public void reset() {
super.reset();
setTintColor(0);
setShowingLegacyBackground(false);
setBelowSpeedBump(false);

View File

@@ -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) {

View File

@@ -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);
}
}

View File

@@ -1468,6 +1468,10 @@ public class NotificationPanelView extends PanelView implements
requestPanelHeightUpdate();
}
@Override
public void onReset(ExpandableView view) {
}
@Override
public void onScrollChanged() {
if (mQsExpanded) {

View File

@@ -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;