[Android] Marquee helper: Remove unnecessary handler post
Geoffrey Métais
git at videolan.org
Thu Oct 17 14:21:46 CEST 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 17 14:20:54 2019 +0200| [d40c0c89c16154600584446559aaffc4dd7ea073] | committer: Geoffrey Métais
Marquee helper: Remove unnecessary handler post
(cherry picked from commit a62a5144b2babad8be1280532fb6d6932a3ced28)
> https://code.videolan.org/videolan/vlc-android/commit/d40c0c89c16154600584446559aaffc4dd7ea073
---
vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
index d46907504..73078e4d4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
@@ -625,10 +625,9 @@ interface MarqueeViewHolder {
}
fun enableMarqueeEffect(recyclerView: RecyclerView, handler: Handler) {
- val layoutManager = recyclerView.layoutManager
- if (layoutManager is LinearLayoutManager) {
+ (recyclerView.layoutManager as? LinearLayoutManager)?.let { layoutManager ->
//Initial animation for already visible items
- handler.post { launchMarquee(recyclerView, layoutManager, handler) }
+ launchMarquee(recyclerView, layoutManager, handler)
//Animation when done scrolling
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
More information about the Android
mailing list