[Android] Audio service: fix the deletion on the currently played item

Adrien Maglo git at videolan.org
Fri Jan 24 13:21:38 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Jan 24 13:21:27 2014 +0100| [65fae9f165b808d4cbf0be3490b74e1fb3dc6faf] | committer: Adrien Maglo

Audio service: fix the deletion on the currently played item

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=65fae9f165b808d4cbf0be3490b74e1fb3dc6faf
---

 vlc-android/src/org/videolan/vlc/AudioService.java |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 2f27f0b..941ba72 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -510,9 +510,21 @@ public class AudioService extends Service {
             case EventHandler.CustomMediaListItemDeleted:
                 Log.i(TAG, "CustomMediaListItemDeleted");
                 index = msg.getData().getInt("item_index");
-                if(service.mCurrentIndex >= index && !expanding)
+                if (service.mCurrentIndex == index && !expanding) {
+                    // The current item has been deleted
                     service.mCurrentIndex--;
+                    service.determinePrevAndNextIndices();
+                    if (service.mNextIndex != -1)
+                        service.next();
+                    else if (service.mCurrentIndex != -1)
+                        service.mLibVLC.playIndex(service.mCurrentIndex);
+                    else
+                        service.stop();
+                    break;
+                }
 
+                if(service.mCurrentIndex > index && !expanding)
+                    service.mCurrentIndex--;
                 service.determinePrevAndNextIndices();
                 service.executeUpdate();
                 break;



More information about the Android mailing list