[Android] Restrict access to controls settings when safe mode is activated

Nicolas Pomepuy git at videolan.org
Wed Jul 12 08:30:36 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Jul  5 15:22:42 2023 +0200| [2a10b2464aeeeeb7cc9f64bf971861eceb4abaf0] | committer: Duncan McNamara

Restrict access to controls settings when safe mode is activated

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

 .../org/videolan/vlc/gui/dialogs/AudioControlsSettingsDialog.kt   | 8 ++++++++
 .../org/videolan/vlc/gui/dialogs/VideoControlsSettingsDialog.kt   | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioControlsSettingsDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioControlsSettingsDialog.kt
index 8c99edf06d..ae8eb8d0b6 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioControlsSettingsDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AudioControlsSettingsDialog.kt
@@ -4,9 +4,12 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import androidx.lifecycle.lifecycleScope
 import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
+import kotlinx.coroutines.launch
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.DialogAudioControlsSettingsBinding
+import org.videolan.vlc.gui.helpers.UiTools.showPinIfNeeded
 
 class AudioControlsSettingsDialog : VLCBottomSheetDialogFragment() {
 
@@ -19,6 +22,11 @@ class AudioControlsSettingsDialog : VLCBottomSheetDialogFragment() {
 
     override fun initialFocusedView() = binding.fragmentContainerView.findViewById<View>(R.id.recycler_view) ?: binding.container
 
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        lifecycleScope.launch { if (requireActivity().showPinIfNeeded()) dismiss() }
+    }
+
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
         binding = DialogAudioControlsSettingsBinding.inflate(layoutInflater, container, false)
         return binding.root
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoControlsSettingsDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoControlsSettingsDialog.kt
index 581997d18b..fa2199cdb3 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoControlsSettingsDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/VideoControlsSettingsDialog.kt
@@ -5,9 +5,12 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import com.google.android.material.bottomsheet.BottomSheetBehavior
+import androidx.lifecycle.lifecycleScope
 import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
+import kotlinx.coroutines.launch
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.DialogVideoControlsSettingsBinding
+import org.videolan.vlc.gui.helpers.UiTools.showPinIfNeeded
 
 class VideoControlsSettingsDialog : VLCBottomSheetDialogFragment() {
 
@@ -20,6 +23,11 @@ class VideoControlsSettingsDialog : VLCBottomSheetDialogFragment() {
 
     override fun initialFocusedView() = binding.fragmentContainerView.findViewById<View>(R.id.recycler_view) ?: binding.container
 
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        lifecycleScope.launch { if (requireActivity().showPinIfNeeded()) dismiss() }
+    }
+
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
         binding = DialogVideoControlsSettingsBinding.inflate(layoutInflater, container, false)
         return binding.root



More information about the Android mailing list