[Android] FastScroller: performance improvement

Geoffrey Métais git at videolan.org
Mon Nov 25 11:50:08 CET 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey at videolan.org> | Mon Nov 25 10:04:57 2019 +0000| [80ea0147a9a805118e827f412ea73f437eab651d] | committer: Nicolas Pomepuy

FastScroller: performance improvement


(cherry picked from commit 9445e1ecb2a52dafcad0cf6b7aeb55b389b6f6c3)

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

 vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt b/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt
index 335d51c9e..5108f24ac 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt
@@ -359,10 +359,12 @@ class FastScroller : LinearLayout, CoroutineScope, Observer<HeadersIndex> {
             if (BuildConfig.DEBUG) Log.d(TAG, "findFirstVisibleItemPosition $position")
             val pos = provider.getPositionForSection(position)
             val sectionforPosition = provider.getSectionforPosition(pos)
-            sb.append(' ')
-                    .append(sectionforPosition)
-                    .append(' ')
-            if (!sectionforPosition.isEmpty()) bubble.text = sb.toString()
+            if (sectionforPosition.isNotEmpty()) bubble.text = withContext(Dispatchers.Default) {
+                sb.append(' ')
+                        .append(sectionforPosition)
+                        .append(' ')
+                        .toString()
+            }
             delay(100L)
         }
     }



More information about the Android mailing list