[Android] Add to playlist dialog: persist the replace switch state

Nicolas Pomepuy git at videolan.org
Thu May 11 07:59:33 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Mar 27 13:24:00 2023 +0200| [b3fc8d075f691fe62ddba690e42715d7554dbf2b] | committer: Duncan McNamara

Add to playlist dialog: persist the replace switch state

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

 application/tools/src/main/java/org/videolan/tools/Settings.kt   | 1 +
 .../src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt       | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/application/tools/src/main/java/org/videolan/tools/Settings.kt b/application/tools/src/main/java/org/videolan/tools/Settings.kt
index c929f6afd0..b8b06c439e 100644
--- a/application/tools/src/main/java/org/videolan/tools/Settings.kt
+++ b/application/tools/src/main/java/org/videolan/tools/Settings.kt
@@ -189,6 +189,7 @@ const val CUSTOM_POPUP_HEIGHT = "custom_popup_height"
 const val SLEEP_TIMER_WAIT = "sleep_timer_wait"
 
 const val NOTIFICATION_PERMISSION_ASKED = "notification_permission_asked"
+const val PLAYLIST_REPLACE = "playlist_replace"
 
 //files
 const val BROWSER_SHOW_HIDDEN_FILES = "browser_show_hidden_files"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
index 2cd110e494..25ed6721ec 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
@@ -43,10 +43,7 @@ import org.videolan.medialibrary.interfaces.media.Playlist
 import org.videolan.medialibrary.media.MediaLibraryItem
 import org.videolan.resources.util.parcelable
 import org.videolan.resources.util.parcelableArray
-import org.videolan.tools.AppScope
-import org.videolan.tools.CoroutineContextProvider
-import org.videolan.tools.DependencyProvider
-import org.videolan.tools.Settings
+import org.videolan.tools.*
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.DialogPlaylistBinding
 import org.videolan.vlc.gui.SimpleAdapter
@@ -173,6 +170,10 @@ class SavePlaylistDialog : VLCBottomSheetDialogFragment(), View.OnClickListener,
                 }
             }
         }
+        binding.replaceSwitch.isChecked = Settings.getInstance(requireActivity()).getBoolean(PLAYLIST_REPLACE, false)
+        binding.replaceSwitch.setOnCheckedChangeListener { _, isChecked ->
+            Settings.getInstance(requireActivity()).putSingle(PLAYLIST_REPLACE, isChecked)
+        }
     }
 
     override fun onSaveInstanceState(outState: Bundle) {



More information about the Android mailing list