From 17c8c09948c3beb882a8da2c02060c75d365c31e Mon Sep 17 00:00:00 2001 From: DenBond7 Date: Sun, 5 Jan 2020 12:29:51 +0200 Subject: [PATCH] Fixed switching between messages types.| #793 --- .../email/ui/activity/EmailManagerActivity.kt | 12 ++++++++++++ .../email/ui/activity/base/BaseSyncActivity.kt | 4 ++-- .../email/ui/activity/fragment/EmailListFragment.kt | 1 - 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/EmailManagerActivity.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/EmailManagerActivity.kt index b44d2fa916..c6c63b7976 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/EmailManagerActivity.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/EmailManagerActivity.kt @@ -274,6 +274,16 @@ class EmailManagerActivity : BaseEmailListActivity(), NavigationView.OnNavigatio } } + override fun loadNextMsgs(requestCode: Int, localFolder: LocalFolder, alreadyLoadedMsgsCount: Int) { + switchView?.isEnabled = false + super.loadNextMsgs(requestCode, localFolder, alreadyLoadedMsgsCount) + } + + override fun refreshMsgs(requestCode: Int, currentLocalFolder: LocalFolder) { + switchView?.isEnabled = false + super.refreshMsgs(requestCode, currentLocalFolder) + } + override fun onReplyReceived(requestCode: Int, resultCode: Int, obj: Any?) { when (requestCode) { R.id.syns_request_code_update_label_passive, R.id.syns_request_code_update_label_active -> { @@ -284,6 +294,7 @@ class EmailManagerActivity : BaseEmailListActivity(), NavigationView.OnNavigatio } R.id.syns_request_code_refresh_msgs -> { + switchView?.isEnabled = true onRefreshMsgsCompleted() msgsIdlingResource.setIdleState(true) } @@ -301,6 +312,7 @@ class EmailManagerActivity : BaseEmailListActivity(), NavigationView.OnNavigatio override fun onErrorHappened(requestCode: Int, errorType: Int, e: Exception) { when (requestCode) { R.id.syns_request_code_refresh_msgs -> { + switchView?.isEnabled = true onErrorOccurred(requestCode, errorType, e) onRefreshMsgsCompleted() msgsIdlingResource.setIdleState(true) diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/base/BaseSyncActivity.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/base/BaseSyncActivity.kt index 7cee2be678..e9c074573e 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/base/BaseSyncActivity.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/base/BaseSyncActivity.kt @@ -159,7 +159,7 @@ abstract class BaseSyncActivity : BaseNodeActivity() { * @param localFolder [LocalFolder] object. * @param alreadyLoadedMsgsCount The count of already loaded messages in the localFolder. */ - fun loadNextMsgs(requestCode: Int, localFolder: LocalFolder, alreadyLoadedMsgsCount: Int) { + open fun loadNextMsgs(requestCode: Int, localFolder: LocalFolder, alreadyLoadedMsgsCount: Int) { if (checkServiceBound(isSyncServiceBound)) return onProgressReplyReceived(requestCode, R.id.progress_id_start_of_loading_new_messages, Any()) @@ -303,7 +303,7 @@ abstract class BaseSyncActivity : BaseNodeActivity() { * @param requestCode The unique request code for identify the current action. * @param currentLocalFolder [LocalFolder] object. */ - fun refreshMsgs(requestCode: Int, currentLocalFolder: LocalFolder) { + open fun refreshMsgs(requestCode: Int, currentLocalFolder: LocalFolder) { if (checkServiceBound(isSyncServiceBound)) return val action = BaseService.Action(replyMessengerName, requestCode, currentLocalFolder) diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/EmailListFragment.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/EmailListFragment.kt index 7d866ae465..8c07d515f7 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/EmailListFragment.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/EmailListFragment.kt @@ -57,7 +57,6 @@ class EmailListFragment : BaseSyncFragment(), SwipeRefreshLayout.OnRefreshListen private var recyclerViewMsgs: RecyclerView? = null private var emptyView: TextView? = null - private var viewIdProgressView: View? = null private var footerProgressView: View? = null private var swipeRefreshLayout: SwipeRefreshLayout? = null private var textViewActionProgress: TextView? = null