[Android] ClearHistory: also clear playback resume

Duncan McNamara git at videolan.org
Tue Jan 17 08:32:42 UTC 2023


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Jan 16 11:15:08 2023 +0100| [b01da1c903de17409288fcffdf923b15e0da8fb2] | committer: Nicolas Pomepuy

ClearHistory: also clear playback resume

Resume playback snackbar is based on KEY_CURRENT_AUDIO/MEDIA not just
KEY_AUDIO/MEDIA_LAST_PLAYLIST. Clearing history should remove all saved
sharedPreference related to current playback.

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

 .../television/ui/preferences/PreferencesAdvanced.kt         | 12 +++++++++++-
 .../org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt  | 12 +++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
index c1c315d1f6..7601a93e3e 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
@@ -113,7 +113,17 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
                 dialog.show((activity as FragmentActivity).supportFragmentManager, RenameDialog::class.simpleName)
                 dialog.setListener {
                     Medialibrary.getInstance().clearHistory()
-                    Settings.getInstance(activity).edit().remove(KEY_AUDIO_LAST_PLAYLIST).remove(KEY_MEDIA_LAST_PLAYLIST).apply()
+                    Settings.getInstance(activity).edit()
+                        .remove(KEY_AUDIO_LAST_PLAYLIST)
+                        .remove(KEY_MEDIA_LAST_PLAYLIST)
+                        .remove(KEY_MEDIA_LAST_PLAYLIST_RESUME)
+                        .remove(KEY_CURRENT_AUDIO)
+                        .remove(KEY_CURRENT_MEDIA)
+                        .remove(KEY_CURRENT_MEDIA_RESUME)
+                        .remove(KEY_CURRENT_AUDIO_RESUME_TITLE)
+                        .remove(KEY_CURRENT_AUDIO_RESUME_ARTIST)
+                        .remove(KEY_CURRENT_AUDIO_RESUME_THUMB)
+                        .apply()
                 }
                 return true
             }
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 cc31231315..23a0f8cbd0 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
@@ -106,7 +106,17 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
                 dialog.show((activity as FragmentActivity).supportFragmentManager, RenameDialog::class.simpleName)
                 dialog.setListener {
                     Medialibrary.getInstance().clearHistory()
-                    Settings.getInstance(requireActivity()).edit().remove(KEY_AUDIO_LAST_PLAYLIST).remove(KEY_MEDIA_LAST_PLAYLIST).apply()
+                    Settings.getInstance(requireActivity()).edit()
+                        .remove(KEY_AUDIO_LAST_PLAYLIST)
+                        .remove(KEY_MEDIA_LAST_PLAYLIST)
+                        .remove(KEY_MEDIA_LAST_PLAYLIST_RESUME)
+                        .remove(KEY_CURRENT_AUDIO)
+                        .remove(KEY_CURRENT_MEDIA)
+                        .remove(KEY_CURRENT_MEDIA_RESUME)
+                        .remove(KEY_CURRENT_AUDIO_RESUME_TITLE)
+                        .remove(KEY_CURRENT_AUDIO_RESUME_ARTIST)
+                        .remove(KEY_CURRENT_AUDIO_RESUME_THUMB)
+                        .apply()
                 }
                 return true
             }



More information about the Android mailing list