[Android] fix save/restore of repeat/shuffle settings

Sébastien Toque git at videolan.org
Fri Sep 18 21:23:15 CEST 2015


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Fri Sep 18 21:22:53 2015 +0200| [3cfd1a85d45d5f495cfe7f2ae4ee71e12efc127f] | committer: Sébastien Toque

fix save/restore of repeat/shuffle settings

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=3cfd1a85d45d5f495cfe7f2ae4ee71e12efc127f
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 7e19b3f..e48796e 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1175,14 +1175,14 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
         if (mShuffling)
             mPrevious.clear();
         mShuffling = !mShuffling;
-        saveCurrentMedia();
+        savePosition();
         determinePrevAndNextIndices();
     }
 
     @MainThread
     public void setRepeatType(int repeatType) {
         mRepeating = repeatType;
-        saveCurrentMedia();
+        savePosition();
         determinePrevAndNextIndices();
     }
 
@@ -1279,8 +1279,6 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
     private synchronized void saveCurrentMedia() {
         SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
         editor.putString("current_media", mMediaList.getMRL(Math.max(mCurrentIndex, 0)));
-        editor.putBoolean("shuffling", mShuffling);
-        editor.putInt("repeating", mRepeating);
         Util.commitPreferences(editor);
     }
 
@@ -1300,6 +1298,8 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
         if (getCurrentMedia() == null || getCurrentMedia().getType() == MediaWrapper.TYPE_VIDEO)
             return;
         SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
+        editor.putBoolean("shuffling", mShuffling);
+        editor.putInt("repeating", mRepeating);
         editor.putInt("position_in_list", mCurrentIndex);
         editor.putLong("position_in_song", mMediaPlayer.getTime());
         Util.commitPreferences(editor);



More information about the Android mailing list