Loading app/ui/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt +6 −3 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ class MessageListAdapter internal constructor( val holder = MessageViewHolder(view, listItemListener) holder.contactBadge.isVisible = appearance.showContactPicture holder.chip.isVisible = appearance.showAccountChip appearance.fontSizes.setViewTextSize(holder.subject, subjectViewFontSize) Loading Loading @@ -191,9 +192,11 @@ class MessageListAdapter internal constructor( val uniqueId = cursor.getLong(uniqueIdColumn) val selected = selected.contains(uniqueId) if (appearance.showAccountChip) { val accountChipDrawable = holder.chip.drawable.mutate() DrawableCompat.setTint(accountChipDrawable, account.chipColor) holder.chip.setImageDrawable(accountChipDrawable) } if (appearance.stars) { holder.flagged.isChecked = flagged Loading app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +3 −1 Original line number Diff line number Diff line Loading @@ -604,6 +604,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener } private MessageListAppearance getMessageListAppearance() { boolean showAccountChip = !isSingleAccountMode(); return new MessageListAppearance( K9.getFontSizes(), K9.getMessageListPreviewLines(), Loading @@ -611,7 +612,8 @@ public class MessageListFragment extends Fragment implements OnItemClickListener K9.isMessageListSenderAboveSubject(), K9.isShowContactPicture(), showingThreadedList, K9.isUseBackgroundAsUnreadIndicator() K9.isUseBackgroundAsUnreadIndicator(), showAccountChip ); } Loading app/ui/src/main/java/com/fsck/k9/ui/messagelist/MessageListAppearance.kt +2 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,6 @@ data class MessageListAppearance( val senderAboveSubject: Boolean, val showContactPicture: Boolean, val showingThreadedList: Boolean, val backGroundAsReadIndicator: Boolean val backGroundAsReadIndicator: Boolean, val showAccountChip: Boolean ) app/ui/src/test/java/com/fsck/k9/fragment/MessageListAdapterTest.kt +23 −2 Original line number Diff line number Diff line Loading @@ -63,6 +63,24 @@ class MessageListAdapterTest : RobolectricTest() { val listItemListener: MessageListItemActionListener = mock() @Test fun withShowAccountChip_shouldShowAccountChip() { val adapter = createAdapter(showAccountChip = true) val view = adapter.createAndBindView() assertTrue(view.accountChipView.isVisible) } @Test fun withoutShowAccountChip_shouldHideAccountChip() { val adapter = createAdapter(showAccountChip = false) val view = adapter.createAndBindView() assertTrue(view.accountChipView.isGone) } @Test fun withoutStars_shouldHideStarCheckBox() { val adapter = createAdapter(stars = false) Loading Loading @@ -429,7 +447,8 @@ class MessageListAdapterTest : RobolectricTest() { senderAboveSubject: Boolean = false, showContactPicture: Boolean = true, showingThreadedList: Boolean = true, backGroundAsReadIndicator: Boolean = false backGroundAsReadIndicator: Boolean = false, showAccountChip: Boolean = false ): MessageListAdapter { val appearance = MessageListAppearance( fontSizes, Loading @@ -438,7 +457,8 @@ class MessageListAdapterTest : RobolectricTest() { senderAboveSubject, showContactPicture, showingThreadedList, backGroundAsReadIndicator backGroundAsReadIndicator, showAccountChip ) return MessageListAdapter( Loading Loading @@ -512,6 +532,7 @@ class MessageListAdapterTest : RobolectricTest() { fun secondLine(senderOrSubject: String, preview: String)= "$senderOrSubject $preview" val View.accountChipView: View get() = findViewById(R.id.account_color_chip) val View.starView: CheckBox get() = findViewById(R.id.star) val View.contactPictureView: ContactBadge get() = findViewById(R.id.contact_badge) val View.threadCountView: TextView get() = findViewById(R.id.thread_count) Loading Loading
app/ui/src/main/java/com/fsck/k9/fragment/MessageListAdapter.kt +6 −3 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ class MessageListAdapter internal constructor( val holder = MessageViewHolder(view, listItemListener) holder.contactBadge.isVisible = appearance.showContactPicture holder.chip.isVisible = appearance.showAccountChip appearance.fontSizes.setViewTextSize(holder.subject, subjectViewFontSize) Loading Loading @@ -191,9 +192,11 @@ class MessageListAdapter internal constructor( val uniqueId = cursor.getLong(uniqueIdColumn) val selected = selected.contains(uniqueId) if (appearance.showAccountChip) { val accountChipDrawable = holder.chip.drawable.mutate() DrawableCompat.setTint(accountChipDrawable, account.chipColor) holder.chip.setImageDrawable(accountChipDrawable) } if (appearance.stars) { holder.flagged.isChecked = flagged Loading
app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +3 −1 Original line number Diff line number Diff line Loading @@ -604,6 +604,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener } private MessageListAppearance getMessageListAppearance() { boolean showAccountChip = !isSingleAccountMode(); return new MessageListAppearance( K9.getFontSizes(), K9.getMessageListPreviewLines(), Loading @@ -611,7 +612,8 @@ public class MessageListFragment extends Fragment implements OnItemClickListener K9.isMessageListSenderAboveSubject(), K9.isShowContactPicture(), showingThreadedList, K9.isUseBackgroundAsUnreadIndicator() K9.isUseBackgroundAsUnreadIndicator(), showAccountChip ); } Loading
app/ui/src/main/java/com/fsck/k9/ui/messagelist/MessageListAppearance.kt +2 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,6 @@ data class MessageListAppearance( val senderAboveSubject: Boolean, val showContactPicture: Boolean, val showingThreadedList: Boolean, val backGroundAsReadIndicator: Boolean val backGroundAsReadIndicator: Boolean, val showAccountChip: Boolean )
app/ui/src/test/java/com/fsck/k9/fragment/MessageListAdapterTest.kt +23 −2 Original line number Diff line number Diff line Loading @@ -63,6 +63,24 @@ class MessageListAdapterTest : RobolectricTest() { val listItemListener: MessageListItemActionListener = mock() @Test fun withShowAccountChip_shouldShowAccountChip() { val adapter = createAdapter(showAccountChip = true) val view = adapter.createAndBindView() assertTrue(view.accountChipView.isVisible) } @Test fun withoutShowAccountChip_shouldHideAccountChip() { val adapter = createAdapter(showAccountChip = false) val view = adapter.createAndBindView() assertTrue(view.accountChipView.isGone) } @Test fun withoutStars_shouldHideStarCheckBox() { val adapter = createAdapter(stars = false) Loading Loading @@ -429,7 +447,8 @@ class MessageListAdapterTest : RobolectricTest() { senderAboveSubject: Boolean = false, showContactPicture: Boolean = true, showingThreadedList: Boolean = true, backGroundAsReadIndicator: Boolean = false backGroundAsReadIndicator: Boolean = false, showAccountChip: Boolean = false ): MessageListAdapter { val appearance = MessageListAppearance( fontSizes, Loading @@ -438,7 +457,8 @@ class MessageListAdapterTest : RobolectricTest() { senderAboveSubject, showContactPicture, showingThreadedList, backGroundAsReadIndicator backGroundAsReadIndicator, showAccountChip ) return MessageListAdapter( Loading Loading @@ -512,6 +532,7 @@ class MessageListAdapterTest : RobolectricTest() { fun secondLine(senderOrSubject: String, preview: String)= "$senderOrSubject $preview" val View.accountChipView: View get() = findViewById(R.id.account_color_chip) val View.starView: CheckBox get() = findViewById(R.id.star) val View.contactPictureView: ContactBadge get() = findViewById(R.id.contact_badge) val View.threadCountView: TextView get() = findViewById(R.id.thread_count) Loading