[Android] Playback Service : add hasPlaylist and canShuffle functions
Alexandre Perraud
git at videolan.org
Fri Apr 8 17:56:22 CEST 2016
vlc-android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Fri Apr 8 15:36:25 2016 +0200| [15a3e6cb3b3a092a8cc05d22dcba8dc08188f604] | committer: Alexandre Perraud
Playback Service : add hasPlaylist and canShuffle functions
> https://code.videolan.org/videolan/vlc-android/commit/15a3e6cb3b3a092a8cc05d22dcba8dc08188f604
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 10 ++++++++++
vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java | 2 +-
.../src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java | 2 +-
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 2 +-
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 81f5abc..57d1d1b 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1455,6 +1455,11 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
}
@MainThread
+ public boolean canShuffle() {
+ return (getMediaListSize() > 2) ? true : false;
+ }
+
+ @MainThread
public int getRepeatType() {
return mRepeating;
}
@@ -1465,6 +1470,11 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
}
@MainThread
+ public boolean hasPlaylist() {
+ return (getMediaListSize() > 1) ? true : false;
+ }
+
+ @MainThread
public boolean isVideoPlaying() {
return mMediaPlayer.getVLCVout().areViewsAttached();
}
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 f6b8ab3..dce4509 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -366,7 +366,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
break;
}
- mShuffle.setVisibility(mService.getMediaListSize() > 2 ? View.VISIBLE : View.INVISIBLE);
+ mShuffle.setVisibility(mService.canShuffle() ? View.VISIBLE : View.INVISIBLE);
mTimeline.setOnSeekBarChangeListener(mTimelineListner);
if (playlistDiffer())
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index d6f0b89..ee99dce 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -557,7 +557,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
if (!tvUi)
mAdapter.addOption(new Option(ID_POPUP_VIDEO, R.attr.ic_popup_dim));
mAdapter.addOption(new Option(ID_REPEAT, R.attr.ic_repeat));
- if (mService.getMediaListSize() > 2)
+ if (mService.canShuffle())
mAdapter.addOption(new Option(ID_SHUFFLE, R.attr.ic_shuffle));
final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
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 03d2eb0..01e2b31 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -742,7 +742,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (ratePref == 2)
mService.setRate(mSettings.getFloat(PreferencesActivity.VIDEO_RATE, 1.0f));
- if (mService.getMediaListSize() > 1) {
+ if (mService.hasPlaylist()) {
mPlaylistAdapter = new PlaylistAdapter(this);
mPlaylistAdapter.setService(mService);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
More information about the Android
mailing list