Loading core/java/com/android/internal/widget/ConversationLayout.java +32 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.app.Person; import android.app.RemoteInputHistoryItem; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.drawable.Drawable; Loading Loading @@ -124,6 +125,7 @@ public class ConversationLayout extends FrameLayout private ViewGroup mExpandButtonContainerA11yContainer; private NotificationExpandButton mExpandButton; private MessagingLinearLayout mImageMessageContainer; private ImageView mRightIconView; private int mBadgeProtrusion; private int mConversationAvatarSize; private int mConversationAvatarSizeExpanded; Loading Loading @@ -193,6 +195,7 @@ public class ConversationLayout extends FrameLayout mMessagingLinearLayout = findViewById(R.id.notification_messaging); mActions = findViewById(R.id.actions); mImageMessageContainer = findViewById(R.id.conversation_image_message_container); mRightIconView = findViewById(R.id.right_icon); // We still want to clip, but only on the top, since views can temporarily out of bounds // during transitions. DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); Loading Loading @@ -734,13 +737,41 @@ public class ConversationLayout extends FrameLayout View newMessage = getNewImageMessage(); // Remove all messages that don't belong into the image layout View previousMessage = mImageMessageContainer.getChildAt(0); boolean isShowingImage = newMessage != null; if (previousMessage != newMessage) { mImageMessageContainer.removeView(previousMessage); if (newMessage != null) { if (isShowingImage) { mImageMessageContainer.addView(newMessage); } } mImageMessageContainer.setVisibility(newMessage != null ? VISIBLE : GONE); if (mRightIconView != null && mRightIconView.getDrawable() != null) { // When showing an image message, do not show the large icon. Removing the drawable // prevents it from being shown in the left_icon view (by the grouping util). if (notificationsRedesignTemplates() && isShowingImage) { mRightIconView.setImageDrawable(null); mRightIconView.setVisibility(GONE); } } else { // Only alter the padding if we're not showing the large icon; otherwise it's already // been adjusted in Notification.java and we shouldn't override it. adjustExpandButtonPadding(isShowingImage); } } /** * When showing an isolated image message similar to the large icon, adjust the padding of the * expand button in the same way we do for large icons. */ private void adjustExpandButtonPadding(boolean isShowingImage) { if (notificationsRedesignTemplates() && mExpandButton != null) { final Resources res = mContext.getResources(); int normalPadding = res.getDimensionPixelSize(R.dimen.notification_2025_margin); int iconSpacing = res.getDimensionPixelSize( R.dimen.notification_2025_expand_button_right_icon_spacing); mExpandButton.setStartPadding(isShowingImage ? iconSpacing : normalPadding); } } @Nullable Loading core/java/com/android/internal/widget/MessagingLayout.java +33 −7 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.widget; import static android.app.Flags.notificationsRedesignTemplates; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_EXTERNAL; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_INLINE; Loading @@ -27,6 +29,7 @@ import android.app.Notification; import android.app.Person; import android.app.RemoteInputHistoryItem; import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; import android.graphics.drawable.Icon; import android.os.Bundle; Loading Loading @@ -74,6 +77,7 @@ public class MessagingLayout extends FrameLayout private final ArrayList<MessagingGroup> mGroups = new ArrayList<>(); private MessagingLinearLayout mImageMessageContainer; private ImageView mRightIconView; private NotificationExpandButton mExpandButton; private Rect mMessagingClipRect; private int mLayoutColor; private int mSenderTextColor; Loading Loading @@ -115,6 +119,7 @@ public class MessagingLayout extends FrameLayout mMessagingLinearLayout = findViewById(R.id.notification_messaging); mImageMessageContainer = findViewById(R.id.conversation_image_message_container); mRightIconView = findViewById(R.id.right_icon); mExpandButton = findViewById(R.id.expand_button); // We still want to clip, but only on the top, since views can temporarily out of bounds // during transitions. DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); Loading Loading @@ -349,20 +354,41 @@ public class MessagingLayout extends FrameLayout View newMessage = getNewImageMessage(); // Remove all messages that don't belong into the image layout View previousMessage = mImageMessageContainer.getChildAt(0); boolean isShowingImage = newMessage != null; if (previousMessage != newMessage) { mImageMessageContainer.removeView(previousMessage); if (newMessage != null) { if (isShowingImage) { mImageMessageContainer.addView(newMessage); } } mImageMessageContainer.setVisibility(newMessage != null ? VISIBLE : GONE); mImageMessageContainer.setVisibility(isShowingImage ? VISIBLE : GONE); if (mRightIconView != null && mRightIconView.getDrawable() != null) { // When showing an image message, do not show the large icon. Removing the drawable // prevents it from being shown in the left_icon view (by the grouping util). if (newMessage != null && mRightIconView != null && mRightIconView.getDrawable() != null) { if (isShowingImage) { mRightIconView.setImageDrawable(null); mRightIconView.setVisibility(GONE); } } else { // Only alter the padding if we're not showing the large icon; otherwise it's already // been adjusted in Notification.java and we shouldn't override it. adjustExpandButtonPadding(isShowingImage); } } /** * When showing an isolated image message similar to the large icon, adjust the padding of the * expand button in the same way we do for large icons. */ private void adjustExpandButtonPadding(boolean isShowingImage) { if (notificationsRedesignTemplates() && mExpandButton != null) { final Resources res = mContext.getResources(); int normalPadding = res.getDimensionPixelSize(R.dimen.notification_2025_margin); int iconSpacing = res.getDimensionPixelSize( R.dimen.notification_2025_expand_button_right_icon_spacing); mExpandButton.setStartPadding(isShowingImage ? iconSpacing : normalPadding); } } @Nullable Loading core/res/res/layout/notification_2025_template_collapsed_conversation.xml +1 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ android:layout_width="@dimen/notification_right_icon_size" android:layout_height="@dimen/notification_right_icon_size" android:layout_gravity="center_vertical|end" android:layout_marginTop="@dimen/notification_2025_margin" android:layout_marginVertical="@dimen/notification_2025_right_icon_vertical_margin" android:layout_marginStart="@dimen/notification_2025_right_icon_content_margin" android:forceHasOverlappingRendering="false" android:spacing="0dp" Loading core/res/res/layout/notification_2025_template_collapsed_messaging.xml +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ android:layout_width="@dimen/notification_right_icon_size" android:layout_height="@dimen/notification_right_icon_size" android:layout_gravity="center_vertical|end" android:layout_marginTop="@dimen/notification_2025_margin" android:layout_marginVertical="@dimen/notification_2025_right_icon_vertical_margin" android:layout_marginStart="@dimen/notification_2025_right_icon_content_margin" android:forceHasOverlappingRendering="false" android:spacing="0dp" Loading Loading
core/java/com/android/internal/widget/ConversationLayout.java +32 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.app.Person; import android.app.RemoteInputHistoryItem; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.drawable.Drawable; Loading Loading @@ -124,6 +125,7 @@ public class ConversationLayout extends FrameLayout private ViewGroup mExpandButtonContainerA11yContainer; private NotificationExpandButton mExpandButton; private MessagingLinearLayout mImageMessageContainer; private ImageView mRightIconView; private int mBadgeProtrusion; private int mConversationAvatarSize; private int mConversationAvatarSizeExpanded; Loading Loading @@ -193,6 +195,7 @@ public class ConversationLayout extends FrameLayout mMessagingLinearLayout = findViewById(R.id.notification_messaging); mActions = findViewById(R.id.actions); mImageMessageContainer = findViewById(R.id.conversation_image_message_container); mRightIconView = findViewById(R.id.right_icon); // We still want to clip, but only on the top, since views can temporarily out of bounds // during transitions. DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); Loading Loading @@ -734,13 +737,41 @@ public class ConversationLayout extends FrameLayout View newMessage = getNewImageMessage(); // Remove all messages that don't belong into the image layout View previousMessage = mImageMessageContainer.getChildAt(0); boolean isShowingImage = newMessage != null; if (previousMessage != newMessage) { mImageMessageContainer.removeView(previousMessage); if (newMessage != null) { if (isShowingImage) { mImageMessageContainer.addView(newMessage); } } mImageMessageContainer.setVisibility(newMessage != null ? VISIBLE : GONE); if (mRightIconView != null && mRightIconView.getDrawable() != null) { // When showing an image message, do not show the large icon. Removing the drawable // prevents it from being shown in the left_icon view (by the grouping util). if (notificationsRedesignTemplates() && isShowingImage) { mRightIconView.setImageDrawable(null); mRightIconView.setVisibility(GONE); } } else { // Only alter the padding if we're not showing the large icon; otherwise it's already // been adjusted in Notification.java and we shouldn't override it. adjustExpandButtonPadding(isShowingImage); } } /** * When showing an isolated image message similar to the large icon, adjust the padding of the * expand button in the same way we do for large icons. */ private void adjustExpandButtonPadding(boolean isShowingImage) { if (notificationsRedesignTemplates() && mExpandButton != null) { final Resources res = mContext.getResources(); int normalPadding = res.getDimensionPixelSize(R.dimen.notification_2025_margin); int iconSpacing = res.getDimensionPixelSize( R.dimen.notification_2025_expand_button_right_icon_spacing); mExpandButton.setStartPadding(isShowingImage ? iconSpacing : normalPadding); } } @Nullable Loading
core/java/com/android/internal/widget/MessagingLayout.java +33 −7 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.widget; import static android.app.Flags.notificationsRedesignTemplates; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_EXTERNAL; import static com.android.internal.widget.MessagingGroup.IMAGE_DISPLAY_LOCATION_INLINE; Loading @@ -27,6 +29,7 @@ import android.app.Notification; import android.app.Person; import android.app.RemoteInputHistoryItem; import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; import android.graphics.drawable.Icon; import android.os.Bundle; Loading Loading @@ -74,6 +77,7 @@ public class MessagingLayout extends FrameLayout private final ArrayList<MessagingGroup> mGroups = new ArrayList<>(); private MessagingLinearLayout mImageMessageContainer; private ImageView mRightIconView; private NotificationExpandButton mExpandButton; private Rect mMessagingClipRect; private int mLayoutColor; private int mSenderTextColor; Loading Loading @@ -115,6 +119,7 @@ public class MessagingLayout extends FrameLayout mMessagingLinearLayout = findViewById(R.id.notification_messaging); mImageMessageContainer = findViewById(R.id.conversation_image_message_container); mRightIconView = findViewById(R.id.right_icon); mExpandButton = findViewById(R.id.expand_button); // We still want to clip, but only on the top, since views can temporarily out of bounds // during transitions. DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); Loading Loading @@ -349,20 +354,41 @@ public class MessagingLayout extends FrameLayout View newMessage = getNewImageMessage(); // Remove all messages that don't belong into the image layout View previousMessage = mImageMessageContainer.getChildAt(0); boolean isShowingImage = newMessage != null; if (previousMessage != newMessage) { mImageMessageContainer.removeView(previousMessage); if (newMessage != null) { if (isShowingImage) { mImageMessageContainer.addView(newMessage); } } mImageMessageContainer.setVisibility(newMessage != null ? VISIBLE : GONE); mImageMessageContainer.setVisibility(isShowingImage ? VISIBLE : GONE); if (mRightIconView != null && mRightIconView.getDrawable() != null) { // When showing an image message, do not show the large icon. Removing the drawable // prevents it from being shown in the left_icon view (by the grouping util). if (newMessage != null && mRightIconView != null && mRightIconView.getDrawable() != null) { if (isShowingImage) { mRightIconView.setImageDrawable(null); mRightIconView.setVisibility(GONE); } } else { // Only alter the padding if we're not showing the large icon; otherwise it's already // been adjusted in Notification.java and we shouldn't override it. adjustExpandButtonPadding(isShowingImage); } } /** * When showing an isolated image message similar to the large icon, adjust the padding of the * expand button in the same way we do for large icons. */ private void adjustExpandButtonPadding(boolean isShowingImage) { if (notificationsRedesignTemplates() && mExpandButton != null) { final Resources res = mContext.getResources(); int normalPadding = res.getDimensionPixelSize(R.dimen.notification_2025_margin); int iconSpacing = res.getDimensionPixelSize( R.dimen.notification_2025_expand_button_right_icon_spacing); mExpandButton.setStartPadding(isShowingImage ? iconSpacing : normalPadding); } } @Nullable Loading
core/res/res/layout/notification_2025_template_collapsed_conversation.xml +1 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ android:layout_width="@dimen/notification_right_icon_size" android:layout_height="@dimen/notification_right_icon_size" android:layout_gravity="center_vertical|end" android:layout_marginTop="@dimen/notification_2025_margin" android:layout_marginVertical="@dimen/notification_2025_right_icon_vertical_margin" android:layout_marginStart="@dimen/notification_2025_right_icon_content_margin" android:forceHasOverlappingRendering="false" android:spacing="0dp" Loading
core/res/res/layout/notification_2025_template_collapsed_messaging.xml +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ android:layout_width="@dimen/notification_right_icon_size" android:layout_height="@dimen/notification_right_icon_size" android:layout_gravity="center_vertical|end" android:layout_marginTop="@dimen/notification_2025_margin" android:layout_marginVertical="@dimen/notification_2025_right_icon_vertical_margin" android:layout_marginStart="@dimen/notification_2025_right_icon_content_margin" android:forceHasOverlappingRendering="false" android:spacing="0dp" Loading