[Android] Check the PIN for the video group actions
Nicolas Pomepuy
git at videolan.org
Wed Jul 12 08:30:36 UTC 2023
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jun 27 10:32:13 2023 +0200| [e049eb016f7368269422503da139acd73201ad95] | committer: Duncan McNamara
Check the PIN for the video group actions
> https://code.videolan.org/videolan/vlc-android/commit/e049eb016f7368269422503da139acd73201ad95
---
.../src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt | 3 +++
.../vlc-android/src/org/videolan/vlc/gui/dialogs/RenameDialog.kt | 4 ++++
.../src/org/videolan/vlc/gui/video/VideoGridFragment.kt | 7 ++++---
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt
index 48c94fcb08..137b1959d9 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AddToGroupDialog.kt
@@ -28,6 +28,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
import kotlinx.coroutines.launch
@@ -44,6 +45,7 @@ import org.videolan.tools.DependencyProvider
import org.videolan.vlc.R
import org.videolan.vlc.databinding.DialogAddToGroupBinding
import org.videolan.vlc.gui.SimpleAdapter
+import org.videolan.vlc.gui.helpers.hf.checkPIN
import org.videolan.vlc.viewmodels.mobile.VideoGroupingType
import org.videolan.vlc.viewmodels.mobile.VideosViewModel
import java.util.*
@@ -76,6 +78,7 @@ class AddToGroupDialog : VLCBottomSheetDialogFragment(), SimpleAdapter.ClickHand
}
override fun onCreate(savedInstanceState: Bundle?) {
+ lifecycleScope.launch { if (!requireActivity().checkPIN()) dismiss() }
super.onCreate(savedInstanceState)
medialibrary = Medialibrary.getInstance()
adapter = SimpleAdapter(this)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/RenameDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/RenameDialog.kt
index 7b1d05f256..9316620e5b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/RenameDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/RenameDialog.kt
@@ -54,11 +54,14 @@ import android.view.inputmethod.EditorInfo
import android.widget.Button
import android.widget.TextView
import androidx.core.os.bundleOf
+import androidx.lifecycle.lifecycleScope
import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
import com.google.android.material.textfield.TextInputEditText
+import kotlinx.coroutines.launch
import org.videolan.medialibrary.media.MediaLibraryItem
import org.videolan.resources.util.parcelable
import org.videolan.vlc.R
+import org.videolan.vlc.gui.helpers.hf.checkPIN
const val RENAME_DIALOG_MEDIA = "RENAME_DIALOG_MEDIA"
@@ -84,6 +87,7 @@ class RenameDialog : VLCBottomSheetDialogFragment() {
}
override fun onCreate(savedInstanceState: Bundle?) {
+ lifecycleScope.launch { if (!requireActivity().checkPIN()) dismiss() }
media = arguments?.parcelable(RENAME_DIALOG_MEDIA) ?: return
super.onCreate(savedInstanceState)
}
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 b74fc8c12e..00752725a2 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
@@ -62,6 +62,7 @@ import org.videolan.vlc.gui.helpers.UiTools.addToGroup
import org.videolan.vlc.gui.helpers.UiTools.addToPlaylist
import org.videolan.vlc.gui.helpers.UiTools.createShortcut
import org.videolan.vlc.gui.helpers.fillActionMode
+import org.videolan.vlc.gui.helpers.hf.checkPIN
import org.videolan.vlc.gui.view.EmptyLoadingState
import org.videolan.vlc.media.MediaUtils
import org.videolan.vlc.media.PlaylistManager
@@ -167,7 +168,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
viewModel.group?.let { renameGroup(it) }
}
R.id.ungroup -> {
- viewModel.group?.let { viewModel.ungroup(it) }
+ viewModel.group?.let { lifecycleScope.launch{if (requireActivity().checkPIN()) viewModel.ungroup(it) } }
}
R.id.play_all -> {
onFabPlayClick(binding.root)
@@ -516,7 +517,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
CTX_SHARE -> lifecycleScope.launch { (requireActivity() as AppCompatActivity).share(media) }
CTX_REMOVE_GROUP -> viewModel.removeFromGroup(media)
CTX_ADD_GROUP -> requireActivity().addToGroup(listOf(media), true) {}
- CTX_GROUP_SIMILAR -> lifecycleScope.launch { viewModel.groupSimilar(media) }
+ CTX_GROUP_SIMILAR -> lifecycleScope.launch { if (requireActivity().checkPIN()) viewModel.groupSimilar(media) }
CTX_MARK_AS_PLAYED -> lifecycleScope.launch { viewModel.markAsPlayed(media) }
CTX_MARK_AS_UNPLAYED -> lifecycleScope.launch { viewModel.markAsUnplayed(media) }
CTX_FAV_ADD, CTX_FAV_REMOVE -> lifecycleScope.launch(Dispatchers.IO) {
@@ -540,7 +541,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
CTX_APPEND -> viewModel.append(position)
CTX_ADD_TO_PLAYLIST -> viewModel.addItemToPlaylist(requireActivity(), position)
CTX_RENAME_GROUP -> renameGroup(media)
- CTX_UNGROUP -> viewModel.ungroup(media)
+ CTX_UNGROUP -> lifecycleScope.launch { if (requireActivity().checkPIN()) viewModel.ungroup(media) }
CTX_MARK_ALL_AS_PLAYED -> lifecycleScope.launch { viewModel.markAsPlayed(media) }
CTX_ADD_GROUP -> requireActivity().addToGroup(listOf(media).getAll(), true) {}
CTX_FAV_ADD, CTX_FAV_REMOVE -> lifecycleScope.launch(Dispatchers.IO) {
More information about the Android
mailing list