[Android] Ask for popup permission as soon as the settings is changed

Nicolas Pomepuy git at videolan.org
Mon Jun 27 10:09:22 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Jun 22 10:03:24 2022 +0200| [67fad0429d14a97b7523f67bde88edc5487160ff] | committer: Duncan McNamara

Ask for popup permission as soon as the settings is changed

Fixes #2564

> https://code.videolan.org/videolan/vlc-android/commit/67fad0429d14a97b7523f67bde88edc5487160ff
---

 .../java/org/videolan/television/ui/preferences/PreferencesVideo.kt | 5 +++--
 .../src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt        | 6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt
index bd93b6459..b8700d21a 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt
@@ -27,9 +27,10 @@ import android.content.SharedPreferences
 import android.os.Build
 import android.os.Bundle
 import androidx.preference.Preference
-import org.videolan.resources.AndroidDevices
 import org.videolan.resources.VLCInstance
-import org.videolan.tools.*
+import org.videolan.tools.LOCK_USE_SENSOR
+import org.videolan.tools.POPUP_FORCE_LEGACY
+import org.videolan.tools.SAVE_BRIGHTNESS
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.preferences.PreferencesActivity
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
index 532c4391b..126ac1992 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
@@ -27,8 +27,9 @@ import android.os.Bundle
 import androidx.preference.Preference
 import org.videolan.libvlc.util.AndroidUtil
 import org.videolan.resources.VLCInstance
-import org.videolan.tools.*
+import org.videolan.tools.POPUP_FORCE_LEGACY
 import org.videolan.vlc.R
+import org.videolan.vlc.util.Permissions
 
 class PreferencesVideo : BasePreferenceFragment(), SharedPreferences.OnSharedPreferenceChangeListener  {
 
@@ -58,6 +59,9 @@ class PreferencesVideo : BasePreferenceFragment(), SharedPreferences.OnSharedPre
                 VLCInstance.restart()
                 (activity as? PreferencesActivity)?.restartMediaPlayer()
             }
+            POPUP_FORCE_LEGACY -> {
+                if (sharedPreferences.getBoolean(key, false) && !Permissions.canDrawOverlays(requireActivity())) Permissions.checkDrawOverlaysPermission(requireActivity())
+            }
         }
     }
 }



More information about the Android mailing list