diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt index e07b709cf2305b0e391b4682e335a3c986f6efed..3a42cf1964d6acfbbff4606bd580589db7804120 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt @@ -6,6 +6,7 @@ import android.content.res.Resources.Theme import android.graphics.Color import android.graphics.Typeface import android.graphics.drawable.Drawable +import android.opengl.Visibility import android.text.Spannable import android.text.style.AbsoluteSizeSpan import android.text.style.StyleSpan @@ -46,10 +47,13 @@ class MessageListAdapter internal constructor( private val forwardedIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListForwarded) private val answeredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnswered) private val forwardedAnsweredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnsweredForwarded) - private val activeItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListActiveItemBackgroundColor) - private val selectedItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListSelectedBackgroundColor) + private val activeItemBackgroundColor: Int = + theme.resolveColorAttribute(R.attr.messageListActiveItemBackgroundColor) + private val selectedItemBackgroundColor: Int = + theme.resolveColorAttribute(R.attr.messageListSelectedBackgroundColor) private val readItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListReadItemBackgroundColor) - private val unreadItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListUnreadItemBackgroundColor) + private val unreadItemBackgroundColor: Int = + theme.resolveColorAttribute(R.attr.messageListUnreadItemBackgroundColor) var messages: List = emptyList() set(value) { @@ -98,6 +102,7 @@ class MessageListAdapter internal constructor( override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { val message = getItem(position) val view: View = convertView ?: newView(parent) + bindView(view, context, message) return view @@ -120,7 +125,10 @@ class MessageListAdapter internal constructor( holder.preview.setLines(max(appearance.previewLines, 0)) appearance.fontSizes.setViewTextSize(holder.displayName, appearance.fontSizes.messageListSender) appearance.fontSizes.setViewTextSize(holder.preview, appearance.fontSizes.messageListPreview) - appearance.fontSizes.setViewTextSize(holder.threadCount, appearance.fontSizes.messageListSubject) // thread count is next to subject + appearance.fontSizes.setViewTextSize( + holder.threadCount, + appearance.fontSizes.messageListSubject + ) // thread count is next to subject holder.flagged.isVisible = false holder.flagged.tag = holder @@ -132,6 +140,14 @@ class MessageListAdapter internal constructor( } private fun bindView(view: View, context: Context, message: MessageListItem) { + + if (message.displayName.trim().toString().equals(res.getString(R.string.unknown_sender)) + && message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject)) + ) { + view.setVisibility(View.GONE) + return + } + view.setVisibility(View.VISIBLE) val isSelected = selected.contains(message.uniqueId) val isActive = isActiveMessage(message) @@ -202,6 +218,7 @@ class MessageListAdapter internal constructor( } else { holder.status.isVisible = false } + } } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt index 0c5b296b18fff104931ce0703105f7e70e2e99e4..2156a4a0f5d2b689b85fb70023b6ea77ac4c11e9 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/fragment/MessageViewHolder.kt @@ -3,6 +3,7 @@ package com.fsck.k9.fragment import android.view.View import android.widget.CheckBox import android.widget.ImageView +import android.widget.LinearLayout import android.widget.TextView import com.fsck.k9.ui.R @@ -20,4 +21,5 @@ class MessageViewHolder(view: View) { val flagged: CheckBox = view.findViewById(R.id.star) val attachment: ImageView = view.findViewById(R.id.attachment) val status: ImageView = view.findViewById(R.id.status) + } diff --git a/app/ui/legacy/src/main/res/layout/message_list_item.xml b/app/ui/legacy/src/main/res/layout/message_list_item.xml index 7e43c87f6136ce509850e526180fd95feb731dfe..936c296a6971ac9cd37d7dbe0491e1af237202ec 100644 --- a/app/ui/legacy/src/main/res/layout/message_list_item.xml +++ b/app/ui/legacy/src/main/res/layout/message_list_item.xml @@ -6,7 +6,8 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="center_vertical" - tools:layout_height="?android:attr/listPreferredItemHeight"> + + tools:layout_height="?android:attr/listPreferredItemHeight">