Example #1
0
 private void next() {
   int index = mMediaList.indexOf(mCurrentMedia);
   mPrevious.push(mCurrentMedia);
   if (mRepeating == RepeatType.Once) mCurrentMedia = mMediaList.get(index);
   else if (mShuffling && mPrevious.size() < mMediaList.size()) {
     while (mPrevious.contains(
         mCurrentMedia = mMediaList.get((int) (Math.random() * mMediaList.size())))) ;
   } else if (!mShuffling && index < mMediaList.size() - 1) {
     mCurrentMedia = mMediaList.get(index + 1);
   } else {
     if (mRepeating == RepeatType.All && mMediaList.size() > 0) mCurrentMedia = mMediaList.get(0);
     else {
       stop();
       return;
     }
   }
   if (mLibVLCPlaylistActive) {
     if (mRepeating == RepeatType.None) mLibVLC.next();
     else if (mRepeating == RepeatType.Once) mLibVLC.playIndex(index);
     else mLibVLC.playIndex(mMediaList.indexOf(mCurrentMedia));
   } else {
     mLibVLC.readMedia(mCurrentMedia.getLocation(), true);
   }
   mHandler.sendEmptyMessage(SHOW_PROGRESS);
   setUpRemoteControlClient();
   showNotification();
   updateWidget(this);
   updateRemoteControlClientMetadata();
   saveCurrentMedia();
 }
Example #2
0
 private void previous() {
   int index = mMediaList.indexOf(mCurrentMedia);
   if (mPrevious.size() > 0) mCurrentMedia = mPrevious.pop();
   else if (index > 0) mCurrentMedia = mMediaList.get(index - 1);
   else return;
   if (mLibVLCPlaylistActive) {
     if (mRepeating == RepeatType.None) mLibVLC.previous();
     else if (mRepeating == RepeatType.Once) mLibVLC.playIndex(index);
     else mLibVLC.playIndex(mMediaList.indexOf(mCurrentMedia));
   } else {
     mLibVLC.readMedia(mCurrentMedia.getLocation(), true);
   }
   mHandler.sendEmptyMessage(SHOW_PROGRESS);
   setUpRemoteControlClient();
   showNotification();
   updateWidget(this);
   updateRemoteControlClientMetadata();
   saveCurrentMedia();
 }
Example #3
0
 private void shuffle() {
   if (mShuffling) mPrevious.clear();
   mShuffling = !mShuffling;
   saveCurrentMedia();
 }