[Android] Marquee helper: Remove unnecessary handler post

Geoffrey Métais git at videolan.org
Thu Oct 17 14:21:23 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 17 14:20:54 2019 +0200| [a62a5144b2babad8be1280532fb6d6932a3ced28] | committer: Geoffrey Métais

Marquee helper: Remove unnecessary handler post

> https://code.videolan.org/videolan/vlc-android/commit/a62a5144b2babad8be1280532fb6d6932a3ced28
---

 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 a7a7e32cf..b685c32f1 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