[Android] Restrict access to the server addition 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:28:05 2023 +0200| [4adb748ee0d78ad0ce8fa2bd2a5abf2dc2954136] | committer: Duncan McNamara

Restrict access to the server addition when safe mode is activated

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

 .../org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt  | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
index 84bfc1882c..03313f537c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
@@ -8,8 +8,14 @@ import android.text.TextWatcher
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
-import android.widget.*
+import android.widget.AdapterView
+import android.widget.ArrayAdapter
+import android.widget.Button
+import android.widget.EditText
+import android.widget.Spinner
+import android.widget.TextView
 import androidx.core.net.toUri
+import androidx.lifecycle.lifecycleScope
 import com.google.android.material.bottomsheet.BottomSheetBehavior
 import com.google.android.material.textfield.TextInputLayout
 import kotlinx.coroutines.launch
@@ -18,8 +24,9 @@ import org.videolan.tools.AppScope
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.DialogActivity
 import org.videolan.vlc.gui.MainActivity
+import org.videolan.vlc.gui.helpers.UiTools.showPinIfNeeded
 import org.videolan.vlc.repository.BrowserFavRepository
-import java.util.*
+import java.util.Locale
 
 class NetworkServerDialog : VLCBottomSheetDialogFragment(), AdapterView.OnItemSelectedListener, TextWatcher, View.OnClickListener {
 
@@ -54,6 +61,11 @@ class NetworkServerDialog : VLCBottomSheetDialogFragment(), AdapterView.OnItemSe
 
     override fun initialFocusedView(): View = spinnerProtocol
 
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        lifecycleScope.launch { if (requireActivity().showPinIfNeeded()) dismiss() }
+    }
+
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                               savedInstanceState: Bundle?): View? {
 



More information about the Android mailing list