Rename MessageListFragment.onListVisible()
to isActive
Use the same name for the same concept in `MessageListFragment` and `MessageViewFragment`.
This commit is contained in:
parent
479e1688f3
commit
213cda8881
2 changed files with 18 additions and 19 deletions
|
@ -335,7 +335,7 @@ open class MessageList :
|
|||
val messageListFragment = checkNotNull(this.messageListFragment)
|
||||
|
||||
messageListWasDisplayed = true
|
||||
messageListFragment.onListVisible()
|
||||
messageListFragment.isActive = true
|
||||
|
||||
messageViewFragment.let { messageViewFragment ->
|
||||
if (messageViewFragment == null) {
|
||||
|
@ -627,7 +627,7 @@ open class MessageList :
|
|||
openFolderTransaction!!.commit()
|
||||
openFolderTransaction = null
|
||||
|
||||
messageListFragment!!.onListVisible()
|
||||
messageListFragment!!.isActive = true
|
||||
|
||||
onMessageListDisplayed()
|
||||
}
|
||||
|
@ -1032,7 +1032,7 @@ open class MessageList :
|
|||
|
||||
override fun onBackStackChanged() {
|
||||
findFragments()
|
||||
messageListFragment?.onListVisible()
|
||||
messageListFragment?.isActive = true
|
||||
|
||||
if (isDrawerEnabled && !isAdditionalMessageListDisplayed) {
|
||||
unlockDrawer()
|
||||
|
@ -1059,7 +1059,7 @@ open class MessageList :
|
|||
}
|
||||
|
||||
messageListFragment = fragment
|
||||
fragment.onListVisible()
|
||||
fragment.isActive = true
|
||||
|
||||
if (isDrawerEnabled) {
|
||||
lockDrawer()
|
||||
|
@ -1206,7 +1206,7 @@ open class MessageList :
|
|||
viewSwitcher!!.showFirstView()
|
||||
|
||||
messageViewFragment?.isActive = false
|
||||
messageListFragment!!.onListVisible()
|
||||
messageListFragment!!.isActive = true
|
||||
messageListFragment!!.setActiveMessage(null)
|
||||
|
||||
setDrawerLockState()
|
||||
|
@ -1231,7 +1231,7 @@ open class MessageList :
|
|||
val messageViewFragment = checkNotNull(this.messageViewFragment)
|
||||
|
||||
displayMode = DisplayMode.MESSAGE_VIEW
|
||||
messageListFragment?.onListHidden()
|
||||
messageListFragment?.isActive = false
|
||||
messageViewFragment.isActive = true
|
||||
|
||||
if (!messageListWasDisplayed) {
|
||||
|
|
|
@ -130,7 +130,16 @@ class MessageListFragment :
|
|||
*/
|
||||
private var isInitialized = false
|
||||
|
||||
private var isListVisible = false
|
||||
/**
|
||||
* Set this to `true` when the fragment should be considered active. When active, the fragment adds its actions to
|
||||
* the toolbar. When inactive, the fragment won't add its actions to the toolbar, even it is still visible, e.g. as
|
||||
* part of an animation.
|
||||
*/
|
||||
var isActive: Boolean = false
|
||||
set(value) {
|
||||
field = value
|
||||
resetActionMode()
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
|
@ -698,7 +707,7 @@ class MessageListFragment :
|
|||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
if (isListVisible) {
|
||||
if (isActive) {
|
||||
prepareMenu(menu)
|
||||
} else {
|
||||
hideMenu(menu)
|
||||
|
@ -1524,7 +1533,7 @@ class MessageListFragment :
|
|||
private fun resetActionMode() {
|
||||
if (!isResumed) return
|
||||
|
||||
if (!isListVisible || selected.isEmpty()) {
|
||||
if (!isActive || selected.isEmpty()) {
|
||||
actionMode?.finish()
|
||||
actionMode = null
|
||||
return
|
||||
|
@ -1592,16 +1601,6 @@ class MessageListFragment :
|
|||
}
|
||||
}
|
||||
|
||||
fun onListVisible() {
|
||||
isListVisible = true
|
||||
resetActionMode()
|
||||
}
|
||||
|
||||
fun onListHidden() {
|
||||
isListVisible = false
|
||||
resetActionMode()
|
||||
}
|
||||
|
||||
private fun invalidateMenu() {
|
||||
requireActivity().invalidateMenu()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue