Only let the active message view update the toolbar menu
This commit is contained in:
parent
2d3f3e9668
commit
a7fcf9f607
1 changed files with 10 additions and 1 deletions
|
@ -107,6 +107,12 @@ class MessageViewFragment :
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
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)
|
setHasOptionsMenu(true)
|
||||||
|
|
||||||
messageReference = MessageReference.parse(arguments?.getString(ARG_REFERENCE))
|
messageReference = MessageReference.parse(arguments?.getString(ARG_REFERENCE))
|
||||||
|
@ -178,9 +184,10 @@ class MessageViewFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||||
super.setMenuVisibility(menuVisible)
|
|
||||||
isActive = menuVisible
|
isActive = menuVisible
|
||||||
|
|
||||||
|
super.setMenuVisibility(menuVisible)
|
||||||
|
|
||||||
if (menuVisible) {
|
if (menuVisible) {
|
||||||
messageLoaderHelper.resumeCryptoOperationIfNecessary()
|
messageLoaderHelper.resumeCryptoOperationIfNecessary()
|
||||||
} else {
|
} else {
|
||||||
|
@ -207,6 +214,8 @@ class MessageViewFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||||
|
if (!isActive) return
|
||||||
|
|
||||||
menu.findItem(R.id.delete).apply {
|
menu.findItem(R.id.delete).apply {
|
||||||
isVisible = K9.isMessageViewDeleteActionVisible
|
isVisible = K9.isMessageViewDeleteActionVisible
|
||||||
isEnabled = !isDeleteMenuItemDisabled
|
isEnabled = !isDeleteMenuItemDisabled
|
||||||
|
|
Loading…
Reference in a new issue