From c9c00ae2fa5fb787e9f12705f8cd8de445ecde4b Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 20 May 2014 03:33:40 +0200 Subject: Fixed several bugs introduced by the new background views. Also notifications are now limited to 4U again. Bug: 14880580 Change-Id: I05d19981ad1bb06687bf6c994608e21ac925a759 --- .../statusbar/ActivatableNotificationView.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java') 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); -- cgit v1.1