Stop RecyclerView momentum on fast scroll

Prevent any unnessecary scrolling when using the fast scroll bar in SongsFragment.
This commit is contained in:
OxygenCobalt 2021-02-21 15:13:21 -07:00
parent 299c47e9c3
commit 8c107d66a0
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 6 additions and 4 deletions

View file

@ -52,7 +52,6 @@ class MainActivity : AppCompatActivity() {
// Since the activity is set to singleInstance [Given that there's only MainActivity]
// We have to manually push the intent whenever we get one so that the fragments
// can catch any file intents
// TODO: If possible try to make this system completely
setIntent(intent)
}

View file

@ -179,10 +179,13 @@ class SongsFragment : Fragment() {
indicatorCenterY: Int,
itemPosition: Int
) {
val layoutManager = binding.songRecycler.layoutManager
as LinearLayoutManager
binding.songRecycler.apply {
(layoutManager as LinearLayoutManager).scrollToPositionWithOffset(
itemPosition, 0
)
layoutManager.scrollToPositionWithOffset(itemPosition, 0)
stopScroll()
}
}
}
)