Skip to content

Commit

Permalink
Fixed switching between messages types.| #793
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Jan 5, 2020
1 parent 5096e7d commit 17c8c09
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand All @@ -284,6 +294,7 @@ class EmailManagerActivity : BaseEmailListActivity(), NavigationView.OnNavigatio
}

R.id.syns_request_code_refresh_msgs -> {
switchView?.isEnabled = true
onRefreshMsgsCompleted()
msgsIdlingResource.setIdleState(true)
}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 17c8c09

Please sign in to comment.