Merge "Clear the initialized flag when resetting the height." into lmp-mr1-dev

This commit is contained in:
Chris Wren
2014-10-31 19:10:52 +00:00
committed by Android (Google) Code Review
4 changed files with 13 additions and 7 deletions

View File

@@ -508,7 +508,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
if (mAppearAnimator != null) {
mAppearAnimator.cancel();
}
mAnimationTranslationY = translationDirection * mActualHeight;
mAnimationTranslationY = translationDirection * getActualHeight();
if (mAppearAnimationFraction == -1.0f) {
// not initialized yet, we start anew
if (isAppearing) {
@@ -601,14 +601,15 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
float top;
float bottom;
final int actualHeight = getActualHeight();
if (mAnimationTranslationY > 0.0f) {
bottom = mActualHeight - heightFraction * mAnimationTranslationY * 0.1f
bottom = actualHeight - heightFraction * mAnimationTranslationY * 0.1f
- translateYTotalAmount;
top = bottom * heightFraction;
} else {
top = heightFraction * (mActualHeight + mAnimationTranslationY) * 0.1f -
top = heightFraction * (actualHeight + mAnimationTranslationY) * 0.1f -
translateYTotalAmount;
bottom = mActualHeight * (1 - heightFraction) + top * heightFraction;
bottom = actualHeight * (1 - heightFraction) + top * heightFraction;
}
mAppearAnimationRect.set(left, top, right, bottom);
setOutlineRect(left, top + mAppearAnimationTranslation, right,

View File

@@ -154,9 +154,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
public void resetHeight() {
super.resetHeight();
mMaxExpandHeight = 0;
mWasReset = true;
mActualHeight = 0;
onHeightReset();
requestLayout();
}

View File

@@ -41,7 +41,7 @@ public abstract class ExpandableOutlineView extends ExpandableView {
outline.setRect(0,
mClipTopAmount,
getWidth(),
Math.max(mActualHeight, mClipTopAmount));
Math.max(getActualHeight(), mClipTopAmount));
} else {
outline.setRect(mOutlineRect);
}

View File

@@ -36,7 +36,7 @@ public abstract class ExpandableView extends FrameLayout {
private final int mMaxNotificationHeight;
private OnHeightChangedListener mOnHeightChangedListener;
protected int mActualHeight;
private int mActualHeight;
protected int mClipTopAmount;
private boolean mActualHeightInitialized;
private ArrayList<View> mMatchParentViews = new ArrayList<View>();
@@ -103,6 +103,11 @@ public abstract class ExpandableView extends FrameLayout {
}
}
protected void resetHeight() {
mActualHeight = 0;
mActualHeightInitialized = false;
}
protected int getInitialHeight() {
return getHeight();
}