summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2014-05-20 03:33:40 +0200
committerSelim Cinek <cinek@google.com>2014-05-20 03:33:40 +0200
commitc9c00ae2fa5fb787e9f12705f8cd8de445ecde4b (patch)
tree9f0570466157f1bd8c1673f53438599adffcb7d0 /packages/SystemUI
parente595504f09f3cae65cda27261353eb3cfa72fd6e (diff)
downloadframeworks_base-c9c00ae2fa5fb787e9f12705f8cd8de445ecde4b.zip
frameworks_base-c9c00ae2fa5fb787e9f12705f8cd8de445ecde4b.tar.gz
frameworks_base-c9c00ae2fa5fb787e9f12705f8cd8de445ecde4b.tar.bz2
Fixed several bugs introduced by the new background views.
Also notifications are now limited to 4U again. Bug: 14880580 Change-Id: I05d19981ad1bb06687bf6c994608e21ac925a759
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_row.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java16
5 files changed, 45 insertions, 14 deletions
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 @@ 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);
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 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
@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.content.Context;
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 @@ public abstract class ExpandableView extends FrameLayout {
@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.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
+import android.widget.FrameLayout;
import com.android.systemui.R;
/**
@@ -29,7 +30,7 @@ import com.android.systemui.R;
* 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 @@ public class NotificationContentView extends ExpandableView {
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 @@ public class NotificationContentView extends ExpandableView {
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 @@ public class NotificationContentView extends ExpandableView {
selectLayout();
}
- @Override
public boolean isContentExpandable() {
return mExpandedChild != null;
}