mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Update library list after pop animation finishes
This commit is contained in:
parent
64604905b3
commit
e2a3741837
1 changed files with 21 additions and 2 deletions
|
@ -247,8 +247,10 @@ open class LibraryController(
|
|||
|
||||
override val mainRecycler: RecyclerView
|
||||
get() = binding.libraryGridRecycler.recycler
|
||||
var staggeredBundle: Parcelable? = null
|
||||
private var staggeredBundle: Parcelable? = null
|
||||
private var staggeredObserver: ViewTreeObserver.OnGlobalLayoutListener? = null
|
||||
var isPoppingIn = false
|
||||
var tempItems: List<LibraryItem>? = null
|
||||
|
||||
// Dynamically injected into the search bar, controls category visibility during search
|
||||
private var showAllCategoriesView: ImageView? = null
|
||||
|
@ -1030,6 +1032,7 @@ open class LibraryController(
|
|||
binding.filterBottomSheet.filterBottomSheet.isVisible = true
|
||||
if (type == ControllerChangeType.POP_ENTER) {
|
||||
presenter.getLibrary()
|
||||
isPoppingIn = true
|
||||
}
|
||||
DownloadJob.callListeners()
|
||||
binding.recyclerCover.isClickable = false
|
||||
|
@ -1051,6 +1054,18 @@ open class LibraryController(
|
|||
}
|
||||
}
|
||||
|
||||
override fun onChangeEnded(
|
||||
changeHandler: ControllerChangeHandler,
|
||||
changeType: ControllerChangeType,
|
||||
) {
|
||||
super.onChangeEnded(changeHandler, changeType)
|
||||
if (isPoppingIn) {
|
||||
isPoppingIn = false
|
||||
tempItems?.let { onNextLibraryUpdate(it) }
|
||||
tempItems = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResumed(activity: Activity) {
|
||||
super.onActivityResumed(activity)
|
||||
if (!isBindingInitialized) return
|
||||
|
@ -1083,6 +1098,10 @@ open class LibraryController(
|
|||
}
|
||||
|
||||
open fun onNextLibraryUpdate(mangaMap: List<LibraryItem>, freshStart: Boolean = false) {
|
||||
if (isPoppingIn) {
|
||||
tempItems = mangaMap
|
||||
return
|
||||
}
|
||||
view ?: return
|
||||
destroyActionModeIfNeeded()
|
||||
if (mangaMap.isNotEmpty()) {
|
||||
|
@ -1317,10 +1336,10 @@ open class LibraryController(
|
|||
removeStaggeredObserver()
|
||||
}
|
||||
if (!presenter.showAllCategories) {
|
||||
shouldScrollToTop = true
|
||||
presenter.switchSection(pos)
|
||||
activeCategory = pos
|
||||
setActiveCategory()
|
||||
shouldScrollToTop = true
|
||||
return
|
||||
}
|
||||
val headerPosition = adapter.indexOf(pos)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue