Changed the appearance of the notification children
Some further tuning to the layout
Change-Id: Ifb3797e9982d718a30954adb9e1901eb2a1fa75d
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index f2dfc45..099a5fe 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3001,6 +3001,7 @@
*/
private void resetNotificationHeader(RemoteViews contentView) {
contentView.setImageViewResource(R.id.icon, 0);
+ contentView.setBoolean(R.id.notification_header, "setExpanded", false);
contentView.setTextViewText(R.id.app_name_text, null);
contentView.setViewVisibility(R.id.chronometer, View.GONE);
contentView.setViewVisibility(R.id.header_sub_text, View.GONE);
@@ -3277,11 +3278,7 @@
}
private void adaptNotificationHeaderForBigContentView(RemoteViews result) {
- // We have to set the collapse button instead
- result.setImageViewResource(R.id.expand_button, R.drawable.ic_arrow_up_14dp);
- // Apply the color again
- result.setDrawableParameters(R.id.expand_button, false, -1, resolveColor(),
- PorterDuff.Mode.SRC_ATOP, -1);
+ result.setBoolean(R.id.notification_header, "setExpanded", true);
}
/**
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java
index 93e11af..54fa764 100644
--- a/core/java/android/view/NotificationHeaderView.java
+++ b/core/java/android/view/NotificationHeaderView.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RemoteViews;
import android.widget.TextView;
@@ -35,15 +36,18 @@
public class NotificationHeaderView extends LinearLayout {
public static final int NO_COLOR = -1;
private final int mHeaderMinWidth;
+ private final int mExpandTopPadding;
private View mAppName;
private View mSubTextView;
private OnClickListener mExpandClickListener;
private HeaderTouchListener mTouchListener = new HeaderTouchListener();
- private View mExpandButton;
+ private ImageView mExpandButton;
private View mIcon;
private TextView mChildCount;
private int mIconColor;
private int mOriginalNotificationColor;
+ private boolean mGroupHeader;
+ private boolean mExpanded;
public NotificationHeaderView(Context context) {
this(context, null);
@@ -61,6 +65,7 @@
super(context, attrs, defStyleAttr, defStyleRes);
mHeaderMinWidth = getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_header_shrink_min_width);
+ mExpandTopPadding = (int) (1 * getResources().getDisplayMetrics().density);
}
@Override
@@ -68,7 +73,7 @@
super.onFinishInflate();
mAppName = findViewById(com.android.internal.R.id.app_name_text);
mSubTextView = findViewById(com.android.internal.R.id.header_sub_text);
- mExpandButton = findViewById(com.android.internal.R.id.expand_button);
+ mExpandButton = (ImageView) findViewById(com.android.internal.R.id.expand_button);
mIcon = findViewById(com.android.internal.R.id.icon);
mChildCount = (TextView) findViewById(com.android.internal.R.id.number_of_children);
}
@@ -166,6 +171,39 @@
return mOriginalNotificationColor;
}
+ public void setIsGroupHeader(boolean isGroupHeader) {
+ mGroupHeader = isGroupHeader;
+ updateExpandButton();
+ }
+
+ @RemotableViewMethod
+ public void setExpanded(boolean expanded) {
+ mExpanded = expanded;
+ updateExpandButton();
+ }
+
+ private void updateExpandButton() {
+ int drawableId;
+ int paddingTop = 0;
+ if (mGroupHeader) {
+ if (mExpanded) {
+ drawableId = com.android.internal.R.drawable.ic_collapse_bundle;
+ } else {
+ drawableId =com.android.internal.R.drawable.ic_expand_bundle;
+ }
+ } else {
+ if (mExpanded) {
+ drawableId = com.android.internal.R.drawable.ic_collapse_notification;
+ } else {
+ drawableId = com.android.internal.R.drawable.ic_expand_notification;
+ }
+ paddingTop = mExpandTopPadding;
+ }
+ mExpandButton.setImageDrawable(getContext().getDrawable(drawableId));
+ mExpandButton.setColorFilter(mOriginalNotificationColor);
+ mExpandButton.setPadding(0, paddingTop, 0, 0);
+ }
+
public class HeaderTouchListener implements View.OnTouchListener {
private final ArrayList<Rect> mTouchRects = new ArrayList<>();
diff --git a/core/res/res/drawable/ic_arrow_up_14dp.xml b/core/res/res/drawable/ic_arrow_up_14dp.xml
deleted file mode 100644
index c4cc0d1..0000000
--- a/core/res/res/drawable/ic_arrow_up_14dp.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- ~ Copyright (C) 2015 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="14.0dp"
- android:height="14.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:pathData="M12.000000,8.000000l-6.000000,6.000000 1.400000,1.400000 4.600000,-4.599999 4.600000,4.599999 1.400000,-1.400000z"
- android:fillColor="#FF000000"/>
-</vector>
diff --git a/core/res/res/drawable/ic_arrow_drop_down.xml b/core/res/res/drawable/ic_collapse_bundle.xml
similarity index 68%
copy from core/res/res/drawable/ic_arrow_drop_down.xml
copy to core/res/res/drawable/ic_collapse_bundle.xml
index c8bb411..26c839d0 100644
--- a/core/res/res/drawable/ic_arrow_drop_down.xml
+++ b/core/res/res/drawable/ic_collapse_bundle.xml
@@ -15,11 +15,11 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="14.0dp"
- android:height="14.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:width="14.0dp"
+ android:height="14.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
<path
- android:pathData="M16.600000,8.600000l-4.600000,4.599999 -4.600000,-4.599999 -1.400000,1.400000 6.000000,6.000000 6.000000,-6.000000z"
- android:fillColor="#FF000000"/>
+ android:fillColor="#FF000000"
+ android:pathData="M12.0,10.0l5.3,-5.2l-1.4,-1.4L12.0,7.2L8.2,3.4L6.8,4.8L12.0,10.0zM6.8,19.2l1.4,1.4l3.8,-3.8l3.9,3.8l1.4,-1.4L12.0,14.0L6.8,19.2z"/>
</vector>
diff --git a/core/res/res/drawable/ic_arrow_drop_down.xml b/core/res/res/drawable/ic_collapse_notification.xml
similarity index 67%
copy from core/res/res/drawable/ic_arrow_drop_down.xml
copy to core/res/res/drawable/ic_collapse_notification.xml
index c8bb411..603c159 100644
--- a/core/res/res/drawable/ic_arrow_drop_down.xml
+++ b/core/res/res/drawable/ic_collapse_notification.xml
@@ -15,11 +15,14 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="14.0dp"
- android:height="14.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:width="14.0dp"
+ android:height="14.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
<path
- android:pathData="M16.600000,8.600000l-4.600000,4.599999 -4.600000,-4.599999 -1.400000,1.400000 6.000000,6.000000 6.000000,-6.000000z"
- android:fillColor="#FF000000"/>
+ android:fillColor="#FF000000"
+ android:pathData="M12.0,8.0l-6.0,6.0l1.4,1.4l4.6,-4.6l4.6,4.6L18.0,14.0L12.0,8.0z"/>
+ <path
+ android:pathData="M0,0h24v24H0V0z"
+ android:fillColor="#00000000"/>
</vector>
diff --git a/core/res/res/drawable/ic_arrow_drop_down.xml b/core/res/res/drawable/ic_expand_bundle.xml
similarity index 68%
rename from core/res/res/drawable/ic_arrow_drop_down.xml
rename to core/res/res/drawable/ic_expand_bundle.xml
index c8bb411..2cc5005 100644
--- a/core/res/res/drawable/ic_arrow_drop_down.xml
+++ b/core/res/res/drawable/ic_expand_bundle.xml
@@ -15,11 +15,11 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="14.0dp"
- android:height="14.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:width="14.0dp"
+ android:height="14.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
<path
- android:pathData="M16.600000,8.600000l-4.600000,4.599999 -4.600000,-4.599999 -1.400000,1.400000 6.000000,6.000000 6.000000,-6.000000z"
- android:fillColor="#FF000000"/>
+ android:fillColor="#FF000000"
+ android:pathData="M6.8,8.6L8.2,10.0L12.0,6.2l3.9,3.8l1.4,-1.4L12.0,3.4L6.8,8.6zM12.0,20.6l5.3,-5.2L15.8,14.0L12.0,17.8L8.2,14.0l-1.4,1.4L12.0,20.6z"/>
</vector>
diff --git a/core/res/res/drawable/ic_arrow_drop_down.xml b/core/res/res/drawable/ic_expand_notification.xml
similarity index 67%
copy from core/res/res/drawable/ic_arrow_drop_down.xml
copy to core/res/res/drawable/ic_expand_notification.xml
index c8bb411..db7d3eb 100644
--- a/core/res/res/drawable/ic_arrow_drop_down.xml
+++ b/core/res/res/drawable/ic_expand_notification.xml
@@ -15,11 +15,14 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="14.0dp"
- android:height="14.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
+ android:width="14.0dp"
+ android:height="14.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
<path
- android:pathData="M16.600000,8.600000l-4.600000,4.599999 -4.600000,-4.599999 -1.400000,1.400000 6.000000,6.000000 6.000000,-6.000000z"
- android:fillColor="#FF000000"/>
+ android:fillColor="#FF000000"
+ android:pathData="M16.6,8.6L12.0,13.2L7.4,8.6L6.0,10.0l6.0,6.0l6.0,-6.0L16.6,8.6z"/>
+ <path
+ android:pathData="M0,0h24v24H0V0z"
+ android:fillColor="#00000000"/>
</vector>
diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml
index aceae9f..e45f52b 100644
--- a/core/res/res/layout/notification_template_header.xml
+++ b/core/res/res/layout/notification_template_header.xml
@@ -125,7 +125,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="1dp"
- android:src="@drawable/ic_arrow_drop_down"
android:visibility="gone"
/>
</NotificationHeaderView>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 0fc999c..eadcae0 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2369,7 +2369,10 @@
<java-symbol type="id" name="sub_text_divider" />
<java-symbol type="id" name="content_info_divider" />
<java-symbol type="id" name="text_line_1" />
- <java-symbol type="drawable" name="ic_arrow_up_14dp" />
+ <java-symbol type="drawable" name="ic_expand_notification" />
+ <java-symbol type="drawable" name="ic_collapse_notification" />
+ <java-symbol type="drawable" name="ic_expand_bundle" />
+ <java-symbol type="drawable" name="ic_collapse_bundle" />
<java-symbol type="dimen" name="notification_header_height" />
<java-symbol type="dimen" name="notification_big_picture_content_min_height_with_picture" />
<java-symbol type="dimen" name="notification_header_shrink_min_width" />
diff --git a/packages/SystemUI/res/layout/hybrid_notification.xml b/packages/SystemUI/res/layout/hybrid_notification.xml
index 9e64d2c..f667859 100644
--- a/packages/SystemUI/res/layout/hybrid_notification.xml
+++ b/packages/SystemUI/res/layout/hybrid_notification.xml
@@ -18,21 +18,23 @@
<com.android.systemui.statusbar.notification.HybridNotificationView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="@dimen/notification_max_height">
+ android:layout_height="wrap_content"
+ android:paddingStart="@*android:dimen/notification_content_margin_start"
+ android:paddingEnd="12dp"
+ android:gravity="bottom">
<TextView
android:id="@+id/notification_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
+ android:paddingEnd="4dp"
android:singleLine="true"
android:textAppearance="@*android:style/TextAppearance.Material.Notification.Title"
- android:paddingEnd="4dp"
/>
<TextView
android:id="@+id/notification_text"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
+ android:paddingEnd="4dp"
android:textAppearance="@*android:style/TextAppearance.Material.Notification"
android:singleLine="true"
/>
diff --git a/packages/SystemUI/res/layout/notification_children_divider.xml b/packages/SystemUI/res/layout/notification_children_divider.xml
index f011afe..53273cf 100644
--- a/packages/SystemUI/res/layout/notification_children_divider.xml
+++ b/packages/SystemUI/res/layout/notification_children_divider.xml
@@ -20,4 +20,4 @@
android:id="@+id/notification_more_divider"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_children_divider_height"
- android:background="@*android:drawable/notification_template_divider" />
+ android:background="#61000000" />
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 25ff6b1..65b0c45 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -36,18 +36,6 @@
<!-- The font size for the clock -->
<dimen name="status_bar_clock_size">14sp</dimen>
- <!-- The margin on the start of the content view -->
- <dimen name="notification_content_margin_start">16dp</dimen>
-
- <!-- The maximum size of the title when in single line mode -->
- <dimen name="notification_maximum_title_length">150sp</dimen>
-
- <!-- The margin on the end of the content view -->
- <dimen name="notification_content_margin_end">8dp</dimen>
-
- <!-- Height of a single line notification in the status bar -->
- <dimen name="notification_single_line_height">32sp</dimen>
-
<!-- Height of a small notification in the status bar-->
<dimen name="notification_min_height">84dp</dimen>
@@ -351,8 +339,11 @@
<!-- radius of the corners of the material rounded rect background but negative-->
<dimen name="notification_material_rounded_rect_radius_negative">-2dp</dimen>
- <!-- The padding between notification children -->
- <dimen name="notification_children_padding">2dp</dimen>
+ <!-- The padding between notification children when collapsed -->
+ <dimen name="notification_children_padding">4dp</dimen>
+
+ <!-- The padding on top of the first notification to the children container -->
+ <dimen name="notification_children_container_top_padding">8dp</dimen>
<!-- The height of the divider between the notfication children -->
<dimen name="notification_children_divider_height">1dp</dimen>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 6c87cd6..666a024 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1038,8 +1038,8 @@
<!-- VolumeUI restoration notification: text -->
<string name="volumeui_notification_text">Touch to restore the original.</string>
- <!-- Describes the way 2 names are concatenated. An example would be ", " to produce "Peter Muller, Paul Curry". Please also include a space here if it's appropriate in the language and if it's a RTL language include it on the left. [CHAR LIMIT=3] -->
- <string name="group_summary_concadenation">, </string>
+ <!-- Describes the way 2 names are concatenated. An example would be ", " to produce "Peter Muller, Paul Curry". Please also include a space here if it's appropriate in the language and if it's a RTL language include it on the left. The translation should start and end with " to keep the white space if desired [CHAR LIMIT=5] -->
+ <string name="group_summary_concadenation">", "</string>
<!-- Toast shown when user unlocks screen and managed profile activity is in the foreground -->
<string name="managed_profile_foreground_toast">You\'re using your work profile</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index e7192ca..5c79c7d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -861,6 +861,9 @@
public void setChildrenExpanded(boolean expanded, boolean animate) {
mChildrenExpanded = expanded;
+ if (mNotificationHeader != null) {
+ mNotificationHeader.setExpanded(expanded);
+ }
if (mChildrenContainer != null) {
mChildrenContainer.setChildrenExpanded(expanded);
}
@@ -968,10 +971,17 @@
} else {
header.reapply(getContext(), mNotificationHeader);
}
+ updateHeaderExpandButton();
updateChildrenHeaderAppearance();
updateHeaderChildCount();
}
+ private void updateHeaderExpandButton() {
+ if (mIsSummaryWithChildren) {
+ mNotificationHeader.setIsGroupHeader(true /* isGroupHeader*/);
+ }
+ }
+
public void updateChildrenHeaderAppearance() {
if (mIsSummaryWithChildren) {
mHeaderUtil.updateChildrenHeaderAppearance();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index bb6558b1..da01d54 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -52,7 +52,6 @@
private static final int VISIBLE_TYPE_SINGLELINE = 3;
private final Rect mClipBounds = new Rect();
- private final int mSingleLineHeight;
private final int mHeadsUpHeight;
private final int mRoundRectRadius;
private final Interpolator mLinearInterpolator = new LinearInterpolator();
@@ -104,8 +103,6 @@
super(context, attrs);
mHybridViewManager = new HybridNotificationViewManager(getContext(), this);
mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
- mSingleLineHeight = getResources().getDimensionPixelSize(
- R.dimen.notification_single_line_height);
mHeadsUpHeight = getResources().getDimensionPixelSize(R.dimen.notification_mid_height);
mRoundRectRadius = getResources().getDimensionPixelSize(
R.dimen.notification_material_rounded_rect_radius);
@@ -160,9 +157,8 @@
maxChildHeight = Math.max(maxChildHeight, mHeadsUpChild.getMeasuredHeight());
}
if (mSingleLineView != null) {
- int size = Math.min(maxSize, mSingleLineHeight);
mSingleLineView.measure(widthMeasureSpec,
- MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY));
+ MeasureSpec.makeMeasureSpec(maxSize, MeasureSpec.AT_MOST));
maxChildHeight = Math.max(maxChildHeight, mSingleLineView.getMeasuredHeight());
}
int ownHeight = Math.min(maxChildHeight, maxSize);
@@ -297,7 +293,7 @@
public int getMinHeight() {
if (mIsChildInGroup && !isGroupExpanded()) {
- return mSingleLineHeight;
+ return mSingleLineView.getHeight();
} else {
return mSmallHeight;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationView.java
index 8f46e89..fafea98 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationView.java
@@ -18,21 +18,17 @@
import android.annotation.Nullable;
import android.content.Context;
-import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.TextView;
+import com.android.keyguard.AlphaOptimizedLinearLayout;
import com.android.systemui.R;
-import com.android.systemui.statusbar.AlphaOptimizedFrameLayout;
/**
* A hybrid view which may contain information about one ore more notifications.
*/
-public class HybridNotificationView extends AlphaOptimizedFrameLayout {
+public class HybridNotificationView extends AlphaOptimizedLinearLayout {
- protected final int mSingleLineHeight;
- protected final int mStartMargin;
- protected final int mEndMargin;
protected TextView mTitleView;
protected TextView mTextView;
@@ -51,62 +47,6 @@
public HybridNotificationView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- mSingleLineHeight = context.getResources().getDimensionPixelSize(
- R.dimen.notification_single_line_height);
- mStartMargin = context.getResources().getDimensionPixelSize(
- R.dimen.notification_content_margin_start);
- mEndMargin = context.getResources().getDimensionPixelSize(
- R.dimen.notification_content_margin_end);
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int totalWidth = MeasureSpec.getSize(widthMeasureSpec);
- int remainingWidth = totalWidth - mStartMargin - mEndMargin;
- int newHeightSpec = MeasureSpec.makeMeasureSpec(
- MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.AT_MOST);
- int newWidthSpec = MeasureSpec.makeMeasureSpec(remainingWidth, MeasureSpec.AT_MOST);
- mTitleView.measure(newWidthSpec, newHeightSpec);
- int maxTitleLength = getResources().getDimensionPixelSize(
- R.dimen.notification_maximum_title_length);
- int titleWidth = mTitleView.getMeasuredWidth();
- int heightSpec = MeasureSpec.makeMeasureSpec(mSingleLineHeight, MeasureSpec.AT_MOST);
- boolean hasText = !TextUtils.isEmpty(mTextView.getText());
- if (titleWidth > maxTitleLength && hasText) {
- titleWidth = maxTitleLength;
- int widthSpec = MeasureSpec.makeMeasureSpec(titleWidth, MeasureSpec.EXACTLY);
- mTitleView.measure(widthSpec, heightSpec);
- }
- if (hasText) {
- remainingWidth -= titleWidth;
- int widthSpec = MeasureSpec.makeMeasureSpec(remainingWidth, MeasureSpec.AT_MOST);
- mTextView.measure(widthSpec, newHeightSpec);
- }
- setMeasuredDimension(totalWidth, mSingleLineHeight);
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- int childLeft = mStartMargin;
- int childRight = childLeft + mTitleView.getMeasuredWidth();
- int childBottom = (mSingleLineHeight + mTitleView.getMeasuredHeight()) / 2;
- int childTop = childBottom - mTitleView.getMeasuredHeight();
- int rtlLeft = transformForRtl(childLeft);
- int rtlRight = transformForRtl(childRight);
- mTitleView.layout(Math.min(rtlLeft, rtlRight), childTop, Math.max(rtlLeft, rtlRight),
- childBottom);
- childLeft = childRight;
- childRight = childLeft + mTextView.getMeasuredWidth();
- childTop = mTitleView.getTop() + mTitleView.getBaseline() - mTextView.getBaseline();
- childBottom = childTop + mTextView.getMeasuredHeight();
- rtlLeft = transformForRtl(childLeft);
- rtlRight = transformForRtl(childRight);
- mTextView.layout(Math.min(rtlLeft, rtlRight), childTop, Math.max(rtlLeft, rtlRight),
- childBottom);
- }
-
- private int transformForRtl(int left) {
- return isLayoutRtl() ? getWidth() - left : left;
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationViewManager.java
index 987f7b8..b8adf5b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridNotificationViewManager.java
@@ -68,9 +68,9 @@
}
private CharSequence resolveText(Notification notification) {
- CharSequence contentText = notification.extras.getCharSequence(Notification.EXTRA_BIG_TEXT);
+ CharSequence contentText = notification.extras.getCharSequence(Notification.EXTRA_TEXT);
if (contentText == null) {
- contentText = notification.extras.getCharSequence(Notification.EXTRA_TEXT);
+ contentText = notification.extras.getCharSequence(Notification.EXTRA_BIG_TEXT);
}
return contentText;
}
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 77a9871..9015a0e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
@@ -46,7 +46,7 @@
private final List<ExpandableNotificationRow> mChildren = new ArrayList<>();
private final int mNotificationHeaderHeight;
private final int mNotificationAppearDistance;
- private final float mHeaderTopPaddingSubstraction;
+ private final int mNotificatonTopPadding;
private final HybridNotificationViewManager mHybridViewManager;
private final float mCollapsedBottompadding;
private boolean mChildrenExpanded;
@@ -78,28 +78,23 @@
mNotificationAppearDistance = getResources().getDimensionPixelSize(
R.dimen.notification_appear_distance);
mNotificationHeaderHeight = getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.notification_header_height);
- mHeaderTopPaddingSubstraction = 2 * getResources().getDisplayMetrics().density;
- mCollapsedBottompadding = 10 * getResources().getDisplayMetrics().density;
+ com.android.internal.R.dimen.notification_content_margin_top);
+ mNotificatonTopPadding = getResources().getDimensionPixelSize(
+ R.dimen.notification_children_container_top_padding);
+ mCollapsedBottompadding = 11.5f * getResources().getDisplayMetrics().density;
mHybridViewManager = new HybridNotificationViewManager(getContext(), this);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int childCount = mChildren.size();
- boolean firstChild = true;
for (int i = 0; i < childCount; i++) {
View child = mChildren.get(i);
- boolean viewGone = child.getVisibility() == View.GONE;
- if (viewGone) {
+ if (child.getVisibility() == View.GONE) {
continue;
}
child.layout(0, 0, getWidth(), child.getMeasuredHeight());
- if (!firstChild) {
- mDividers.get(i - 1).layout(0, 0, getWidth(), mDividerHeight);
- } else {
- firstChild = false;
- }
+ mDividers.get(i).layout(0, 0, getWidth(), mDividerHeight);
}
if (mGroupOverflowContainer != null) {
mGroupOverflowContainer.layout(0, 0, getWidth(),
@@ -119,21 +114,17 @@
}
int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST);
int dividerHeightSpec = MeasureSpec.makeMeasureSpec(mDividerHeight, MeasureSpec.EXACTLY);
- int height = mNotificationHeaderHeight;
+ int height = mNotificationHeaderHeight + mNotificatonTopPadding;
int childCount = mChildren.size();
- boolean firstChild = true;
for (int i = 0; i < childCount; i++) {
View child = mChildren.get(i);
child.measure(widthMeasureSpec, newHeightSpec);
height += child.getMeasuredHeight();
- if (!firstChild) {
- // layout the divider
- View divider = mDividers.get(i - 1);
- divider.measure(widthMeasureSpec, dividerHeightSpec);
- height += mChildPadding;
- } else {
- firstChild = false;
- }
+
+ // layout the divider
+ View divider = mDividers.get(i);
+ divider.measure(widthMeasureSpec, dividerHeightSpec);
+ height += mDividerHeight;
}
int width = MeasureSpec.getSize(widthMeasureSpec);
if (mGroupOverflowContainer != null) {
@@ -152,11 +143,11 @@
int newIndex = childIndex < 0 ? mChildren.size() : childIndex;
mChildren.add(newIndex, row);
addView(row);
- if (mChildren.size() != 1) {
- View divider = inflateDivider();
- addView(divider);
- mDividers.add(Math.max(newIndex - 1, 0), divider);
- }
+
+ View divider = inflateDivider();
+ addView(divider);
+ mDividers.add(newIndex, divider);
+
updateGroupOverflow();
}
@@ -164,10 +155,10 @@
int childIndex = mChildren.indexOf(row);
mChildren.remove(row);
removeView(row);
- if (!mDividers.isEmpty()) {
- View divider = mDividers.remove(Math.max(childIndex - 1, 0));
- removeView(divider);
- }
+
+ View divider = mDividers.remove(childIndex);
+ removeView(divider);
+
row.setSystemChildExpanded(false);
updateGroupOverflow();
}
@@ -246,7 +237,10 @@
* in @param maxAllowedVisibleChildren
*/
private int getIntrinsicHeight(float maxAllowedVisibleChildren) {
- int intrinsicHeight = mNotificationHeaderHeight;;
+ int intrinsicHeight = mNotificationHeaderHeight;
+ if (mChildrenExpanded) {
+ intrinsicHeight += mNotificatonTopPadding;
+ }
int visibleChildren = 0;
int childCount = mChildren.size();
for (int i = 0; i < childCount; i++) {
@@ -254,14 +248,15 @@
break;
}
ExpandableNotificationRow child = mChildren.get(i);
- if (i == 0 && child.hasSameBgColor(mNotificationParent)) {
- intrinsicHeight -= mHeaderTopPaddingSubstraction;
- }
intrinsicHeight += child.getIntrinsicHeight();
visibleChildren++;
}
if (visibleChildren > 0) {
- intrinsicHeight += (visibleChildren - 1) * mDividerHeight;
+ if (mChildrenExpanded) {
+ intrinsicHeight += visibleChildren * mDividerHeight;
+ } else {
+ intrinsicHeight += (visibleChildren - 1) * mChildPadding;
+ }
}
if (!mChildrenExpanded) {
intrinsicHeight += mCollapsedBottompadding;
@@ -288,12 +283,9 @@
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
if (!firstChild) {
- // There's a divider
- yPosition += mChildPadding;
+ yPosition += mChildrenExpanded ? mDividerHeight : mChildPadding;
} else {
- if (child.hasSameBgColor(mNotificationParent)) {
- yPosition -= mHeaderTopPaddingSubstraction;
- }
+ yPosition += mChildrenExpanded ? mNotificatonTopPadding + mDividerHeight : 0;
firstChild = false;
}
StackViewState childState = resultState.getViewStateForView(child);
@@ -340,23 +332,18 @@
public void applyState(StackScrollState state) {
int childCount = mChildren.size();
- boolean firstChild = true;
ViewState tmpState = new ViewState();
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
StackViewState viewState = state.getViewStateForView(child);
- if (!firstChild) {
- // layout the divider
- View divider = mDividers.get(i - 1);
- tmpState.initFrom(divider);
- tmpState.yTranslation = (int) (viewState.yTranslation
- - (mChildPadding + mDividerHeight) / 2.0f);
- tmpState.alpha = mChildrenExpanded && viewState.alpha != 0 ? 0.5f : 0;
- state.applyViewState(divider, tmpState);
- } else {
- firstChild = false;
- }
state.applyState(child, viewState);
+
+ // layout the divider
+ View divider = mDividers.get(i);
+ tmpState.initFrom(divider);
+ tmpState.yTranslation = viewState.yTranslation - mDividerHeight;
+ tmpState.alpha = mChildrenExpanded && viewState.alpha != 0 ? 0.5f : 0;
+ state.applyViewState(divider, tmpState);
}
if (mGroupOverflowContainer != null) {
state.applyViewState(mGroupOverflowContainer, mGroupOverFlowState);
@@ -375,34 +362,30 @@
return;
}
int childCount = mChildren.size();
- boolean firstChild = true;
StackViewState sourceState = new StackViewState();
ViewState dividerState = new ViewState();
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
StackViewState viewState = state.getViewStateForView(child);
- if (!firstChild) {
- // layout the divider
- View divider = mDividers.get(i - 1);
- dividerState.initFrom(divider);
- dividerState.yTranslation = viewState.yTranslation
- - (mChildPadding + mDividerHeight) / 2.0f + mNotificationAppearDistance;
- dividerState.alpha = 0;
- state.applyViewState(divider, dividerState);
- } else {
- firstChild = false;
- }
sourceState.copyFrom(viewState);
sourceState.alpha = 0;
sourceState.yTranslation += mNotificationAppearDistance;
state.applyState(child, sourceState);
+
+ // layout the divider
+ View divider = mDividers.get(i);
+ dividerState.initFrom(divider);
+ dividerState.yTranslation = viewState.yTranslation - mDividerHeight
+ + mNotificationAppearDistance;
+ dividerState.alpha = 0;
+ state.applyViewState(divider, dividerState);
+
}
}
public void startAnimationToState(StackScrollState state, StackStateAnimator stateAnimator,
boolean withDelays, long baseDelay, long duration) {
int childCount = mChildren.size();
- boolean firstChild = true;
ViewState tmpState = new ViewState();
int notGoneIndex = 0;
for (int i = 0; i < childCount; i++) {
@@ -414,18 +397,15 @@
? difference * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_EXPAND_CHILDREN
: 0;
delay += baseDelay;
- if (!firstChild) {
- // layout the divider
- View divider = mDividers.get(i - 1);
- tmpState.initFrom(divider);
- tmpState.yTranslation = viewState.yTranslation
- - (mChildPadding + mDividerHeight) / 2.0f;
- tmpState.alpha = mChildrenExpanded && viewState.alpha != 0 ? 0.5f : 0;;
- stateAnimator.startViewAnimations(divider, tmpState, delay, duration);
- } else {
- firstChild = false;
- }
stateAnimator.startStackAnimations(child, viewState, state, -1, delay);
+
+ // layout the divider
+ View divider = mDividers.get(i);
+ tmpState.initFrom(divider);
+ tmpState.yTranslation = viewState.yTranslation - mDividerHeight;
+ tmpState.alpha = mChildrenExpanded && viewState.alpha != 0 ? 0.5f : 0;
+ stateAnimator.startViewAnimations(divider, tmpState, delay, duration);
+
notGoneIndex++;
}
if (mGroupOverflowContainer != null) {