Skip to content
Snippets Groups Projects
Commit 32247d07 authored by Duncan McNamara's avatar Duncan McNamara Committed by Nicolas Pomepuy
Browse files

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.


(cherry picked from commit b01da1c9)
parent 7b6b9351
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
......
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment