Merge "Fixed several bugs introduced by the new background views."
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml
index 2837cd6..a401195 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml
@@ -27,7 +27,7 @@
<Button
android:id="@+id/veto"
android:layout_width="48dp"
- android:layout_height="match_parent"
+ android:layout_height="8dp"
android:gravity="end"
android:layout_marginEnd="-80dp"
android:background="@null"
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 @@
= 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 @@
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 @@
}
@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);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index f6c80fc..48d1196 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -224,7 +224,7 @@
@Override
public void setActualHeight(int height, boolean notifyListeners) {
- mPrivateLayout.setActualHeight(height, notifyListeners);
+ mPrivateLayout.setActualHeight(height);
invalidate();
super.setActualHeight(height, notifyListeners);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
index 061396d..5cb1b78 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
@@ -20,12 +20,12 @@
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
-import android.widget.FrameLayout;
+import android.view.ViewGroup;
/**
* An abstract view for expandable views.
*/
-public abstract class ExpandableView extends FrameLayout {
+public abstract class ExpandableView extends ViewGroup {
private OnHeightChangedListener mOnHeightChangedListener;
protected int mActualHeight;
@@ -38,7 +38,17 @@
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
+ for (int i = 0; i < getChildCount(); i++) {
+ View child = getChildAt(i);
+ int height = child.getMeasuredHeight();
+ int width = child.getMeasuredWidth();
+ int center = getWidth() / 2;
+ int childLeft = center - width / 2;
+ child.layout(childLeft,
+ 0,
+ childLeft + width,
+ height);
+ }
if (!mActualHeightInitialized && mActualHeight == 0) {
mActualHeight = getInitialHeight();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 9df2701..f9baecb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -22,6 +22,7 @@
import android.view.Gravity;
import android.view.View;
+import android.widget.FrameLayout;
import com.android.systemui.R;
/**
@@ -29,7 +30,7 @@
* expanded layout. This class is responsible for clipping the content and and switching between the
* expanded and contracted view depending on its clipped size.
*/
-public class NotificationContentView extends ExpandableView {
+public class NotificationContentView extends FrameLayout {
private final Rect mClipBounds = new Rect();
@@ -37,6 +38,8 @@
private View mExpandedChild;
private int mSmallHeight;
+ private int mClipTopAmount;
+ private int mActualHeight;
public NotificationContentView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -69,28 +72,24 @@
selectLayout();
}
- @Override
- public void setActualHeight(int actualHeight, boolean notifyListeners) {
- super.setActualHeight(actualHeight, notifyListeners);
+ public void setActualHeight(int actualHeight) {
+ mActualHeight = actualHeight;
selectLayout();
updateClipping();
}
- @Override
public int getMaxHeight() {
// The maximum height is just the laid out height.
return getHeight();
}
- @Override
public int getMinHeight() {
return mSmallHeight;
}
- @Override
public void setClipTopAmount(int clipTopAmount) {
- super.setClipTopAmount(clipTopAmount);
+ mClipTopAmount = clipTopAmount;
updateClipping();
}
@@ -127,7 +126,6 @@
selectLayout();
}
- @Override
public boolean isContentExpandable() {
return mExpandedChild != null;
}