Don't scroll to the top of the list on group change until view refresh
This commit is contained in:
parent
6706af5bd7
commit
cb2223d47a
1 changed files with 7 additions and 2 deletions
|
@ -176,6 +176,7 @@ class LibraryController(
|
|||
private var filterTooltip: ViewTooltip? = null
|
||||
private var isAnimatingHopper: Boolean? = null
|
||||
var hasMovedHopper = preferences.shownHopperSwipeTutorial().get()
|
||||
private var shouldScrollToTop = false
|
||||
private lateinit var elevateAppBar: ((Boolean) -> Unit)
|
||||
|
||||
override fun getTitle(): String? {
|
||||
|
@ -454,7 +455,7 @@ class LibraryController(
|
|||
) { _, item ->
|
||||
preferences.groupLibraryBy().set(item)
|
||||
presenter.groupType = item
|
||||
recycler?.scrollToPosition(0)
|
||||
shouldScrollToTop = true
|
||||
presenter.getLibrary()
|
||||
true
|
||||
}.show()
|
||||
|
@ -697,6 +698,10 @@ class LibraryController(
|
|||
category_recycler.setCategories(presenter.categories)
|
||||
filter_bottom_sheet.setExpandText(preferences.collapsedCategories().getOrDefault().isNotEmpty())
|
||||
setActiveCategory()
|
||||
if (shouldScrollToTop) {
|
||||
recycler.scrollToPosition(0)
|
||||
shouldScrollToTop = false
|
||||
}
|
||||
if (onRoot) {
|
||||
activity?.toolbar?.setOnClickListener {
|
||||
val recycler = recycler ?: return@setOnClickListener
|
||||
|
@ -780,7 +785,7 @@ class LibraryController(
|
|||
presenter.switchSection(pos)
|
||||
activeCategory = pos
|
||||
setActiveCategory()
|
||||
recycler.scrollToPosition(0)
|
||||
shouldScrollToTop = true
|
||||
return
|
||||
}
|
||||
val headerPosition = adapter.indexOf(pos)
|
||||
|
|
Reference in a new issue