Last active
June 24, 2020 06:22
-
-
Save AshuTyagi16/9e6e8d3b6877c12ddfff5e58b7ff21db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvApps.addOnScrollListener(object : RecyclerView.OnScrollListener() { | |
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { | |
recyclerView.forEachVisibleHolder { holder: AppViewHolder -> | |
holder.rotation | |
// Update the velocity. | |
// The velocity is calculated by the vertical scroll offset. | |
.setStartVelocity(holder.currentVelocity - dx * SCROLL_ROTATION_MAGNITUDE) | |
// Start the animation. This does nothing if the animation is already running. | |
.start() | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment