[Android] Save and restore repeat mode for audio
Geoffrey Métais
git at videolan.org
Fri Jun 9 17:19:35 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jun 9 17:13:42 2017 +0200| [d6e99a335a92a335bf3840b21c304d0160c7d8ef] | committer: Geoffrey Métais
Save and restore repeat mode for audio
> https://code.videolan.org/videolan/vlc-android/commit/d6e99a335a92a335bf3840b21c304d0160c7d8ef
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 399d1bef1..2e61184cd 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -135,6 +135,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
private static final int DELAY_DOUBLE_CLICK = 800;
private static final int DELAY_LONG_CLICK = 1000;
+ public static final String AUDIO_REPEAT_MODE_KEY = "audio_repeat_mode";
public interface Callback {
void update();
@@ -1427,6 +1428,8 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
@MainThread
public void setRepeatType(int repeatType) {
mRepeating = repeatType;
+ if (mMediaList.isAudioList() && mSettings.getBoolean("audio_save_repeat", false))
+ mSettings.edit().putInt(AUDIO_REPEAT_MODE_KEY, mRepeating).apply();
savePosition();
determinePrevAndNextIndices();
publishState();
@@ -1862,6 +1865,8 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
// Add handler after loading the list
mMediaList.addEventListener(mListEventListener);
+ if (mMediaList.isAudioList() && mSettings.getBoolean("audio_save_repeat", false))
+ mRepeating = mSettings.getInt(AUDIO_REPEAT_MODE_KEY, REPEAT_NONE);
playIndex(mCurrentIndex, 0);
saveMediaList();
onMediaChanged();
More information about the Android
mailing list