[Android] FastScroller: performance improvement
Geoffrey Métais
git at videolan.org
Mon Nov 25 11:04:58 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey at videolan.org> | Mon Nov 25 11:04:57 2019 +0100| [9445e1ecb2a52dafcad0cf6b7aeb55b389b6f6c3] | committer: Nicolas Pomepuy
FastScroller: performance improvement
> https://code.videolan.org/videolan/vlc-android/commit/9445e1ecb2a52dafcad0cf6b7aeb55b389b6f6c3
---
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