Decouple MessageListAdapter from MessageListFragment.checkboxes

This commit is contained in:
Jacek Kuzniarski 2019-07-21 09:54:56 +02:00 committed by cketti
parent 178e239185
commit 387e8b9283
2 changed files with 5 additions and 4 deletions

View file

@ -95,6 +95,9 @@ class MessageListAdapter internal constructor(
private val senderAboveSubject: Boolean
get() = K9.isMessageListSenderAboveSubject
private val checkboxes: Boolean
get() = K9.isShowMessageListCheckboxes
private fun recipientSigil(toMe: Boolean, ccMe: Boolean): String {
return if (toMe) {
@ -142,7 +145,7 @@ class MessageListAdapter internal constructor(
fontSizes.setViewTextSize(holder.preview, fontSizes.messageListPreview)
holder.threadCount = view.findViewById(R.id.thread_count)
fontSizes.setViewTextSize(holder.threadCount, fontSizes.messageListSubject) // thread count is next to subject
view.findViewById<View>(R.id.selected_checkbox_wrapper).visibility = if (fragment.checkboxes) View.VISIBLE else View.GONE
view.findViewById<View>(R.id.selected_checkbox_wrapper).visibility = if (checkboxes) View.VISIBLE else View.GONE
holder.flagged.visibility = if (fragment.stars) View.VISIBLE else View.GONE
holder.flagged.setOnClickListener(holder)
@ -196,7 +199,7 @@ class MessageListAdapter internal constructor(
val selected = fragment.selected.contains(uniqueId)
holder.chip.setBackgroundColor(account.chipColor)
if (fragment.checkboxes) {
if (checkboxes) {
holder.selected.isChecked = selected
}
if (fragment.stars) {

View file

@ -196,7 +196,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
private SortType sortType = SortType.SORT_DATE;
private boolean sortAscending = true;
private boolean sortDateAscending = false;
boolean checkboxes = true;
boolean stars = true;
private int selectedCount = 0;
@ -407,7 +406,6 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
preferences = Preferences.getPreferences(appContext);
messagingController = MessagingController.getInstance(getActivity().getApplication());
checkboxes = K9.isShowMessageListCheckboxes();
stars = K9.isShowMessageListStars();
if (K9.isShowContactPicture()) {