We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When list is not in motion hide the handle. When list comes back to motion show the handle but in a fading manner.
The text was updated successfully, but these errors were encountered:
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { val timer = Timer() var task: TimerTask? = null override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { when (newState) { RecyclerView.SCROLL_STATE_DRAGGING -> { task?.cancel() timer.purge() task = null if (binding.scrollBar.alpha != 1f) { ObjectAnimator.ofFloat(binding.scrollBar.alpha, 1f).apply { addUpdateListener { binding.scrollBar.alpha = it.animatedValue as Float } duration = 250L * (1L - binding.scrollBar.alpha.toLong()) start() } } } RecyclerView.SCROLL_STATE_IDLE -> { task = timerTask { if (binding.scrollBar.isDragging) return@timerTask activity?.runOnUiThread { ObjectAnimator.ofFloat(1f, 0f).apply { addUpdateListener { binding.scrollBar.alpha = it.animatedValue as Float } duration = 250 start() } } } timer.schedule(task, 500) } } } })
Sorry, something went wrong.
No branches or pull requests
When list is not in motion hide the handle. When list comes back to motion show the handle but in a fading manner.
The text was updated successfully, but these errors were encountered: