Merge "Add application name to expanded conversation view" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-03-21 00:53:04 +00:00
committed by Android (Google) Code Review
3 changed files with 31 additions and 19 deletions

View File

@@ -133,6 +133,7 @@ public class ConversationLayout extends FrameLayout
private boolean mExpandable = true;
private int mContentMarginEnd;
private Rect mMessagingClipRect;
private TextView mAppName;
public ConversationLayout(@NonNull Context context) {
super(context);
@@ -202,6 +203,7 @@ public class ConversationLayout extends FrameLayout
R.string.conversation_title_fallback_one_to_one);
mFallbackGroupChatName = getResources().getString(
R.string.conversation_title_fallback_group_chat);
mAppName = findViewById(R.id.app_name_text);
}
@RemotableViewMethod
@@ -384,6 +386,7 @@ public class ConversationLayout extends FrameLayout
}
updateIconPositionAndSize();
updateImageMessages();
updateAppName();
}
private void updateImageMessages() {
@@ -462,6 +465,10 @@ public class ConversationLayout extends FrameLayout
topView.setImageIcon(secondLastIcon);
}
private void updateAppName() {
mAppName.setVisibility(mIsCollapsed ? GONE : VISIBLE);
}
/**
* update the icon position and sizing
*/

View File

@@ -174,6 +174,17 @@
/>
</LinearLayout>
<!-- App Name -->
<TextView
android:id="@+id/app_name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/conversation_content_start"
android:paddingBottom="16dp"
android:textSize="12sp"
android:textAppearance="@style/TextAppearance.DeviceDefault.Notification"
/>
<!-- Messages -->
<com.android.internal.widget.MessagingLinearLayout
android:id="@+id/notification_messaging"

View File

@@ -52,28 +52,22 @@ class NotificationConversationTemplateViewWrapper constructor(
private lateinit var imageMessageContainer: ViewGroup
private lateinit var messagingLinearLayout: MessagingLinearLayout
private lateinit var importanceRing: View
private lateinit var appName: View
private fun resolveViews() {
messagingLinearLayout = conversationLayout.messagingLinearLayout
imageMessageContainer = conversationLayout.imageMessageContainer
conversationIcon = conversationLayout.requireViewById(
com.android.internal.R.id.conversation_icon
)
conversationBadge = conversationLayout.requireViewById(
com.android.internal.R.id.conversation_icon_badge
)
conversationBadgeBg = conversationLayout.requireViewById(
com.android.internal.R.id.conversation_icon_badge_bg
)
expandButton = conversationLayout.requireViewById(
com.android.internal.R.id.expand_button
)
expandButtonContainer = conversationLayout.requireViewById(
com.android.internal.R.id.expand_button_container
)
importanceRing = conversationLayout.requireViewById(
com.android.internal.R.id.conversation_icon_badge_ring
)
with(conversationLayout) {
conversationIcon = requireViewById(com.android.internal.R.id.conversation_icon)
conversationBadge = requireViewById(com.android.internal.R.id.conversation_icon_badge)
conversationBadgeBg =
requireViewById(com.android.internal.R.id.conversation_icon_badge_bg)
expandButton = requireViewById(com.android.internal.R.id.expand_button)
expandButtonContainer =
requireViewById(com.android.internal.R.id.expand_button_container)
importanceRing = requireViewById(com.android.internal.R.id.conversation_icon_badge_ring)
appName = requireViewById(com.android.internal.R.id.app_name_text)
}
}
override fun onContentUpdated(row: ExpandableNotificationRow) {
@@ -87,7 +81,7 @@ class NotificationConversationTemplateViewWrapper constructor(
// This also clears the existing types
super.updateTransformedTypes()
addTransformedViews(messagingLinearLayout)
addTransformedViews(messagingLinearLayout, appName)
// Let's ignore the image message container since that is transforming as part of the
// messages already