Fix start/resume fab showing up when entering and then exiting action mode (#5735)
(cherry picked from commit 24b967ad5c06cb663f19e98a31b59ed8ec4a4b1f)
This commit is contained in:
parent
14be5c75ee
commit
b3b1d2abf4
@ -429,6 +429,16 @@ class MangaController :
|
|||||||
actionFab = null
|
actionFab = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateFabVisibility() {
|
||||||
|
val context = view?.context ?: return
|
||||||
|
val adapter = chaptersAdapter ?: return
|
||||||
|
val fab = actionFab ?: return
|
||||||
|
fab.isVisible = adapter.items.any { !it.read }
|
||||||
|
if (adapter.items.any { it.read }) {
|
||||||
|
fab.text = context.getString(R.string.action_resume)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
destroyActionModeIfNeeded()
|
destroyActionModeIfNeeded()
|
||||||
(activity as? MainActivity)?.clearFixViewToBottom(binding.actionToolbar)
|
(activity as? MainActivity)?.clearFixViewToBottom(binding.actionToolbar)
|
||||||
@ -1028,13 +1038,7 @@ class MangaController :
|
|||||||
actionMode?.invalidate()
|
actionMode?.invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
val context = view?.context
|
updateFabVisibility()
|
||||||
if (context != null) {
|
|
||||||
actionFab?.isVisible = chapters.any { !it.read }
|
|
||||||
if (chapters.any { it.read }) {
|
|
||||||
actionFab?.text = context.getString(R.string.action_resume)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetchChaptersFromSource(manualFetch: Boolean = false) {
|
private fun fetchChaptersFromSource(manualFetch: Boolean = false) {
|
||||||
@ -1216,7 +1220,7 @@ class MangaController :
|
|||||||
chaptersAdapter?.clearSelection()
|
chaptersAdapter?.clearSelection()
|
||||||
selectedChapters.clear()
|
selectedChapters.clear()
|
||||||
actionMode = null
|
actionMode = null
|
||||||
actionFab?.isVisible = true
|
updateFabVisibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDetach(view: View) {
|
override fun onDetach(view: View) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user