[Android] Obtain track info prior to updating layout

Robert Stone git at videolan.org
Fri Aug 13 05:37:57 UTC 2021


vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Thu Aug 12 22:00:57 2021 -0700| [6d8e5dac785454ec485ad33b40e5e5f5afe55110] | committer: Robert Stone

Obtain track info prior to updating layout

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

 .../src/org/videolan/vlc/gui/view/AudioMediaSwitcher.kt          | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.kt b/application/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.kt
index f2ff4cabb..2cd097c33 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/view/AudioMediaSwitcher.kt
@@ -93,6 +93,9 @@ abstract class AudioMediaSwitcher(context: Context, attrs: AttributeSet) : Fling
                     nextArtMrl?.let { AudioUtil.readCoverBitmap(Uri.decode(nextArtMrl), 512) }
             )
         }
+        val trackInfo = service.trackInfo()
+        val prevTrackInfo = service.prevTrackInfo()
+        val nextTrackInfo = service.nextTrackInfo()
         removeAllViews()
 
         hasPrevious = false
@@ -100,11 +103,11 @@ abstract class AudioMediaSwitcher(context: Context, attrs: AttributeSet) : Fling
 
         val inflater = LayoutInflater.from(context)
         if (service.hasPrevious()) {
-            addMediaView(inflater, service.titlePrev, service.artistPrev, coverPrev, service.prevTrackInfo())
+            addMediaView(inflater, service.titlePrev, service.artistPrev, coverPrev, prevTrackInfo)
             hasPrevious = true
         }
-        if (service.hasMedia()) addMediaView(inflater, service.title, service.artist, coverCurrent, service.trackInfo())
-        if (service.hasNext()) addMediaView(inflater, service.titleNext, service.artistNext, coverNext, service.nextTrackInfo())
+        if (service.hasMedia()) addMediaView(inflater, service.title, service.artist, coverCurrent, trackInfo)
+        if (service.hasNext()) addMediaView(inflater, service.titleNext, service.artistNext, coverNext, nextTrackInfo)
 
         if (service.hasPrevious() && service.hasMedia()) {
             previousPosition = 1



More information about the Android mailing list