[Android] Add a mark all as not played ctx for video groups/folder
Nicolas Pomepuy
git at videolan.org
Mon May 6 08:57:24 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Apr 30 14:33:59 2024 +0200| [fac97d8244cd8506babad68d7b547f3b588b4dc3] | committer: Nicolas Pomepuy
Add a mark all as not played ctx for video groups/folder
> https://code.videolan.org/videolan/vlc-android/commit/fac97d8244cd8506babad68d7b547f3b588b4dc3
---
.../src/main/res/drawable/ic_mark_all_as_not_played.xml | 11 +++++++++++
application/resources/src/main/res/values/strings.xml | 1 +
.../src/org/videolan/vlc/gui/dialogs/ContextSheet.kt | 1 +
.../src/org/videolan/vlc/gui/video/VideoGridFragment.kt | 2 ++
.../vlc-android/src/org/videolan/vlc/util/ContextOption.kt | 5 +++--
5 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/application/resources/src/main/res/drawable/ic_mark_all_as_not_played.xml b/application/resources/src/main/res/drawable/ic_mark_all_as_not_played.xml
new file mode 100644
index 0000000000..88a987a937
--- /dev/null
+++ b/application/resources/src/main/res/drawable/ic_mark_all_as_not_played.xml
@@ -0,0 +1,11 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="@color/white"
+ android:pathData="M4.14,2.69L4.14,2.69c-0.39,0.39 -0.39,1.02 0,1.41l9.67,9.67l-1.41,1.41l-3.54,-3.53c-0.39,-0.39 -1.02,-0.39 -1.41,0l0,0c-0.39,0.39 -0.39,1.02 0,1.41l4.24,4.24c0.39,0.39 1.02,0.39 1.41,0l2.12,-2.12l5.89,5.89c0.39,0.39 1.02,0.39 1.41,0l0,0c0.39,-0.39 0.39,-1.02 0,-1.41L5.55,2.69C5.16,2.3 4.53,2.3 4.14,2.69zM18.05,12.36l4.24,-4.24c0.39,-0.39 0.39,-1.03 -0.01,-1.42l0,0c-0.39,-0.38 -1.02,-0.38 -1.41,0.01l-4.24,4.24L18.05,12.36zM16.64,6.7L16.64,6.7c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.42,1.42l1.41,1.41l1.42,-1.42C17.03,7.72 17.03,7.09 16.64,6.7zM1.79,13.06l4.95,4.95l1.41,-1.41L3.2,11.65c-0.39,-0.39 -1.02,-0.39 -1.41,0l0,0C1.4,12.04 1.4,12.67 1.79,13.06z" />
+
+</vector>
diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 770a397f32..e3dcee85ac 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -954,6 +954,7 @@
<string name="mark_as_played">Mark as played</string>
<string name="mark_as_not_played">Mark as not played</string>
<string name="mark_all_as_played">Mark all as played</string>
+ <string name="mark_all_as_not_played">Mark all as not played</string>
<string name="new_group">New group</string>
<string name="new_group_desc">Create a new group</string>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
index f25e668c08..51ff6feb0d 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
@@ -143,6 +143,7 @@ class ContextSheet : VLCBottomSheetDialogFragment() {
if (flags.contains(CTX_MARK_AS_PLAYED)) add(Simple(CTX_MARK_AS_PLAYED, getString(R.string.mark_as_played), R.drawable.ic_mark_as_played))
if (flags.contains(CTX_MARK_AS_UNPLAYED)) add(Simple(CTX_MARK_AS_UNPLAYED, getString(R.string.mark_as_not_played), R.drawable.ic_mark_as_not_played))
if (flags.contains(CTX_MARK_ALL_AS_PLAYED)) add(Simple(CTX_MARK_ALL_AS_PLAYED, getString(R.string.mark_all_as_played), R.drawable.ic_mark_all_as_played))
+ if (flags.contains(CTX_MARK_ALL_AS_UNPLAYED)) add(Simple(CTX_MARK_ALL_AS_UNPLAYED, getString(R.string.mark_all_as_not_played), R.drawable.ic_mark_all_as_not_played))
if (flags.contains(CTX_GO_TO_FOLDER)) add(Simple(CTX_GO_TO_FOLDER, getString(R.string.go_to_folder), R.drawable.ic_browse_parent))
if (flags.contains(CTX_CUSTOM_REMOVE)) add(Simple(CTX_CUSTOM_REMOVE, getString(R.string.remove_custom_path), R.drawable.ic_delete))
if (flags.contains(CTX_BAN_FOLDER)) add(Simple(CTX_BAN_FOLDER, getString(R.string.group_ban_folder), R.drawable.ic_hide_source))
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index 0ce0a0bdb2..4cfc04710b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -544,6 +544,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
CTX_APPEND -> viewModel.append(position)
CTX_ADD_TO_PLAYLIST -> viewModel.addItemToPlaylist(requireActivity(), position)
CTX_MARK_ALL_AS_PLAYED -> lifecycleScope.launch { viewModel.markAsPlayed(media) }
+ CTX_MARK_ALL_AS_UNPLAYED -> lifecycleScope.launch { viewModel.markAsUnplayed(media) }
CTX_FAV_ADD, CTX_FAV_REMOVE -> lifecycleScope.launch(Dispatchers.IO) {
media.isFavorite = option == CTX_FAV_ADD
}
@@ -558,6 +559,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
CTX_RENAME_GROUP -> renameGroup(media)
CTX_UNGROUP -> lifecycleScope.launch { if (!requireActivity().showPinIfNeeded()) viewModel.ungroup(media) }
CTX_MARK_ALL_AS_PLAYED -> lifecycleScope.launch { viewModel.markAsPlayed(media) }
+ CTX_MARK_ALL_AS_UNPLAYED -> lifecycleScope.launch { viewModel.markAsUnplayed(media) }
CTX_ADD_GROUP -> requireActivity().addToGroup(listOf(media).getAll(), true) {}
CTX_FAV_ADD, CTX_FAV_REMOVE -> lifecycleScope.launch(Dispatchers.IO) {
media.isFavorite = option == CTX_FAV_ADD
diff --git a/application/vlc-android/src/org/videolan/vlc/util/ContextOption.kt b/application/vlc-android/src/org/videolan/vlc/util/ContextOption.kt
index 650d03d77e..9150cb113a 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/ContextOption.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/ContextOption.kt
@@ -43,6 +43,7 @@ enum class ContextOption : Flag {
CTX_INFORMATION,
CTX_ITEM_DL,
CTX_MARK_ALL_AS_PLAYED,
+ CTX_MARK_ALL_AS_UNPLAYED,
CTX_MARK_AS_PLAYED,
CTX_MARK_AS_UNPLAYED,
CTX_PLAY,
@@ -92,12 +93,12 @@ enum class ContextOption : Flag {
fun createCtxVideoGroupFlags() = createBaseFlags().apply {
remove(CTX_ADD_SHORTCUT)
- addAll(CTX_ADD_GROUP, CTX_MARK_ALL_AS_PLAYED, CTX_PLAY_ALL, CTX_RENAME_GROUP, CTX_UNGROUP)
+ addAll(CTX_ADD_GROUP, CTX_MARK_ALL_AS_PLAYED, CTX_MARK_ALL_AS_UNPLAYED, CTX_PLAY_ALL, CTX_RENAME_GROUP, CTX_UNGROUP)
}
fun createCtxFolderFlags() = createBaseFlags().apply {
remove(CTX_ADD_SHORTCUT)
- addAll(CTX_BAN_FOLDER, CTX_MARK_ALL_AS_PLAYED, CTX_PLAY_ALL)
+ addAll(CTX_BAN_FOLDER, CTX_MARK_ALL_AS_PLAYED, CTX_MARK_ALL_AS_UNPLAYED, CTX_PLAY_ALL)
}
}
}
More information about the Android
mailing list