diff --git a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt index e538a05a1..d388c8646 100644 --- a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt +++ b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt @@ -19,7 +19,6 @@ import android.widget.CursorAdapter import android.widget.TextView import com.fsck.k9.Account -import com.fsck.k9.K9 import com.fsck.k9.ui.R import com.fsck.k9.Preferences import com.fsck.k9.contacts.ContactPictureLoader @@ -69,7 +68,6 @@ class MessageListAdapter internal constructor( private val selectedItemBackgroundColor: Int private val readItemBackgroundColor: Int private val unreadItemBackgroundColor: Int - private val fontSizes = K9.fontSizes init { @@ -144,22 +142,22 @@ class MessageListAdapter internal constructor( if (appearance.senderAboveSubject) { holder.from = view.findViewById(R.id.subject) - fontSizes.setViewTextSize(holder.from, fontSizes.messageListSender) + appearance.fontSizes.setViewTextSize(holder.from, appearance.fontSizes.messageListSender) } else { holder.subject = view.findViewById(R.id.subject) - fontSizes.setViewTextSize(holder.subject, fontSizes.messageListSubject) + appearance.fontSizes.setViewTextSize(holder.subject, appearance.fontSizes.messageListSubject) } - fontSizes.setViewTextSize(holder.date, fontSizes.messageListDate) + appearance.fontSizes.setViewTextSize(holder.date, appearance.fontSizes.messageListDate) // 1 preview line is needed even if it is set to 0, because subject is part of the same text view holder.preview.setLines(max(appearance.previewLines, 1)) - fontSizes.setViewTextSize(holder.preview, fontSizes.messageListPreview) + appearance.fontSizes.setViewTextSize(holder.preview, appearance.fontSizes.messageListPreview) holder.threadCount = view.findViewById(R.id.thread_count) - fontSizes.setViewTextSize(holder.threadCount, fontSizes.messageListSubject) // thread count is next to subject + appearance.fontSizes.setViewTextSize(holder.threadCount, appearance.fontSizes.messageListSubject) // thread count is next to subject view.findViewById(R.id.selected_checkbox_wrapper).visibility = if (appearance.checkboxes) View.VISIBLE else View.GONE @@ -294,9 +292,9 @@ class MessageListAdapter internal constructor( */ private fun buildSenderSpan(): AbsoluteSizeSpan { val fontSize = if (appearance.senderAboveSubject) - fontSizes.messageListSubject + appearance.fontSizes.messageListSubject else - fontSizes.messageListSender + appearance.fontSizes.messageListSender return AbsoluteSizeSpan(fontSize, true) } @@ -357,7 +355,7 @@ class MessageListAdapter internal constructor( } private fun setBackgroundColor(view: View, selected: Boolean, read: Boolean) { - if (selected || K9.isUseBackgroundAsUnreadIndicator) { + if (selected || appearance.backGroundAsReadIndicator) { val color: Int if (selected) { color = selectedItemBackgroundColor diff --git a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java index 668de4e5b..88e1f7e4f 100644 --- a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +++ b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java @@ -605,12 +605,14 @@ public class MessageListFragment extends Fragment implements OnItemClickListener private MessageListAppearance getMessageListAppearance() { return new MessageListAppearance( + K9.getFontSizes(), K9.isShowMessageListCheckboxes(), K9.getMessageListPreviewLines(), K9.isShowMessageListStars(), K9.isMessageListSenderAboveSubject(), K9.isShowContactPicture(), - showingThreadedList + showingThreadedList, + K9.isUseBackgroundAsUnreadIndicator() ); } diff --git a/app/ui/src/main/java/com/fsck/k9/ui/messagelist/MessageListAppearance.kt b/app/ui/src/main/java/com/fsck/k9/ui/messagelist/MessageListAppearance.kt index 99c070431..f50d84a56 100644 --- a/app/ui/src/main/java/com/fsck/k9/ui/messagelist/MessageListAppearance.kt +++ b/app/ui/src/main/java/com/fsck/k9/ui/messagelist/MessageListAppearance.kt @@ -1,10 +1,14 @@ package com.fsck.k9.ui.messagelist +import com.fsck.k9.FontSizes + data class MessageListAppearance( + val fontSizes: FontSizes, val checkboxes: Boolean, val previewLines: Int, val stars: Boolean, val senderAboveSubject: Boolean, val showContactPicture: Boolean, - val showingThreadedList: Boolean = false + val showingThreadedList: Boolean, + val backGroundAsReadIndicator: Boolean ) \ No newline at end of file