diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java | 18 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 51602e7ab831..59cbd4089a3b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar; import android.content.Context; +import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; @@ -44,6 +45,7 @@ public abstract class ExpandableView extends FrameLayout { private static Rect mClipRect = new Rect(); private boolean mWillBeGone; private int mMinClipTopAmount = 0; + private boolean mMeasuredTooHigh; public ExpandableView(Context context, AttributeSet attrs) { super(context, attrs); @@ -54,12 +56,13 @@ public abstract class ExpandableView extends FrameLayout { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { boolean limitViewHeight = shouldLimitViewHeight(); + final int givenSize = MeasureSpec.getSize(heightMeasureSpec); int ownMaxHeight = limitViewHeight ? mMaxViewHeight : Integer.MAX_VALUE; int heightMode = MeasureSpec.getMode(heightMeasureSpec); boolean hasFixedHeight = heightMode == MeasureSpec.EXACTLY; if (hasFixedHeight) { // We have a height set in our layout, so we want to be at most as big as given - ownMaxHeight = Math.min(MeasureSpec.getSize(heightMeasureSpec), ownMaxHeight); + ownMaxHeight = Math.min(givenSize, ownMaxHeight); } int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST); int maxChildHeight = 0; @@ -97,6 +100,7 @@ public abstract class ExpandableView extends FrameLayout { mMatchParentViews.clear(); int width = MeasureSpec.getSize(widthMeasureSpec); setMeasuredDimension(width, ownHeight); + mMeasuredTooHigh = heightMode != MeasureSpec.UNSPECIFIED && ownHeight > givenSize; } protected boolean shouldLimitViewHeight() { @@ -384,6 +388,18 @@ public abstract class ExpandableView extends FrameLayout { mMinClipTopAmount = minClipTopAmount; } + @Override + public void setLayerType(int layerType, Paint paint) { + if (hasOverlappingRendering()) { + super.setLayerType(layerType, paint); + } + } + + @Override + public boolean hasOverlappingRendering() { + return super.hasOverlappingRendering() && !mMeasuredTooHigh; + } + /** * A listener notifying when {@link #getActualHeight} changes. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index 2b71ce936ab5..beaa3ad60b37 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -90,7 +90,7 @@ public class NotificationChildrenContainer extends ViewGroup { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - int childCount = mChildren.size(); + int childCount = Math.min(mChildren.size(), NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED); for (int i = 0; i < childCount; i++) { View child = mChildren.get(i); if (child.getVisibility() == View.GONE) { @@ -118,7 +118,7 @@ public class NotificationChildrenContainer extends ViewGroup { int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST); int dividerHeightSpec = MeasureSpec.makeMeasureSpec(mDividerHeight, MeasureSpec.EXACTLY); int height = mNotificationHeaderHeight + mNotificatonTopPadding; - int childCount = mChildren.size(); + int childCount = Math.min(mChildren.size(), NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED); for (int i = 0; i < childCount; i++) { View child = mChildren.get(i); child.measure(widthMeasureSpec, newHeightSpec); |