[Android] AudioService: don't clobber mCurrentIndex when opening playlist file
Edward Wang
git at videolan.org
Mon Oct 28 23:11:18 CET 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Mon Oct 28 18:10:28 2013 -0400| [0d429bbe4dfd05c7a6b2aa733f832f60d9177c38] | committer: Edward Wang
AudioService: don't clobber mCurrentIndex when opening playlist file
Fix an IndexOutOfBoundsException
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=0d429bbe4dfd05c7a6b2aa733f832f60d9177c38
---
vlc-android/src/org/videolan/vlc/AudioService.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index bb6fbdb..fb7f2e4 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -457,6 +457,9 @@ public class AudioService extends Service {
private final Handler mListEventHandler = new MediaListEventHandler(this);
private static class MediaListEventHandler extends WeakHandler<AudioService> {
+ // Don't clobber mCurrentIndex when MediaList is expanding itself.
+ boolean expanding = false;
+
public MediaListEventHandler(AudioService audioService) {
super(audioService);
}
@@ -471,15 +474,21 @@ public class AudioService extends Service {
case EventHandler.MediaListItemAdded:
Log.i(TAG, "MediaListItemAdded");
index = msg.getData().getInt("item_index");
- if(service.mCurrentIndex >= index)
+ if(service.mCurrentIndex >= index && !expanding)
service.mCurrentIndex++;
break;
case EventHandler.MediaListItemDeleted:
Log.i(TAG, "MediaListItemDeleted");
index = msg.getData().getInt("item_index");
- if(service.mCurrentIndex >= index)
+ if(service.mCurrentIndex >= index && !expanding)
service.mCurrentIndex--;
break;
+ case EventHandler.CustomMediaListExpanding:
+ expanding = true;
+ break;
+ case EventHandler.CustomMediaListExpandingEnd:
+ expanding = false;
+ break;
}
}
};
More information about the Android
mailing list