diff options
author | 2020-06-02 18:46:38 +0000 | |
---|---|---|
committer | 2020-06-02 18:46:38 +0000 | |
commit | cc1937581a6f55592fa19e265b6a89aac22ded78 (patch) | |
tree | a10bfdde98279bf91823d4696f6cbd3f72658216 | |
parent | 2c1bfedd7bbbf3f53f44a70ddea9d36bda0a515a (diff) | |
parent | 6373829000bce6d6f4befccfc78e3265c350af2d (diff) |
Merge "Always use Shortcut Icon in conversation if available" into rvc-dev
-rw-r--r-- | core/java/android/app/Notification.java | 7 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/ConversationLayout.java | 23 |
2 files changed, 19 insertions, 11 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index e8ce92db62ad..980fdb87f3fb 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -7625,9 +7625,8 @@ public class Notification implements Parcelable } boolean isConversationLayout = mConversationType != CONVERSATION_TYPE_LEGACY; boolean isImportantConversation = mConversationType == CONVERSATION_TYPE_IMPORTANT; - Icon largeIcon = isConversationLayout && mShortcutIcon != null - ? mShortcutIcon - : mBuilder.mN.mLargeIcon; + Icon conversationIcon = mShortcutIcon; + Icon largeIcon = mBuilder.mN.mLargeIcon; TemplateBindResult bindResult = new TemplateBindResult(); StandardTemplateParams p = mBuilder.mParams.reset() .hasProgress(false) @@ -7671,6 +7670,8 @@ public class Notification implements Parcelable contentView.setCharSequence(R.id.status_bar_latest_event_content, "setConversationTitle", conversationTitle); if (isConversationLayout) { + contentView.setIcon(R.id.status_bar_latest_event_content, + "setConversationIcon", conversationIcon); contentView.setBoolean(R.id.status_bar_latest_event_content, "setIsImportantConversation", isImportantConversation); } diff --git a/core/java/com/android/internal/widget/ConversationLayout.java b/core/java/com/android/internal/widget/ConversationLayout.java index 688e00bc5a29..c75f72bdc765 100644 --- a/core/java/com/android/internal/widget/ConversationLayout.java +++ b/core/java/com/android/internal/widget/ConversationLayout.java @@ -480,23 +480,25 @@ public class ConversationLayout extends FrameLayout // (This usually happens for most 1:1 conversations) conversationText = messagingGroup.getSenderName(); } - Icon avatarIcon = messagingGroup.getAvatarIcon(); - if (avatarIcon == null) { - avatarIcon = createAvatarSymbol(conversationText, "", mLayoutColor); + if (mConversationIcon == null) { + Icon avatarIcon = messagingGroup.getAvatarIcon(); + if (avatarIcon == null) { + avatarIcon = createAvatarSymbol(conversationText, "", mLayoutColor); + } + mConversationIcon = avatarIcon; } - mConversationIcon = avatarIcon; - mConversationIconView.setImageIcon(mConversationIcon); break; } } } else { - if (mLargeIcon != null) { + if (mConversationIcon == null && mLargeIcon != null) { mConversationIcon = mLargeIcon; + } + if (mConversationIcon != null) { mConversationIconView.setVisibility(VISIBLE); mConversationFacePile.setVisibility(GONE); - mConversationIconView.setImageIcon(mLargeIcon); + mConversationIconView.setImageIcon(mConversationIcon); } else { - mConversationIcon = null; mConversationIconView.setVisibility(GONE); // This will also inflate it! mConversationFacePile.setVisibility(VISIBLE); @@ -709,6 +711,11 @@ public class ConversationLayout extends FrameLayout mLargeIcon = largeIcon; } + @RemotableViewMethod + public void setConversationIcon(Icon conversationIcon) { + mConversationIcon = conversationIcon; + } + /** * Sets the conversation title of this conversation. * |