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:14:55 -07:00
parent 299c47e9c3
commit 8c107d66a0
2 changed files with 6 additions and 4 deletions
@@ -52,7 +52,6 @@ class MainActivity : AppCompatActivity() {
// Since the activity is set to singleInstance [Given that there's only MainActivity] // 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 // We have to manually push the intent whenever we get one so that the fragments
// can catch any file intents // can catch any file intents
// TODO: If possible try to make this system completely
setIntent(intent) setIntent(intent)
} }
@@ -179,10 +179,13 @@ class SongsFragment : Fragment() {
indicatorCenterY: Int, indicatorCenterY: Int,
itemPosition: Int itemPosition: Int
) { ) {
val layoutManager = binding.songRecycler.layoutManager binding.songRecycler.apply {
as LinearLayoutManager (layoutManager as LinearLayoutManager).scrollToPositionWithOffset(
itemPosition, 0
)
layoutManager.scrollToPositionWithOffset(itemPosition, 0) stopScroll()
}
} }
} }
) )