From ffa457143c9d5e3068ea1f5ce9a910b2096df970 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Fri, 29 Apr 2022 08:45:25 +0530 Subject: [PATCH 1/7] investigation code --- .../main/java/com/fsck/k9/fragment/MessageListAdapter.kt | 7 +++++++ 1 file changed, 7 insertions(+) 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 e07b709cf2..d3526aedaa 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 @@ -202,6 +202,13 @@ class MessageListAdapter internal constructor( } else { holder.status.isVisible = false } + + if(!holder.displayName.text.trim().toString().equals(res.getString(R.string.general_no_subject)) + && !holder.subject.text.trim().toString().equals(res.getString(R.string.general_no_subject))){ + holder.displayName.setTextColor(res.getColor(R.color.red)) + holder.subject.setTextColor(res.getColor(R.color.red)) + } + } } -- GitLab From 624cbddab8ad916d3030f462e07735b37b880e37 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Fri, 29 Apr 2022 13:35:35 +0530 Subject: [PATCH 2/7] hide view if Ghost --- .../java/com/fsck/k9/fragment/MessageListAdapter.kt | 12 +++++++----- .../java/com/fsck/k9/fragment/MessageViewHolder.kt | 2 ++ .../legacy/src/main/res/layout/message_list_item.xml | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) 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 d3526aedaa..35e8f5afa0 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 @@ -95,11 +96,13 @@ class MessageListAdapter internal constructor( override fun getItem(position: Int): MessageListItem = messages[position] + + override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { val message = getItem(position) val view: View = convertView ?: newView(parent) - bindView(view, context, message) + bindView(view, context, message) return view } @@ -203,10 +206,9 @@ class MessageListAdapter internal constructor( holder.status.isVisible = false } - if(!holder.displayName.text.trim().toString().equals(res.getString(R.string.general_no_subject)) - && !holder.subject.text.trim().toString().equals(res.getString(R.string.general_no_subject))){ - holder.displayName.setTextColor(res.getColor(R.color.red)) - holder.subject.setTextColor(res.getColor(R.color.red)) + if(message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) + && message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject))){ + view.setVisibility(View.GONE) } } 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 0c5b296b18..2156a4a0f5 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 7e43c87f61..936c296a69 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"> Date: Mon, 2 May 2022 10:38:13 +0530 Subject: [PATCH 3/7] check on bindView --- .../com/fsck/k9/fragment/MessageListAdapter.kt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 35e8f5afa0..e102481a71 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 @@ -102,7 +102,14 @@ class MessageListAdapter internal constructor( val message = getItem(position) val view: View = convertView ?: newView(parent) - bindView(view, context, message) + + + if(!message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) + && !message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject))){ + + bindView(view, context, message) + } + return view } @@ -206,10 +213,10 @@ class MessageListAdapter internal constructor( holder.status.isVisible = false } - if(message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) - && message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject))){ - view.setVisibility(View.GONE) - } +// if(message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) +// && message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject))){ +// view.setVisibility(View.GONE) +// } } } -- GitLab From 0b0a8d5d60ba1dd405357f33950075c39a24ec43 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Mon, 2 May 2022 10:41:28 +0530 Subject: [PATCH 4/7] check on bindView function --- .../fsck/k9/fragment/MessageListAdapter.kt | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) 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 e102481a71..ca8af264a3 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 @@ -47,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) { @@ -96,19 +99,15 @@ class MessageListAdapter internal constructor( override fun getItem(position: Int): MessageListItem = messages[position] - - override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { val message = getItem(position) val view: View = convertView ?: newView(parent) - if(!message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) - && !message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject))){ - bindView(view, context, message) - } + bindView(view, context, message) + return view } @@ -130,7 +129,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 @@ -142,6 +144,14 @@ class MessageListAdapter internal constructor( } private fun bindView(view: View, context: Context, message: MessageListItem) { + + if (message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) + && message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject)) + ) { + view.setVisibility(View.GONE) + return + } + val isSelected = selected.contains(message.uniqueId) val isActive = isActiveMessage(message) -- GitLab From 6cdc1ab95e8c7d31632b0fe685ad0bb3ce3a3af4 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Mon, 2 May 2022 10:44:52 +0530 Subject: [PATCH 5/7] check on bindView function show visibility --- .../src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ca8af264a3..7d5c2efe6f 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 @@ -151,7 +151,7 @@ class MessageListAdapter internal constructor( view.setVisibility(View.GONE) return } - + view.setVisibility(View.VISIBLE) val isSelected = selected.contains(message.uniqueId) val isActive = isActiveMessage(message) -- GitLab From 6c34e9539879241f1c4635c0f6ea3fdd5506c72e Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Mon, 2 May 2022 10:54:33 +0530 Subject: [PATCH 6/7] refine code --- .../main/java/com/fsck/k9/fragment/MessageListAdapter.kt | 9 --------- 1 file changed, 9 deletions(-) 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 7d5c2efe6f..79e559d248 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 @@ -103,12 +103,8 @@ class MessageListAdapter internal constructor( val message = getItem(position) val view: View = convertView ?: newView(parent) - - - bindView(view, context, message) - return view } @@ -223,11 +219,6 @@ class MessageListAdapter internal constructor( holder.status.isVisible = false } -// if(message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) -// && message.subject?.trim().toString().equals(res.getString(R.string.general_no_subject))){ -// view.setVisibility(View.GONE) -// } - } } -- GitLab From d48b4446a004e3fd30dfc7c3858590b03cc7d798 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Mon, 2 May 2022 10:55:43 +0530 Subject: [PATCH 7/7] refine code and update string --- .../src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 79e559d248..3a42cf1964 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 @@ -141,7 +141,7 @@ class MessageListAdapter internal constructor( private fun bindView(view: View, context: Context, message: MessageListItem) { - if (message.displayName.trim().toString().equals(res.getString(R.string.general_no_subject)) + 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) -- GitLab