Fixed a bug where holes could occur in the new shade.

When a notification was never layouted before and it was the first
child, holes could occur in the shade when dragging down, because its
maximum allowed height was wrongly calculated.

Bug: 14080722
Change-Id: Ia10f9dd95f917d492411aec1da4ae0fc4d8f33d5
This commit is contained in:
Selim Cinek
2014-04-23 17:24:37 +02:00
parent 21de56a946
commit b6e0e1228b
2 changed files with 18 additions and 2 deletions

View File

@@ -172,7 +172,7 @@ public class ExpandableNotificationRow extends FrameLayout
int oldHeight = lp.height;
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
setLayoutParams(lp);
measure(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), View.MeasureSpec.EXACTLY),
measure(View.MeasureSpec.makeMeasureSpec(getWidth(), View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(mRowMaxHeight, View.MeasureSpec.AT_MOST));
lp.height = oldHeight;
setLayoutParams(lp);

View File

@@ -533,7 +533,23 @@ public class StackScrollAlgorithm {
} else {
// We are expanding the shade, expand it to its full height.
mFirstChildMaxHeight = getMaxAllowedChildHeight(mFirstChildWhileExpanding);
if (mFirstChildWhileExpanding.getWidth() == 0) {
// This child was not layouted yet, wait for a layout pass
mFirstChildWhileExpanding
.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop, int oldRight,
int oldBottom) {
mFirstChildMaxHeight = getMaxAllowedChildHeight(
mFirstChildWhileExpanding);
mFirstChildWhileExpanding.removeOnLayoutChangeListener(this);
}
});
} else {
mFirstChildMaxHeight = getMaxAllowedChildHeight(mFirstChildWhileExpanding);
}
}
} else {
mFirstChildMaxHeight = 0;