[Android] Clear last playback when clearing history

Nicolas Pomepuy git at videolan.org
Mon Jul 20 13:30:07 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Jul 20 08:39:35 2020 +0200| [9ed915a96a06944318038d96da1ee4def6e8e1ce] | committer: Nicolas Pomepuy

Clear last playback when clearing history

Fixes #1420

> https://code.videolan.org/videolan/vlc-android/commit/9ed915a96a06944318038d96da1ee4def6e8e1ce
---

 .../src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
index 7bd48a77f..6d82d7c92 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
@@ -37,7 +37,10 @@ import androidx.preference.Preference
 import kotlinx.coroutines.*
 import org.videolan.medialibrary.interfaces.Medialibrary
 import org.videolan.resources.AndroidDevices
+import org.videolan.resources.KEY_AUDIO_LAST_PLAYLIST
+import org.videolan.resources.KEY_MEDIA_LAST_PLAYLIST
 import org.videolan.resources.VLCInstance
+import org.videolan.tools.Settings
 import org.videolan.tools.putSingle
 import org.videolan.vlc.BuildConfig
 import org.videolan.vlc.R
@@ -88,7 +91,10 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
                         .setMessage(R.string.validation)
                         .setIcon(R.drawable.ic_warning)
                         .setPositiveButton(R.string.yes) { _, _ ->
-                            lifecycleScope.launch(Dispatchers.IO) { Medialibrary.getInstance().clearHistory() }
+                            lifecycleScope.launch(Dispatchers.IO) {
+                                Medialibrary.getInstance().clearHistory()
+                                Settings.getInstance(requireActivity()).edit().remove(KEY_AUDIO_LAST_PLAYLIST).remove(KEY_MEDIA_LAST_PLAYLIST).apply()
+                            }
                         }
 
                         .setNegativeButton(R.string.cancel, null).show()



More information about the Android mailing list