Add thread count to message list widget layout
This commit is contained in:
parent
8db1cd3a24
commit
b028c86397
4 changed files with 25 additions and 1 deletions
|
@ -9,6 +9,7 @@ internal data class MessageListItem(
|
|||
val preview: String,
|
||||
val isRead: Boolean,
|
||||
val hasAttachments: Boolean,
|
||||
val threadCount: Int,
|
||||
val uri: Uri,
|
||||
val accountColor: Int,
|
||||
val uniqueId: Long,
|
||||
|
|
|
@ -37,6 +37,7 @@ internal class MessageListItemMapper(
|
|||
preview = previewText,
|
||||
isRead = message.isRead,
|
||||
hasAttachments = message.hasAttachments,
|
||||
threadCount = message.threadCount,
|
||||
uri = uri,
|
||||
accountColor = account.chipColor,
|
||||
uniqueId = uniqueId,
|
||||
|
|
|
@ -75,6 +75,13 @@ internal class MessageListRemoteViewFactory(private val context: Context) : Remo
|
|||
remoteView.setTextViewText(R.id.mail_date, item.displayDate)
|
||||
remoteView.setTextViewText(R.id.mail_preview, item.preview)
|
||||
|
||||
if (item.threadCount > 1) {
|
||||
remoteView.setTextViewText(R.id.thread_count, item.threadCount.toString())
|
||||
remoteView.setInt(R.id.thread_count, "setVisibility", View.VISIBLE)
|
||||
} else {
|
||||
remoteView.setInt(R.id.thread_count, "setVisibility", View.GONE)
|
||||
}
|
||||
|
||||
val textColor = getTextColor(item)
|
||||
remoteView.setTextColor(R.id.sender, textColor)
|
||||
remoteView.setTextColor(R.id.mail_subject, textColor)
|
||||
|
|
|
@ -39,6 +39,21 @@
|
|||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/thread_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toStartOf="@id/attachment"
|
||||
android:layout_marginStart="4dp"
|
||||
android:maxLines="1"
|
||||
android:paddingRight="4dip"
|
||||
android:paddingBottom="1dip"
|
||||
android:paddingLeft="4dip"
|
||||
android:textSize="16sp"
|
||||
android:textColor="?android:attr/colorBackground"
|
||||
android:background="@drawable/thread_count_box_light"
|
||||
tools:text="3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sender"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -46,7 +61,7 @@
|
|||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_gravity="start"
|
||||
android:layout_toStartOf="@id/attachment"
|
||||
android:layout_toStartOf="@id/thread_count"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp"
|
||||
|
|
Loading…
Reference in a new issue