diff options
| author | Selim Cinek <cinek@google.com> | 2017-12-12 17:32:44 -0800 |
|---|---|---|
| committer | Selim Cinek <cinek@google.com> | 2018-01-10 20:14:03 +0000 |
| commit | afeed29bdc80bd4c7542e1177e418a3bfb6682d8 (patch) | |
| tree | f53f53a6b283339d3d5916518d44e21c3f624688 | |
| parent | cb8b985e5b14013ef903c8cd77c272e305b68633 (diff) | |
Changing messaging style and overall visual adoption
The messaging style is changed to a bubble-less design.
In addition are we also updating a few spacings in
order for it to look nicer / more balanced.
Test: manual
Change-Id: I43326bd8a23cd1f1d5964d2d6740fde99d29c7e4
15 files changed, 156 insertions, 179 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 76aa5f46ead6..6004a83b9dcf 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -3981,7 +3981,10 @@ public class Notification implements Parcelable contentView.setViewVisibility(R.id.chronometer, View.GONE); contentView.setViewVisibility(R.id.header_text, View.GONE); contentView.setTextViewText(R.id.header_text, null); + contentView.setViewVisibility(R.id.header_text_secondary, View.GONE); + contentView.setTextViewText(R.id.header_text_secondary, null); contentView.setViewVisibility(R.id.header_text_divider, View.GONE); + contentView.setViewVisibility(R.id.header_text_secondary_divider, View.GONE); contentView.setViewVisibility(R.id.time_divider, View.GONE); contentView.setViewVisibility(R.id.time, View.GONE); contentView.setImageViewIcon(R.id.profile_badge, null); @@ -4012,7 +4015,7 @@ public class Notification implements Parcelable final Bundle ex = mN.extras; updateBackgroundColor(contentView); - bindNotificationHeader(contentView, p.ambient); + bindNotificationHeader(contentView, p.ambient, p.headerTextSecondary); bindLargeIcon(contentView, p.hideLargeIcon, p.alwaysShowReply); boolean showProgress = handleProgressBar(p.hasProgress, contentView, ex); if (p.title != null) { @@ -4295,12 +4298,14 @@ public class Notification implements Parcelable return null; } - private void bindNotificationHeader(RemoteViews contentView, boolean ambient) { + private void bindNotificationHeader(RemoteViews contentView, boolean ambient, + CharSequence secondaryHeaderText) { bindSmallIcon(contentView, ambient); bindHeaderAppName(contentView, ambient); if (!ambient) { // Ambient view does not have these bindHeaderText(contentView); + bindHeaderTextSecondary(contentView, secondaryHeaderText); bindHeaderChronometerAndTime(contentView); bindProfileBadge(contentView); } @@ -4369,6 +4374,17 @@ public class Notification implements Parcelable } } + private void bindHeaderTextSecondary(RemoteViews contentView, CharSequence secondaryText) { + if (!TextUtils.isEmpty(secondaryText)) { + contentView.setTextViewText(R.id.header_text_secondary, processTextSpans( + processLegacyText(secondaryText))); + setTextViewColorSecondary(contentView, R.id.header_text_secondary); + contentView.setViewVisibility(R.id.header_text_secondary, View.VISIBLE); + contentView.setViewVisibility(R.id.header_text_secondary_divider, View.VISIBLE); + setTextViewColorSecondary(contentView, R.id.header_text_secondary_divider); + } + } + /** * @hide */ @@ -4602,7 +4618,7 @@ public class Notification implements Parcelable ambient ? R.layout.notification_template_ambient_header : R.layout.notification_template_header); resetNotificationHeader(header); - bindNotificationHeader(header, ambient); + bindNotificationHeader(header, ambient, null); if (colorized != null) { mN.extras.putBoolean(EXTRA_COLORIZED, colorized); } else { @@ -6269,7 +6285,7 @@ public class Notification implements Parcelable public RemoteViews makeContentView(boolean increasedHeight) { mBuilder.mOriginalActions = mBuilder.mActions; mBuilder.mActions = new ArrayList<>(); - RemoteViews remoteViews = makeBigContentView(); + RemoteViews remoteViews = makeBigContentView(true /* showRightIcon */); mBuilder.mActions = mBuilder.mOriginalActions; mBuilder.mOriginalActions = null; return remoteViews; @@ -6304,23 +6320,31 @@ public class Notification implements Parcelable */ @Override public RemoteViews makeBigContentView() { + return makeBigContentView(false /* showRightIcon */); + } + + @NonNull + private RemoteViews makeBigContentView(boolean showRightIcon) { CharSequence conversationTitle = !TextUtils.isEmpty(super.mBigContentTitle) ? super.mBigContentTitle : mConversationTitle; boolean isOneToOne = TextUtils.isEmpty(conversationTitle); - if (isOneToOne) { - // Let's add the conversationTitle in case we didn't have one before and all - // messages are from the same sender - conversationTitle = createConversationTitleFromMessages(); - } else if (hasOnlyWhiteSpaceSenders()) { + if (hasOnlyWhiteSpaceSenders()) { isOneToOne = true; } - boolean hasTitle = !TextUtils.isEmpty(conversationTitle); RemoteViews contentView = mBuilder.applyStandardTemplateWithActions( mBuilder.getMessagingLayoutResource(), mBuilder.mParams.reset().hasProgress(false).title(conversationTitle).text(null) - .hideLargeIcon(isOneToOne).alwaysShowReply(true)); + .hideLargeIcon(!showRightIcon || isOneToOne) + .headerTextSecondary(conversationTitle) + .alwaysShowReply(showRightIcon)); addExtras(mBuilder.mN.extras); + // also update the end margin if there is an image + int endMargin = R.dimen.notification_content_margin_end; + if (mBuilder.mN.hasLargeIcon() && showRightIcon) { + endMargin = R.dimen.notification_content_plus_picture_margin_end; + } + contentView.setViewLayoutMarginEndDimen(R.id.notification_main_column, endMargin); contentView.setInt(R.id.status_bar_latest_event_content, "setLayoutColor", mBuilder.resolveContrastColor()); contentView.setIcon(R.id.status_bar_latest_event_content, "setLargeIcon", @@ -6387,7 +6411,7 @@ public class Notification implements Parcelable */ @Override public RemoteViews makeHeadsUpContentView(boolean increasedHeight) { - RemoteViews remoteViews = makeBigContentView(); + RemoteViews remoteViews = makeBigContentView(true /* showRightIcon */); remoteViews.setInt(R.id.notification_messaging, "setMaxDisplayedLines", 1); return remoteViews; } @@ -8854,6 +8878,7 @@ public class Notification implements Parcelable boolean ambient = false; CharSequence title; CharSequence text; + CharSequence headerTextSecondary; boolean hideLargeIcon; public boolean alwaysShowReply; @@ -8862,6 +8887,7 @@ public class Notification implements Parcelable ambient = false; title = null; text = null; + headerTextSecondary = null; return this; } @@ -8880,6 +8906,11 @@ public class Notification implements Parcelable return this; } + final StandardTemplateParams headerTextSecondary(CharSequence text) { + this.headerTextSecondary = text; + return this; + } + final StandardTemplateParams alwaysShowReply(boolean alwaysShowReply) { this.alwaysShowReply = alwaysShowReply; return this; diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index ab0b3eec8753..fbba8abff304 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -47,6 +47,7 @@ public class NotificationHeaderView extends ViewGroup { private final int mGravity; private View mAppName; private View mHeaderText; + private View mSecondaryHeaderText; private OnClickListener mExpandClickListener; private HeaderTouchListener mTouchListener = new HeaderTouchListener(); private ImageView mExpandButton; @@ -58,7 +59,6 @@ public class NotificationHeaderView extends ViewGroup { private boolean mShowExpandButtonAtEnd; private boolean mShowWorkBadgeAtEnd; private Drawable mBackground; - private int mHeaderBackgroundHeight; private boolean mEntireHeaderClickable; private boolean mExpandOnlyOnButton; private boolean mAcceptAllTouches; @@ -68,7 +68,7 @@ public class NotificationHeaderView extends ViewGroup { @Override public void getOutline(View view, Outline outline) { if (mBackground != null) { - outline.setRect(0, 0, getWidth(), mHeaderBackgroundHeight); + outline.setRect(0, 0, getWidth(), getHeight()); outline.setAlpha(1f); } } @@ -91,8 +91,6 @@ public class NotificationHeaderView extends ViewGroup { Resources res = getResources(); mChildMinWidth = res.getDimensionPixelSize(R.dimen.notification_header_shrink_min_width); mContentEndMargin = res.getDimensionPixelSize(R.dimen.notification_content_margin_end); - mHeaderBackgroundHeight = res.getDimensionPixelSize( - R.dimen.notification_header_background_height); mEntireHeaderClickable = res.getBoolean(R.bool.config_notificationHeaderClickableForExpand); int[] attrIds = { android.R.attr.gravity }; @@ -106,6 +104,7 @@ public class NotificationHeaderView extends ViewGroup { super.onFinishInflate(); mAppName = findViewById(com.android.internal.R.id.app_name_text); mHeaderText = findViewById(com.android.internal.R.id.header_text); + mSecondaryHeaderText = findViewById(com.android.internal.R.id.header_text_secondary); mExpandButton = findViewById(com.android.internal.R.id.expand_button); mIcon = findViewById(com.android.internal.R.id.icon); mProfileBadge = findViewById(com.android.internal.R.id.profile_badge); @@ -137,26 +136,33 @@ public class NotificationHeaderView extends ViewGroup { if (totalWidth > givenWidth) { int overFlow = totalWidth - givenWidth; // We are overflowing, lets shrink the app name first - final int appWidth = mAppName.getMeasuredWidth(); - if (overFlow > 0 && mAppName.getVisibility() != GONE && appWidth > mChildMinWidth) { - int newSize = appWidth - Math.min(appWidth - mChildMinWidth, overFlow); - int childWidthSpec = MeasureSpec.makeMeasureSpec(newSize, MeasureSpec.AT_MOST); - mAppName.measure(childWidthSpec, wrapContentHeightSpec); - overFlow -= appWidth - newSize; - } - // still overflowing, finaly we shrink the header text - if (overFlow > 0 && mHeaderText.getVisibility() != GONE) { - // we're still too big - final int textWidth = mHeaderText.getMeasuredWidth(); - int newSize = Math.max(0, textWidth - overFlow); - int childWidthSpec = MeasureSpec.makeMeasureSpec(newSize, MeasureSpec.AT_MOST); - mHeaderText.measure(childWidthSpec, wrapContentHeightSpec); - } + overFlow = shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mAppName, + mChildMinWidth); + + // still overflowing, we shrink the header text + overFlow = shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mHeaderText, 0); + + // still overflowing, finally we shrink the secondary header text + shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mSecondaryHeaderText, + 0); } mTotalWidth = Math.min(totalWidth, givenWidth); setMeasuredDimension(givenWidth, givenHeight); } + private int shrinkViewForOverflow(int heightSpec, int overFlow, View targetView, + int minimumWidth) { + final int oldWidth = targetView.getMeasuredWidth(); + if (overFlow > 0 && targetView.getVisibility() != GONE && oldWidth > minimumWidth) { + // we're still too big + int newSize = Math.max(minimumWidth, oldWidth - overFlow); + int childWidthSpec = MeasureSpec.makeMeasureSpec(newSize, MeasureSpec.AT_MOST); + targetView.measure(childWidthSpec, heightSpec); + overFlow -= oldWidth - newSize; + } + return overFlow; + } + @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { int left = getPaddingStart(); @@ -228,7 +234,7 @@ public class NotificationHeaderView extends ViewGroup { @Override protected void onDraw(Canvas canvas) { if (mBackground != null) { - mBackground.setBounds(0, 0, getWidth(), mHeaderBackgroundHeight); + mBackground.setBounds(0, 0, getWidth(), getHeight()); mBackground.draw(canvas); } } diff --git a/core/java/com/android/internal/widget/MessagingGroup.java b/core/java/com/android/internal/widget/MessagingGroup.java index 792f9212d93e..20f05e61687f 100644 --- a/core/java/com/android/internal/widget/MessagingGroup.java +++ b/core/java/com/android/internal/widget/MessagingGroup.java @@ -20,17 +20,12 @@ import android.annotation.AttrRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StyleRes; +import android.app.Notification; import android.content.Context; -import android.graphics.Color; -import android.graphics.ColorFilter; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffColorFilter; -import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Pools; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -41,7 +36,6 @@ import android.widget.LinearLayout; import android.widget.RemoteViews; import com.android.internal.R; -import com.android.internal.util.NotificationColorUtil; import java.util.ArrayList; import java.util.List; @@ -60,12 +54,12 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou private int mLayoutColor; private CharSequence mAvatarName = ""; private Icon mAvatarIcon; - private ColorFilter mMessageBackgroundFilter; private int mTextColor; private List<MessagingMessage> mMessages; private ArrayList<MessagingMessage> mAddedMessages = new ArrayList<>(); private boolean mFirstLayout; private boolean mIsHidingAnimated; + private boolean mNeedsGeneratedAvatar; public MessagingGroup(@NonNull Context context) { super(context); @@ -94,27 +88,19 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou mAvatarView = findViewById(R.id.message_icon); } - public void setSender(CharSequence sender) { - if (sender == null) { - mAvatarView.setVisibility(GONE); - mSenderName.setVisibility(GONE); - setGravity(Gravity.END); - mMessageBackgroundFilter = new PorterDuffColorFilter(mLayoutColor, - PorterDuff.Mode.SRC_ATOP); - mTextColor = NotificationColorUtil.isColorLight(mLayoutColor) ? getNormalTextColor() - : Color.WHITE; - } else { - mSenderName.setText(sender); - mAvatarView.setVisibility(VISIBLE); - mSenderName.setVisibility(VISIBLE); - setGravity(Gravity.START); - mMessageBackgroundFilter = null; - mTextColor = getNormalTextColor(); + public void setSender(Notification.Person sender) { + mSenderName.setText(sender.getName()); + mNeedsGeneratedAvatar = sender.getIcon() == null; + if (!mNeedsGeneratedAvatar) { + setAvatar(sender.getIcon()); } + mAvatarView.setVisibility(VISIBLE); + mSenderName.setVisibility(VISIBLE); + mTextColor = getNormalTextColor(); } private int getNormalTextColor() { - return mContext.getColor(R.color.notification_primary_text_color_light); + return mContext.getColor(R.color.notification_secondary_text_color_light); } public void setAvatar(Icon icon) { @@ -207,10 +193,6 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou return mSenderName.getText(); } - public void setSenderVisible(boolean visible) { - mSenderName.setVisibility(visible ? VISIBLE : GONE); - } - public static void dropCache() { sInstancePool = new Pools.SynchronizedPool<>(10); } @@ -317,12 +299,6 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou mMessageContainer.removeView(message); mMessageContainer.addView(message, messageIndex); } - // Let's make sure the message color is correct - Drawable targetDrawable = message.getBackground(); - - if (targetDrawable != null) { - targetDrawable.mutate().setColorFilter(mMessageBackgroundFilter); - } message.setTextColor(mTextColor); } mMessages = group; @@ -390,4 +366,8 @@ public class MessagingGroup extends LinearLayout implements MessagingLinearLayou public MessagingLinearLayout getMessageContainer() { return mMessageContainer; } + + public boolean needsGeneratedAvatar() { + return mNeedsGeneratedAvatar; + } } diff --git a/core/java/com/android/internal/widget/MessagingLayout.java b/core/java/com/android/internal/widget/MessagingLayout.java index a01953af88fa..834c93a7a98f 100644 --- a/core/java/com/android/internal/widget/MessagingLayout.java +++ b/core/java/com/android/internal/widget/MessagingLayout.java @@ -69,7 +69,6 @@ public class MessagingLayout extends FrameLayout { private List<MessagingMessage> mMessages = new ArrayList<>(); private List<MessagingMessage> mHistoricMessages = new ArrayList<>(); private MessagingLinearLayout mMessagingLinearLayout; - private View mContractedMessage; private boolean mShowHistoricMessages; private ArrayList<MessagingGroup> mGroups = new ArrayList<>(); private TextView mTitleView; @@ -81,6 +80,7 @@ public class MessagingLayout extends FrameLayout { private Icon mLargeIcon; private boolean mIsOneToOne; private ArrayList<MessagingGroup> mAddedGroups = new ArrayList<>(); + private Notification.Person mUser; public MessagingLayout(@NonNull Context context) { super(context); @@ -129,6 +129,7 @@ public class MessagingLayout extends FrameLayout { Parcelable[] histMessages = extras.getParcelableArray(Notification.EXTRA_HISTORIC_MESSAGES); List<Notification.MessagingStyle.Message> newHistoricMessages = Notification.MessagingStyle.Message.getMessagesFromBundleArray(histMessages); + setUser(extras.getParcelable(Notification.EXTRA_MESSAGING_PERSON)); mConversationTitle = null; TextView headerText = findViewById(R.id.header_text); if (headerText != null) { @@ -152,7 +153,6 @@ public class MessagingLayout extends FrameLayout { mMessages = messages; mHistoricMessages = historicMessages; - updateContractedMessage(); updateHistoricMessageVisibility(); updateTitleAndNamesDisplay(); } @@ -163,12 +163,10 @@ public class MessagingLayout extends FrameLayout { for (int i = 0; i < mGroups.size(); i++) { MessagingGroup group = mGroups.get(i); CharSequence senderName = group.getSenderName(); - if (TextUtils.isEmpty(senderName)) { + if (!group.needsGeneratedAvatar() || TextUtils.isEmpty(senderName)) { continue; } - boolean visible = !mIsOneToOne; - group.setSenderVisible(visible); - if ((visible || mLargeIcon == null) && !uniqueNames.containsKey(senderName)) { + if (!uniqueNames.containsKey(senderName)) { char c = senderName.charAt(0); if (uniqueCharacters.containsKey(c)) { // this character was already used, lets make it more unique. We first need to @@ -192,7 +190,8 @@ public class MessagingLayout extends FrameLayout { // Let's now set the avatars MessagingGroup group = mGroups.get(i); CharSequence senderName = group.getSenderName(); - if (TextUtils.isEmpty(senderName) || (mIsOneToOne && mLargeIcon != null)) { + if (!group.needsGeneratedAvatar() || TextUtils.isEmpty(senderName) + || (mIsOneToOne && mLargeIcon != null)) { continue; } String symbol = uniqueNames.get(senderName); @@ -207,7 +206,7 @@ public class MessagingLayout extends FrameLayout { // Let's now set the avatars MessagingGroup group = mGroups.get(i); CharSequence senderName = group.getSenderName(); - if (TextUtils.isEmpty(senderName)) { + if (!group.needsGeneratedAvatar() || TextUtils.isEmpty(senderName)) { continue; } if (mIsOneToOne && mLargeIcon != null) { @@ -234,7 +233,7 @@ public class MessagingLayout extends FrameLayout { canvas.drawCircle(radius, radius, radius, mPaint); boolean needDarkText = ColorUtils.calculateLuminance(color) > 0.5f; mTextPaint.setColor(needDarkText ? Color.BLACK : Color.WHITE); - mTextPaint.setTextSize(symbol.length() == 1 ? mAvatarSize * 0.75f : mAvatarSize * 0.4f); + mTextPaint.setTextSize(symbol.length() == 1 ? mAvatarSize * 0.5f : mAvatarSize * 0.3f); int yPos = (int) (radius - ((mTextPaint.descent() + mTextPaint.ascent()) / 2)) ; canvas.drawText(symbol, radius, yPos, mTextPaint); return Icon.createWithBitmap(bitmap); @@ -270,11 +269,15 @@ public class MessagingLayout extends FrameLayout { mIsOneToOne = oneToOne; } + public void setUser(Notification.Person user) { + mUser = user; + } + private void addMessagesToGroups(List<MessagingMessage> historicMessages, List<MessagingMessage> messages) { // Let's first find our groups! List<List<MessagingMessage>> groups = new ArrayList<>(); - List<CharSequence> senders = new ArrayList<>(); + List<Notification.Person> senders = new ArrayList<>(); // Lets first find the groups findGroups(historicMessages, messages, groups, senders); @@ -283,7 +286,8 @@ public class MessagingLayout extends FrameLayout { createGroupViews(groups, senders); } - private void createGroupViews(List<List<MessagingMessage>> groups, List<CharSequence> senders) { + private void createGroupViews(List<List<MessagingMessage>> groups, + List<Notification.Person> senders) { mGroups.clear(); for (int groupIndex = 0; groupIndex < groups.size(); groupIndex++) { List<MessagingMessage> group = groups.get(groupIndex); @@ -314,7 +318,7 @@ public class MessagingLayout extends FrameLayout { private void findGroups(List<MessagingMessage> historicMessages, List<MessagingMessage> messages, List<List<MessagingMessage>> groups, - List<CharSequence> senders) { + List<Notification.Person> senders) { CharSequence currentSenderKey = null; List<MessagingMessage> currentGroup = null; int histSize = historicMessages.size(); @@ -327,35 +331,22 @@ public class MessagingLayout extends FrameLayout { } boolean isNewGroup = currentGroup == null; Notification.Person sender = message.getMessage().getSenderPerson(); - CharSequence key = sender.getKey() == null ? sender.getName() : sender.getKey(); + CharSequence key = sender == null ? null + : sender.getKey() == null ? sender.getName() : sender.getKey(); isNewGroup |= !TextUtils.equals(key, currentSenderKey); if (isNewGroup) { currentGroup = new ArrayList<>(); groups.add(currentGroup); - senders.add(sender.getName()); + if (sender == null) { + sender = mUser; + } + senders.add(sender); currentSenderKey = key; } currentGroup.add(message); } } - private void updateContractedMessage() { - for (int i = mMessages.size() - 1; i >= 0; i--) { - MessagingMessage m = mMessages.get(i); - // Incoming messages have a non-empty sender. - if (!TextUtils.isEmpty(m.getMessage().getSender())) { - mContractedMessage = m; - return; - } - } - if (!mMessages.isEmpty()) { - // No incoming messages, fall back to outgoing message - mContractedMessage = mMessages.get(mMessages.size() - 1); - return; - } - mContractedMessage = null; - } - /** * Creates new messages, reusing existing ones if they are available. * @@ -431,10 +422,6 @@ public class MessagingLayout extends FrameLayout { } } - public View getContractedMessage() { - return mContractedMessage; - } - public MessagingLinearLayout getMessagingLinearLayout() { return mMessagingLinearLayout; } diff --git a/core/res/res/drawable/messaging_message_background.xml b/core/res/res/drawable/messaging_message_background.xml deleted file mode 100644 index 8a2096a62473..000000000000 --- a/core/res/res/drawable/messaging_message_background.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2017 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 - --> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle" - android:tint="#14000000"> - <corners android:radius="4dp" /> - <padding android:bottom="6dp" - android:left="8dp" - android:right="8dp" - android:top="6dp" /> -</shape> diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml index 3a28f4d76f7c..20bdf3fe8fa3 100644 --- a/core/res/res/layout/notification_template_header.xml +++ b/core/res/res/layout/notification_template_header.xml @@ -41,6 +41,24 @@ android:singleLine="true" /> <TextView + android:id="@+id/header_text_secondary_divider" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?attr/notificationHeaderTextAppearance" + android:layout_marginStart="@dimen/notification_header_separating_margin" + android:layout_marginEnd="@dimen/notification_header_separating_margin" + android:text="@string/notification_header_divider_symbol" + android:visibility="gone"/> + <TextView + android:id="@+id/header_text_secondary" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?attr/notificationHeaderTextAppearance" + android:layout_marginStart="@dimen/notification_header_separating_margin" + android:layout_marginEnd="@dimen/notification_header_separating_margin" + android:visibility="gone" + android:singleLine="true"/> + <TextView android:id="@+id/header_text_divider" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/core/res/res/layout/notification_template_material_messaging.xml b/core/res/res/layout/notification_template_material_messaging.xml index f72230be0833..a72ad538a85c 100644 --- a/core/res/res/layout/notification_template_material_messaging.xml +++ b/core/res/res/layout/notification_template_material_messaging.xml @@ -21,10 +21,7 @@ android:layout_height="wrap_content" android:tag="messaging" > - <include layout="@layout/notification_template_header" - android:layout_width="wrap_content" - android:layout_height="@dimen/notification_header_height" - android:layout_marginEnd="56dp"/> + <include layout="@layout/notification_template_header"/> <LinearLayout android:id="@+id/notification_action_list_margin_target" android:layout_width="match_parent" @@ -39,28 +36,19 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" - android:paddingStart="@dimen/notification_content_margin_start" - android:paddingEnd="@dimen/notification_content_margin_end" + android:layout_marginStart="@dimen/notification_content_margin_start" + android:layout_marginEnd="@dimen/notification_content_margin_end" android:minHeight="@dimen/notification_min_content_height" android:layout_marginBottom="@dimen/notification_content_margin_bottom" android:orientation="vertical" > - <include layout="@layout/notification_template_part_line1" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - <com.android.internal.widget.MessagingLinearLayout android:id="@+id/notification_messaging" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="8dp" android:spacing="@dimen/notification_messaging_spacing" /> </LinearLayout> </LinearLayout> <include layout="@layout/notification_material_action_list" /> - <include layout="@layout/notification_template_right_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="18dp" - android:layout_gravity="top|end"/> + <include layout="@layout/notification_template_right_icon"/> </com.android.internal.widget.MessagingLayout> diff --git a/core/res/res/layout/notification_template_messaging_group.xml b/core/res/res/layout/notification_template_messaging_group.xml index 8973ceb5c3a1..4ac308a60d93 100644 --- a/core/res/res/layout/notification_template_messaging_group.xml +++ b/core/res/res/layout/notification_template_messaging_group.xml @@ -24,7 +24,7 @@ android:id="@+id/message_icon" android:layout_width="@dimen/messaging_avatar_size" android:layout_height="@dimen/messaging_avatar_size" - android:layout_marginEnd="8dp" + android:layout_marginEnd="12dp" android:scaleType="centerCrop" android:importantForAccessibility="no" /> <com.android.internal.widget.RemeasuringLinearLayout @@ -32,19 +32,16 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> + <com.android.internal.widget.ImageFloatingTextView + android:id="@+id/message_name" + style="@style/Widget.Material.Notification.MessagingName" + android:layout_width="wrap_content" + /> <com.android.internal.widget.MessagingLinearLayout android:id="@+id/group_message_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:spacing="2dp" android:layout_weight="1"/> - <com.android.internal.widget.ImageFloatingTextView - android:id="@+id/message_name" - style="@style/Widget.Material.Notification.MessagingName" - android:layout_width="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:paddingTop="2dp" - /> </com.android.internal.widget.RemeasuringLinearLayout> </com.android.internal.widget.MessagingGroup> diff --git a/core/res/res/layout/notification_template_right_icon.xml b/core/res/res/layout/notification_template_right_icon.xml index 8fb28877a81f..0b97e45b8eed 100644 --- a/core/res/res/layout/notification_template_right_icon.xml +++ b/core/res/res/layout/notification_template_right_icon.xml @@ -19,7 +19,7 @@ android:id="@+id/right_icon_container" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="36dp" + android:layout_marginTop="@dimen/notification_content_margin_top" android:layout_gravity="top|end"> <ImageView android:id="@+id/right_icon" android:layout_width="@dimen/notification_right_icon_size" @@ -32,8 +32,8 @@ android:layout_width="16dp" android:layout_height="16dp" android:layout_gravity="top|end" - android:layout_marginTop="28dp" - android:layout_marginEnd="12dp" + android:layout_marginTop="27dp" + android:layout_marginEnd="16dp" android:background="@drawable/notification_reply_background" android:src="@drawable/ic_reply_notification" android:scaleType="center" diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index a659b370560f..b5fb935a0d1c 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -175,10 +175,10 @@ <dimen name="notification_action_list_height">56dp</dimen> <!-- height of the content margin to accomodate for the header --> - <dimen name="notification_content_margin_top">41.5dp</dimen> + <dimen name="notification_content_margin_top">46dp</dimen> <!-- height of the content margin on the bottom --> - <dimen name="notification_content_margin_bottom">18dp</dimen> + <dimen name="notification_content_margin_bottom">20dp</dimen> <!-- The height of the progress bar. --> <dimen name="notification_progress_bar_height">15dp</dimen> @@ -187,19 +187,19 @@ <dimen name="notification_progress_margin_top">8dp</dimen> <!-- height of the notification header (for icon and package name) --> - <dimen name="notification_header_height">54dp</dimen> + <dimen name="notification_header_height">50dp</dimen> <!-- The height of the background for a notification header on a group --> <dimen name="notification_header_background_height">49.5dp</dimen> <!-- The top padding for the notification header --> - <dimen name="notification_header_padding_top">14dp</dimen> + <dimen name="notification_header_padding_top">16dp</dimen> <!-- The bottom padding for the notification header --> - <dimen name="notification_header_padding_bottom">13dp</dimen> + <dimen name="notification_header_padding_bottom">16dp</dimen> <!-- The margin at the bottom of the notification header. --> - <dimen name="notification_header_margin_bottom">5dp</dimen> + <dimen name="notification_header_margin_bottom">0dp</dimen> <!-- The end margin after the application icon in the notification header --> <dimen name="notification_header_icon_margin_end">3dp</dimen> @@ -250,7 +250,7 @@ <dimen name="media_notification_expanded_image_margin_bottom">20dp</dimen> <!-- The absolute height for the header in a media notification. --> - <dimen name="media_notification_header_height">53dp</dimen> + <dimen name="media_notification_header_height">@dimen/notification_header_height</dimen> <!-- The margin of the content to an image--> <dimen name="notification_content_image_margin_end">8dp</dimen> @@ -590,7 +590,7 @@ <!-- The maximum width of a image in a media notification. The images will be reduced to that width in case they are bigger.--> <dimen name="notification_media_image_max_width">280dp</dimen> <!-- The size of the right icon --> - <dimen name="notification_right_icon_size">40dp</dimen> + <dimen name="notification_right_icon_size">38dp</dimen> <!-- The maximum height of any image in a remote view. This is applied to all images in custom remoteviews. --> <dimen name="notification_custom_view_max_image_height_low_ram">208dp</dimen> @@ -607,7 +607,7 @@ <!-- The size of the right icon image when on low ram --> <dimen name="notification_right_icon_size_low_ram">40dp</dimen> - <dimen name="messaging_avatar_size">24dp</dimen> + <dimen name="messaging_avatar_size">@dimen/notification_right_icon_size</dimen> <!-- Max width/height of the autofill data set picker as a fraction of the screen width/height --> <dimen name="autofill_dataset_picker_max_size">90%</dimen> diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index def650a579ca..fa3cf2f48dae 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -502,20 +502,17 @@ please see styles_device_defaults.xml. <style name="Widget.Material.Notification.ProgressBar" parent="Widget.Material.Light.ProgressBar.Horizontal" /> <style name="Widget.Material.Notification.MessagingText" parent="Widget.Material.Light.TextView"> - <item name="layout_width">match_parent</item> + <item name="layout_width">wrap_content</item> <item name="layout_height">wrap_content</item> <item name="ellipsize">end</item> <item name="textAppearance">@style/TextAppearance.Material.Notification</item> - <item name="background">@drawable/messaging_message_background</item> </style> <style name="Widget.Material.Notification.MessagingName" parent="Widget.Material.Light.TextView"> <item name="layout_width">wrap_content</item> <item name="layout_height">wrap_content</item> <item name="ellipsize">end</item> - <item name="textAppearance">@style/TextAppearance.Material.Notification</item> - <item name="textColor">@color/notification_primary_text_color_light</item> - <item name="textSize">12sp</item> + <item name="textAppearance">@style/TextAppearance.Material.Notification.Title</item> </style> <!-- Widget Styles --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 7f714460992e..ab637c54b65c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2599,10 +2599,12 @@ <java-symbol type="string" name="notification_hidden_text" /> <java-symbol type="id" name="app_name_text" /> <java-symbol type="id" name="header_text" /> + <java-symbol type="id" name="header_text_secondary" /> <java-symbol type="id" name="expand_button" /> <java-symbol type="id" name="notification_header" /> <java-symbol type="id" name="time_divider" /> <java-symbol type="id" name="header_text_divider" /> + <java-symbol type="id" name="header_text_secondary_divider" /> <java-symbol type="id" name="text_line_1" /> <java-symbol type="drawable" name="ic_expand_notification" /> <java-symbol type="drawable" name="ic_collapse_notification" /> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 0715d491debd..d4de816f318e 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -72,10 +72,10 @@ <dimen name="status_bar_connected_device_bt_indicator_size">17dp</dimen> <!-- Height of a small notification in the status bar--> - <dimen name="notification_min_height">100dp</dimen> + <dimen name="notification_min_height">106dp</dimen> <!-- Increased height of a small notification in the status bar --> - <dimen name="notification_min_height_increased">140dp</dimen> + <dimen name="notification_min_height_increased">146dp</dimen> <!-- Height of a small notification in the status bar which was used before android N --> <dimen name="notification_min_height_legacy">64dp</dimen> @@ -84,7 +84,7 @@ <dimen name="notification_min_height_before_p">92dp</dimen> <!-- Height of a large notification in the status bar --> - <dimen name="notification_max_height">292dp</dimen> + <dimen name="notification_max_height">294dp</dimen> <!-- Height of an ambient notification on ambient display --> <dimen name="notification_ambient_height">400dp</dimen> @@ -96,7 +96,7 @@ <dimen name="notification_max_heads_up_height_before_p">148dp</dimen> <!-- Height of a heads up notification in the status bar --> - <dimen name="notification_max_heads_up_height">156dp</dimen> + <dimen name="notification_max_heads_up_height">162dp</dimen> <!-- Height of a heads up notification in the status bar --> <dimen name="notification_max_heads_up_height_increased">188dp</dimen> @@ -379,9 +379,6 @@ group. --> <dimen name="notification_children_container_divider_height">@dimen/notification_divider_height</dimen> - <!-- The height of the header for a container containing child notifications. --> - <dimen name="notification_children_container_header_height">53dp</dimen> - <!-- The top margin for the notification children container in its non-expanded form. --> <dimen name="notification_children_container_margin_top">@*android:dimen/notification_content_margin_top</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java index 43018174de44..112707552e6e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java @@ -128,6 +128,7 @@ public class NotificationHeaderUtil { mComparators.add(HeaderProcessor.forTextView(mRow, com.android.internal.R.id.header_text)); mDividers.add(com.android.internal.R.id.header_text_divider); + mDividers.add(com.android.internal.R.id.header_text_secondary_divider); mDividers.add(com.android.internal.R.id.time_divider); } 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 c0241e36941f..55050995d5f6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -128,12 +128,11 @@ public class NotificationChildrenContainer extends ViewGroup { mDividerHeight = res.getDimensionPixelSize( R.dimen.notification_children_container_divider_height); mDividerAlpha = res.getFloat(R.dimen.notification_divider_alpha); - mHeaderHeight = res.getDimensionPixelSize( - R.dimen.notification_children_container_header_height); mNotificationHeaderMargin = res.getDimensionPixelSize( R.dimen.notification_children_container_margin_top); mNotificatonTopPadding = res.getDimensionPixelSize( R.dimen.notification_children_container_top_padding); + mHeaderHeight = mNotificationHeaderMargin + mNotificatonTopPadding; mCollapsedBottompadding = res.getDimensionPixelSize( com.android.internal.R.dimen.notification_content_margin_bottom); mEnableShadowOnChildNotifications = |
