Merge pull request #6438 from thundernest/fix_message_view_menu
Only let the active message view update the toolbar menu
This commit is contained in:
commit
e120b551d9
1 changed files with 10 additions and 1 deletions
|
@ -107,6 +107,12 @@ class MessageViewFragment :
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Hide the toolbar menu when first creating this fragment. The menu will be set to visible once this fragment
|
||||
// becomes the active page of the view pager in MessageViewContainerFragment.
|
||||
if (savedInstanceState == null) {
|
||||
setMenuVisibility(false)
|
||||
}
|
||||
|
||||
setHasOptionsMenu(true)
|
||||
|
||||
messageReference = MessageReference.parse(arguments?.getString(ARG_REFERENCE))
|
||||
|
@ -178,9 +184,10 @@ class MessageViewFragment :
|
|||
}
|
||||
|
||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||
super.setMenuVisibility(menuVisible)
|
||||
isActive = menuVisible
|
||||
|
||||
super.setMenuVisibility(menuVisible)
|
||||
|
||||
if (menuVisible) {
|
||||
messageLoaderHelper.resumeCryptoOperationIfNecessary()
|
||||
} else {
|
||||
|
@ -207,6 +214,8 @@ class MessageViewFragment :
|
|||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
if (!isActive) return
|
||||
|
||||
menu.findItem(R.id.delete).apply {
|
||||
isVisible = K9.isMessageViewDeleteActionVisible
|
||||
isEnabled = !isDeleteMenuItemDisabled
|
||||
|
|
Loading…
Reference in a new issue