[Android] Playback: fix current index on media expanding

Geoffrey Métais git at videolan.org
Wed Sep 20 13:37:14 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 20 12:14:11 2017 +0200| [f01bd2cd680a6a59b6ef384ad6a6d01631850755] | committer: Geoffrey Métais

Playback: fix current index on media expanding

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 88ebb536f..2d2984665 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -2469,12 +2469,12 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
     @MainThread
     public int expand(boolean updateHistory) {
         final Media media = mMediaPlayer.getMedia();
-        String mrl = updateHistory ? getCurrentMediaLocation() : null;
+        final String mrl = updateHistory ? getCurrentMediaLocation() : null;
         if (media == null)
             return -1;
         final MediaList ml = media.subItems();
         media.release();
-        int ret;
+        int ret = -1;
 
         if (ml.getCount() > 0) {
             mMediaList.remove(mCurrentIndex);
@@ -2486,9 +2486,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
             }
             if (updateHistory && ml.getCount() == 1)
                 mMedialibrary.addToHistory(mrl, mMediaList.getMedia(mCurrentIndex).getTitle());
-            ret = 0;
-        } else {
-            ret = -1;
+            ret = mCurrentIndex;
         }
         ml.release();
         return ret;



More information about the Android mailing list