Loading core/java/android/app/Notification.java +5 −0 Original line number Diff line number Diff line Loading @@ -7584,6 +7584,7 @@ public class Notification implements Parcelable isOneToOne = !isGroupConversation(); } boolean isConversationLayout = mConversationType != CONVERSATION_TYPE_LEGACY; boolean isImportantConversation = mConversationType == CONVERSATION_TYPE_IMPORTANT; Icon largeIcon = isConversationLayout ? mShortcutIcon : mBuilder.mN.mLargeIcon; TemplateBindResult bindResult = new TemplateBindResult(); StandardTemplateParams p = mBuilder.mParams.reset() Loading Loading @@ -7626,6 +7627,10 @@ public class Notification implements Parcelable isOneToOne); contentView.setCharSequence(R.id.status_bar_latest_event_content, "setConversationTitle", conversationTitle); if (isConversationLayout) { contentView.setBoolean(R.id.status_bar_latest_event_content, "setIsImportantConversation", isImportantConversation); } contentView.setIcon(R.id.status_bar_latest_event_content, "setLargeIcon", largeIcon); contentView.setBundle(R.id.status_bar_latest_event_content, "setData", Loading core/java/com/android/internal/widget/ConversationLayout.java +13 −7 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ public class ConversationLayout extends FrameLayout private int mIconSizeBadged; private int mIconSizeCentered; private CachingIconView mIcon; private View mImportanceRingView; private int mExpandedGroupTopMargin; private View mConversationFacePile; private int mNotificationBackgroundColor; Loading Loading @@ -169,6 +170,7 @@ public class ConversationLayout extends FrameLayout mTextPaint.setAntiAlias(true); mConversationIcon = findViewById(R.id.conversation_icon); mIcon = findViewById(R.id.icon); mImportanceRingView = findViewById(R.id.conversation_icon_badge_ring); mConversationIconBadge = findViewById(R.id.conversation_icon_badge); mIcon.setOnVisibilityChangedListener((visibility) -> { // Always keep the badge visibility in sync with the icon. This is necessary in cases Loading Loading @@ -212,6 +214,14 @@ public class ConversationLayout extends FrameLayout mNameReplacement = nameReplacement; } /** * Sets this conversation as "important", adding some additional UI treatment. */ @RemotableViewMethod public void setIsImportantConversation(boolean isImportantConversation) { mImportanceRingView.setVisibility(isImportantConversation ? VISIBLE : GONE); } /** * Set this layout to show the collapsed representation. * Loading Loading @@ -309,14 +319,12 @@ public class ConversationLayout extends FrameLayout updateTitleAndNamesDisplay(); updateConversationLayout(); } /** * Update the layout according to the data provided (i.e mIsOneToOne, expanded etc); */ private void updateConversationLayout() { // TODO: resolve this from shortcuts // Set avatar and name CharSequence conversationText = mConversationTitle; // TODO: display the secondary text somewhere Loading Loading @@ -463,7 +471,7 @@ public class ConversationLayout extends FrameLayout int marginTop; int iconSize; if (mIsOneToOne || mIsCollapsed) { // Baded format // Badged format gravity = Gravity.LEFT; marginStart = mBadgedSideMargins; marginTop = mBadgedSideMargins; Loading @@ -479,11 +487,9 @@ public class ConversationLayout extends FrameLayout layoutParams.gravity = gravity; layoutParams.topMargin = marginTop; layoutParams.setMarginStart(marginStart); layoutParams.width = iconSize; layoutParams.height = iconSize; mConversationIconBadge.setLayoutParams(layoutParams); ViewGroup.LayoutParams iconParams = mIcon.getLayoutParams(); iconParams.width = iconSize; iconParams.height = iconSize; mIcon.setLayoutParams(iconParams); } @RemotableViewMethod Loading core/res/res/drawable/conversation_badge_ring.xml 0 → 100644 +32 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2020 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="oval"> <solid android:color="@color/transparent"/> <stroke android:color="@color/conversation_important_highlight" android:width="2dp"/> <size android:width="26dp" android:height="26dp"/> </shape> core/res/res/layout/notification_template_material_conversation.xml +19 −5 Original line number Diff line number Diff line Loading @@ -58,18 +58,32 @@ <FrameLayout android:id="@+id/conversation_icon_badge" android:layout_width="20dp" android:layout_height="20dp" android:layout_width="@dimen/conversation_icon_size_badged" android:layout_height="@dimen/conversation_icon_size_badged" android:layout_marginLeft="@dimen/conversation_badge_side_margin" android:layout_marginTop="@dimen/conversation_badge_side_margin" android:background="@drawable/conversation_badge_background" > > <ImageView android:id="@+id/conversation_icon_badge_bg" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/conversation_badge_background" /> <!-- Badge: 20x20, 48dp padding left + top --> <com.android.internal.widget.CachingIconView android:id="@+id/icon" android:layout_width="@dimen/conversation_icon_size_badged" android:layout_height="@dimen/conversation_icon_size_badged" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="4dp" android:layout_gravity="center" /> <ImageView android:id="@+id/conversation_icon_badge_ring" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/conversation_badge_ring" android:visibility="gone" /> </FrameLayout> </FrameLayout> </FrameLayout> Loading core/res/res/values/colors.xml +2 −0 Original line number Diff line number Diff line Loading @@ -226,4 +226,6 @@ <color name="resolver_text_color_secondary_dark">#ffC4C6C6</color> <color name="resolver_empty_state_text">#FF202124</color> <color name="resolver_empty_state_icon">#FF5F6368</color> <color name="conversation_important_highlight">#F9AB00</color> </resources> Loading
core/java/android/app/Notification.java +5 −0 Original line number Diff line number Diff line Loading @@ -7584,6 +7584,7 @@ public class Notification implements Parcelable isOneToOne = !isGroupConversation(); } boolean isConversationLayout = mConversationType != CONVERSATION_TYPE_LEGACY; boolean isImportantConversation = mConversationType == CONVERSATION_TYPE_IMPORTANT; Icon largeIcon = isConversationLayout ? mShortcutIcon : mBuilder.mN.mLargeIcon; TemplateBindResult bindResult = new TemplateBindResult(); StandardTemplateParams p = mBuilder.mParams.reset() Loading Loading @@ -7626,6 +7627,10 @@ public class Notification implements Parcelable isOneToOne); contentView.setCharSequence(R.id.status_bar_latest_event_content, "setConversationTitle", conversationTitle); if (isConversationLayout) { contentView.setBoolean(R.id.status_bar_latest_event_content, "setIsImportantConversation", isImportantConversation); } contentView.setIcon(R.id.status_bar_latest_event_content, "setLargeIcon", largeIcon); contentView.setBundle(R.id.status_bar_latest_event_content, "setData", Loading
core/java/com/android/internal/widget/ConversationLayout.java +13 −7 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ public class ConversationLayout extends FrameLayout private int mIconSizeBadged; private int mIconSizeCentered; private CachingIconView mIcon; private View mImportanceRingView; private int mExpandedGroupTopMargin; private View mConversationFacePile; private int mNotificationBackgroundColor; Loading Loading @@ -169,6 +170,7 @@ public class ConversationLayout extends FrameLayout mTextPaint.setAntiAlias(true); mConversationIcon = findViewById(R.id.conversation_icon); mIcon = findViewById(R.id.icon); mImportanceRingView = findViewById(R.id.conversation_icon_badge_ring); mConversationIconBadge = findViewById(R.id.conversation_icon_badge); mIcon.setOnVisibilityChangedListener((visibility) -> { // Always keep the badge visibility in sync with the icon. This is necessary in cases Loading Loading @@ -212,6 +214,14 @@ public class ConversationLayout extends FrameLayout mNameReplacement = nameReplacement; } /** * Sets this conversation as "important", adding some additional UI treatment. */ @RemotableViewMethod public void setIsImportantConversation(boolean isImportantConversation) { mImportanceRingView.setVisibility(isImportantConversation ? VISIBLE : GONE); } /** * Set this layout to show the collapsed representation. * Loading Loading @@ -309,14 +319,12 @@ public class ConversationLayout extends FrameLayout updateTitleAndNamesDisplay(); updateConversationLayout(); } /** * Update the layout according to the data provided (i.e mIsOneToOne, expanded etc); */ private void updateConversationLayout() { // TODO: resolve this from shortcuts // Set avatar and name CharSequence conversationText = mConversationTitle; // TODO: display the secondary text somewhere Loading Loading @@ -463,7 +471,7 @@ public class ConversationLayout extends FrameLayout int marginTop; int iconSize; if (mIsOneToOne || mIsCollapsed) { // Baded format // Badged format gravity = Gravity.LEFT; marginStart = mBadgedSideMargins; marginTop = mBadgedSideMargins; Loading @@ -479,11 +487,9 @@ public class ConversationLayout extends FrameLayout layoutParams.gravity = gravity; layoutParams.topMargin = marginTop; layoutParams.setMarginStart(marginStart); layoutParams.width = iconSize; layoutParams.height = iconSize; mConversationIconBadge.setLayoutParams(layoutParams); ViewGroup.LayoutParams iconParams = mIcon.getLayoutParams(); iconParams.width = iconSize; iconParams.height = iconSize; mIcon.setLayoutParams(iconParams); } @RemotableViewMethod Loading
core/res/res/drawable/conversation_badge_ring.xml 0 → 100644 +32 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2020 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="oval"> <solid android:color="@color/transparent"/> <stroke android:color="@color/conversation_important_highlight" android:width="2dp"/> <size android:width="26dp" android:height="26dp"/> </shape>
core/res/res/layout/notification_template_material_conversation.xml +19 −5 Original line number Diff line number Diff line Loading @@ -58,18 +58,32 @@ <FrameLayout android:id="@+id/conversation_icon_badge" android:layout_width="20dp" android:layout_height="20dp" android:layout_width="@dimen/conversation_icon_size_badged" android:layout_height="@dimen/conversation_icon_size_badged" android:layout_marginLeft="@dimen/conversation_badge_side_margin" android:layout_marginTop="@dimen/conversation_badge_side_margin" android:background="@drawable/conversation_badge_background" > > <ImageView android:id="@+id/conversation_icon_badge_bg" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/conversation_badge_background" /> <!-- Badge: 20x20, 48dp padding left + top --> <com.android.internal.widget.CachingIconView android:id="@+id/icon" android:layout_width="@dimen/conversation_icon_size_badged" android:layout_height="@dimen/conversation_icon_size_badged" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="4dp" android:layout_gravity="center" /> <ImageView android:id="@+id/conversation_icon_badge_ring" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/conversation_badge_ring" android:visibility="gone" /> </FrameLayout> </FrameLayout> </FrameLayout> Loading
core/res/res/values/colors.xml +2 −0 Original line number Diff line number Diff line Loading @@ -226,4 +226,6 @@ <color name="resolver_text_color_secondary_dark">#ffC4C6C6</color> <color name="resolver_empty_state_text">#FF202124</color> <color name="resolver_empty_state_icon">#FF5F6368</color> <color name="conversation_important_highlight">#F9AB00</color> </resources>