[Android] Fix permission snackbar position

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


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

Fix permission snackbar position


(cherry picked from commit d149f241a0725e687282f4c880c7525cb7620f79)

> https://code.videolan.org/videolan/vlc-android/commit/5b2437337838744b8100e848a07464621169c7d7
---

 application/vlc-android/src/org/videolan/vlc/gui/MainActivity.kt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/MainActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/MainActivity.kt
index c47c788d4..3d607c3c0 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/MainActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/MainActivity.kt
@@ -80,6 +80,11 @@ class MainActivity : ContentActivity(),
     private lateinit var mediaLibrary: Medialibrary
     private var scanNeeded = false
 
+    override fun getSnackAnchorView(): View? {
+        val view = super.getSnackAnchorView()
+        return if (view?.id == android.R.id.content) findViewById(R.id.appbar) else view
+    }
+
     @SuppressLint("SetTextI18n")
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -97,6 +102,10 @@ class MainActivity : ContentActivity(),
         mediaLibrary = Medialibrary.getInstance()
 
 //        VLCBilling.getInstance(application).retrieveSkus()
+    }
+
+    override fun onResume() {
+        super.onResume()
         //Only the partial permission is granted for Android 11+
         if (!settings.getBoolean(PERMISSION_NEVER_ASK, false) && Permissions.canReadStorage(this) && !Permissions.hasAllAccess(this)) {
             UiTools.snackerMessageInfinite(this, getString(R.string.partial_content))?.setAction(R.string.more) {



More information about the Android mailing list