Merge pull request #6144 from thundernest/GH-6141_fix_action_mode

Fix action mode when switching from split view to message view
This commit is contained in:
cketti 2022-07-05 13:53:39 +02:00 committed by GitHub
commit 38a9f579be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -338,6 +338,7 @@ open class MessageList :
}
DisplayMode.SPLIT_VIEW -> {
messageListWasDisplayed = true
messageListFragment?.onListVisible()
if (messageViewFragment == null) {
showMessageViewPlaceHolder()
} else {
@ -1469,6 +1470,7 @@ open class MessageList :
displayMode = DisplayMode.MESSAGE_LIST
viewSwitcher!!.showFirstView()
messageListFragment!!.onListVisible()
messageListFragment!!.setActiveMessage(null)
setDrawerLockState()
@ -1491,6 +1493,7 @@ open class MessageList :
private fun showMessageView() {
displayMode = DisplayMode.MESSAGE_VIEW
messageListFragment?.onListHidden()
if (!messageListWasDisplayed) {
viewSwitcher!!.animateFirstView = false

View file

@ -133,6 +133,8 @@ class MessageListFragment :
var isInitialized = false
private set
private var isListVisible = false
override fun onAttach(context: Context) {
super.onAttach(context)
@ -1509,8 +1511,11 @@ class MessageListFragment :
}
private fun resetActionMode() {
if (selected.isEmpty()) {
if (!isResumed) return
if (!isListVisible || selected.isEmpty()) {
actionMode?.finish()
actionMode = null
return
}
@ -1576,6 +1581,16 @@ class MessageListFragment :
}
}
fun onListVisible() {
isListVisible = true
resetActionMode()
}
fun onListHidden() {
isListVisible = false
resetActionMode()
}
val isCheckMailSupported: Boolean
get() = allAccounts || !isSingleAccountMode || !isSingleFolderMode || isRemoteFolder