diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java')
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 724b6a4..0f214a2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -45,6 +45,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView = new PathInterpolator(0.6f, 0, 0.5f, 1); private static final Interpolator ACTIVATE_INVERSE_ALPHA_INTERPOLATOR = new PathInterpolator(0, 0, 0.5f, 1); + private final int mMaxNotificationHeight; private boolean mDimmed; @@ -80,6 +81,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in); mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in); + mMaxNotificationHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height); setClipChildren(false); setClipToPadding(false); } @@ -293,6 +295,27 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int newHeightSpec = MeasureSpec.makeMeasureSpec(mMaxNotificationHeight, + MeasureSpec.AT_MOST); + int maxChildHeight = 0; + int childCount = getChildCount(); + for (int i = 0; i < childCount; i++) { + View child = getChildAt(i); + if (child != mBackgroundDimmed && child != mBackgroundNormal) { + child.measure(widthMeasureSpec, newHeightSpec); + int childHeight = child.getMeasuredHeight(); + maxChildHeight = Math.max(maxChildHeight, childHeight); + } + } + newHeightSpec = MeasureSpec.makeMeasureSpec(maxChildHeight, MeasureSpec.EXACTLY); + mBackgroundDimmed.measure(widthMeasureSpec, newHeightSpec); + mBackgroundNormal.measure(widthMeasureSpec, newHeightSpec); + int width = MeasureSpec.getSize(widthMeasureSpec); + setMeasuredDimension(width, maxChildHeight); + } + + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); setPivotX(getWidth() / 2); |
