[Android] Don't show the never ask permission checkbox the first time

Nicolas Pomepuy git at videolan.org
Wed Dec 1 08:41:17 UTC 2021


vlc-android | branch: 3.4.x | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Dec  1 09:30:19 2021 +0100| [97daac1dad4eaf470531bb041b71da813dd4df7f] | committer: Nicolas Pomepuy

Don't show the never ask permission checkbox the first time


(cherry picked from commit 89f7a4208df7c526b27fd761e21fcaf45ad84401)

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

 .../src/org/videolan/vlc/gui/dialogs/AllAccessPermissionDialog.kt   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AllAccessPermissionDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AllAccessPermissionDialog.kt
index 5d98848fa..538938caf 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AllAccessPermissionDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AllAccessPermissionDialog.kt
@@ -36,6 +36,7 @@ import kotlinx.coroutines.launch
 import org.videolan.tools.PERMISSION_NEVER_ASK
 import org.videolan.tools.Settings
 import org.videolan.tools.putSingle
+import org.videolan.tools.setGone
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.helpers.hf.StoragePermissionsDelegate.Companion.getStoragePermission
 
@@ -63,12 +64,15 @@ class AllAccessPermissionDialog : VLCBottomSheetDialogFragment() {
         view.findViewById<TextView>(R.id.description).text = getString(R.string.partial_content_description, getString(R.string.allow_storage_manager_explanation))
         grantAllAccessButton = view.findViewById(R.id.grant_all_access_button)
         neverAskAgain = view.findViewById(R.id.never_ask_again)
+        val settings = Settings.getInstance(requireActivity())
+        if (!settings.getBoolean("permission_already_asked", false)) neverAskAgain.setGone()
+        settings.putSingle("permission_already_asked", true)
         grantAllAccessButton.setOnClickListener {
             lifecycleScope.launch { requireActivity().getStoragePermission(withDialog = false) }
             dismiss()
         }
         neverAskAgain.setOnCheckedChangeListener { _, isChecked ->
-            Settings.getInstance(requireActivity()).putSingle(PERMISSION_NEVER_ASK, isChecked)
+            settings.putSingle(PERMISSION_NEVER_ASK, isChecked)
         }
         return view
     }



More information about the Android mailing list