[Android] AudioPlayer: fix the scroll position of the playlist when it has been emptied
Adrien Maglo
git at videolan.org
Tue Sep 22 22:12:58 CEST 2015
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Sep 22 22:12:47 2015 +0200| [7a09bee117eff73a2e6ff10ebf18936b6edaa608] | committer: Adrien Maglo
AudioPlayer: fix the scroll position of the playlist when it has been emptied
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7a09bee117eff73a2e6ff10ebf18936b6edaa608
---
vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index bcc3b01..85c67fa 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -441,6 +441,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
if (mService == null)
return;
+ final List<MediaWrapper> previousAudioList = mSongsListAdapter.getMedias();
mSongsListAdapter.clear();
final List<MediaWrapper> audioList = mService.getMedias();
@@ -455,9 +456,17 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
}
}
mSongsListAdapter.setCurrentIndex(currentIndex);
- mSongsList.setSelection(currentIndex);
mSongsListAdapter.notifyDataSetChanged();
+
+ final int selectionIndex = currentIndex;
+ if (previousAudioList != audioList)
+ mSongsList.post(new Runnable() {
+ @Override
+ public void run() {
+ mSongsList.setSelection(selectionIndex);
+ }
+ });
}
OnSeekBarChangeListener mTimelineListner = new OnSeekBarChangeListener() {
More information about the Android
mailing list