[Android] Fix current position in playlist
Geoffrey Métais
git at videolan.org
Wed Dec 21 14:59:26 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 21 14:53:00 2016 +0100| [5504120d10a757f37d650403d3a1a1f40b9c869b] | committer: Geoffrey Métais
Fix current position in playlist
> https://code.videolan.org/videolan/vlc-android/commit/5504120d10a757f37d650403d3a1a1f40b9c869b
---
vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 9 ---------
.../src/org/videolan/vlc/gui/audio/PlaylistAdapter.java | 2 ++
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 11 +----------
3 files changed, 3 insertions(+), 19 deletions(-)
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 01ca6b8..2b71b62 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -366,15 +366,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
if (playlistDiffer())
updateList();
- final int position = mService.getCurrentMediaPosition();
- if (position != -1) {
- mPlaylist.post(new Runnable() {
- @Override
- public void run() {
- mPlaylistAdapter.setCurrentIndex(position);
- }
- });
- }
}
private boolean playlistDiffer() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java
index a845f8b..d8a3a4f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java
@@ -134,6 +134,8 @@ public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHo
clear();
addAll(newList);
result.dispatchUpdatesTo(PlaylistAdapter.this);
+ if (mService != null)
+ setCurrentIndex(mService.getCurrentMediaPosition());
}
});
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 7460c9f..94df9dc 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2345,16 +2345,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
return;
mPlaylistAdapter.dispatchUpdate(mService.getMedias());
-
- final int selectionIndex = mService.getCurrentMediaPosition();
- mPlaylist.post(new Runnable() {
- @Override
- public void run() {
- mPlaylistAdapter.setCurrentIndex(selectionIndex);
- mPlaylist.scrollToPosition(selectionIndex);
- }
- });
-}
+ }
@Override
public void onSelectionSet(int position) {
More information about the Android
mailing list