[Android] Reset repeat mode when changing media type (video/audio)

Nicolas Pomepuy git at videolan.org
Tue Sep 10 15:11:05 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Tue Sep 10 07:35:05 2019 +0200| [62c58b5afd4394198de1ad37ed9fcb63db030700] | committer: Geoffrey Métais

Reset repeat mode when changing media type (video/audio)

> https://code.videolan.org/videolan/vlc-android/commit/62c58b5afd4394198de1ad37ed9fcb63db030700
---

 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 8fc3450ac..c62eb61e3 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -76,11 +76,18 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
 
     fun isValidPosition(position: Int) = position in 0 until mediaList.size()
 
+    var wasAudio: Boolean? = null
+
     private fun computeRepeating() {
+        //Audio mode changed => resetting
+        if (isAudioList() != wasAudio) repeating = REPEAT_NONE
+        wasAudio = isAudioList()
+        //Load saved mode if repeat save options are used
         if (isAudioList())
             if (settings.getBoolean("audio_save_repeat", false)) repeating = settings.getInt(AUDIO_REPEAT_MODE_KEY, REPEAT_NONE)
             else
                 if (settings.getBoolean("video_save_repeat", false)) repeating = settings.getInt(VIDEO_REPEAT_MODE_KEY, REPEAT_NONE)
+        if (BuildConfig.DEBUG) Log.d(this::class.java.simpleName, "computeRepeating. isAudio: ${isAudioList()} repeating: $repeating")
     }
 
     /**



More information about the Android mailing list