Hide Start/Resume FAB unless there are unread chapters and during loading (#5458)

* Hide Start/Resume FAB unless there are unread chapters

* Remove dead code, rewrite logic for hiding FAB

(cherry picked from commit a6d4a3b785b2ce922b3f0a058ead66d333ab8d12)
This commit is contained in:
Hunter Nickel 2021-07-12 09:48:48 -06:00 committed by Jobobby04
parent 290efebf27
commit a46e62eee3

View File

@ -364,6 +364,8 @@ class MangaController :
chaptersAdapter?.fastScroller = binding.fastScroller
actionFabScrollListener = actionFab?.shrinkOnScroll(chapterRecycler)
// Initially set FAB invisible; will become visible if unread chapters are present
actionFab?.isVisible = false
binding.swipeRefresh.refreshes()
.onEach {
@ -435,8 +437,6 @@ class MangaController :
}
)
}
} else {
view?.context?.toast(R.string.no_next_chapter)
}
}
}
@ -1133,8 +1133,11 @@ class MangaController :
}
val context = view?.context
if (context != null && chapters.any { it.read }) {
actionFab?.text = context.getString(R.string.action_resume)
if (context != null) {
actionFab?.isVisible = chapters.any { !it.read }
if (chapters.any { it.read }) {
actionFab?.text = context.getString(R.string.action_resume)
}
}
}