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 filterTooltip: ViewTooltip? = null
|
||||||
private var isAnimatingHopper: Boolean? = null
|
private var isAnimatingHopper: Boolean? = null
|
||||||
var hasMovedHopper = preferences.shownHopperSwipeTutorial().get()
|
var hasMovedHopper = preferences.shownHopperSwipeTutorial().get()
|
||||||
|
private var shouldScrollToTop = false
|
||||||
private lateinit var elevateAppBar: ((Boolean) -> Unit)
|
private lateinit var elevateAppBar: ((Boolean) -> Unit)
|
||||||
|
|
||||||
override fun getTitle(): String? {
|
override fun getTitle(): String? {
|
||||||
|
@ -454,7 +455,7 @@ class LibraryController(
|
||||||
) { _, item ->
|
) { _, item ->
|
||||||
preferences.groupLibraryBy().set(item)
|
preferences.groupLibraryBy().set(item)
|
||||||
presenter.groupType = item
|
presenter.groupType = item
|
||||||
recycler?.scrollToPosition(0)
|
shouldScrollToTop = true
|
||||||
presenter.getLibrary()
|
presenter.getLibrary()
|
||||||
true
|
true
|
||||||
}.show()
|
}.show()
|
||||||
|
@ -697,6 +698,10 @@ class LibraryController(
|
||||||
category_recycler.setCategories(presenter.categories)
|
category_recycler.setCategories(presenter.categories)
|
||||||
filter_bottom_sheet.setExpandText(preferences.collapsedCategories().getOrDefault().isNotEmpty())
|
filter_bottom_sheet.setExpandText(preferences.collapsedCategories().getOrDefault().isNotEmpty())
|
||||||
setActiveCategory()
|
setActiveCategory()
|
||||||
|
if (shouldScrollToTop) {
|
||||||
|
recycler.scrollToPosition(0)
|
||||||
|
shouldScrollToTop = false
|
||||||
|
}
|
||||||
if (onRoot) {
|
if (onRoot) {
|
||||||
activity?.toolbar?.setOnClickListener {
|
activity?.toolbar?.setOnClickListener {
|
||||||
val recycler = recycler ?: return@setOnClickListener
|
val recycler = recycler ?: return@setOnClickListener
|
||||||
|
@ -780,7 +785,7 @@ class LibraryController(
|
||||||
presenter.switchSection(pos)
|
presenter.switchSection(pos)
|
||||||
activeCategory = pos
|
activeCategory = pos
|
||||||
setActiveCategory()
|
setActiveCategory()
|
||||||
recycler.scrollToPosition(0)
|
shouldScrollToTop = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val headerPosition = adapter.indexOf(pos)
|
val headerPosition = adapter.indexOf(pos)
|
||||||
|
|
Reference in a new issue