From 1124c1c506f120f79017682401986859899940d7 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 14 Dec 2022 15:06:26 +0600 Subject: [PATCH] 5023-Add_load_more_functionality_for_allAccountList_page issue: https://gitlab.e.foundation/e/backlog/-/issues/5023 --- .../k9/ui/messagelist/MessageListFragment.kt | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt index e3594ccda0..95debc8c2b 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListFragment.kt @@ -399,6 +399,10 @@ class MessageListFragment : } override fun onFooterClicked() { + if (onFooterClickForUnifiedInbox()) { + return + } + val currentFolder = this.currentFolder ?: return if (currentFolder.moreMessages && !localSearch.isManualSearch) { @@ -429,6 +433,20 @@ class MessageListFragment : } } + private fun onFooterClickForUnifiedInbox(): Boolean { + if (!isUnifiedInbox) { + return false + } + + preferences.accounts + .filter { account -> account.isFinishedSetup && account.inboxFolderId != null } + .forEach { + messagingController.loadMoreMessages(it, it.inboxFolderId!!, null) + } + updateFooterText(null) + return true + } + override fun onMessageClicked(messageListItem: MessageListItem) { if (!isActive) { // Ignore click events that are delivered after the Fragment is no longer active. This could happen when @@ -801,12 +819,20 @@ class MessageListFragment : } private fun updateFooterText() { + if (initialMessageListLoad) { + updateFooterText(null) + return + } + + if(isUnifiedInbox && adapter.messages.isNotEmpty()) { + updateFooterText(getString(R.string.message_list_load_more_messages_action)) + return + } + val currentFolder = this.currentFolder val account = this.account - val footerText = if (initialMessageListLoad) { - null - } else if (localSearch.isManualSearch || currentFolder == null || account == null) { + val footerText = if (localSearch.isManualSearch || currentFolder == null || account == null) { null } else if (currentFolder.loading) { getString(R.string.status_loading_more) @@ -1374,8 +1400,8 @@ class MessageListFragment : currentFolder?.let { currentFolder -> currentFolder.moreMessages = messageListInfo.hasMoreMessages - updateFooterText() } + updateFooterText() adapter.checkSelectedMode() } -- GitLab