[Android] Storage permission: use activity as context
Geoffrey Métais
git at videolan.org
Mon Feb 19 14:59:33 CET 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 19 14:59:02 2018 +0100| [c6cfc6c3fcfbc3b74f959d94d451fbeae17aadd1] | committer: Geoffrey Métais
Storage permission: use activity as context
> https://code.videolan.org/videolan/vlc-android/commit/c6cfc6c3fcfbc3b74f959d94d451fbeae17aadd1
---
.../src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt
index 0b2f4daa0..9ad5ca1c8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/hf/StoragePermissionsDelegate.kt
@@ -33,7 +33,6 @@ import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import org.videolan.libvlc.util.AndroidUtil
import org.videolan.vlc.MediaParsingService
-import org.videolan.vlc.VLCApplication
import org.videolan.vlc.util.Constants
import org.videolan.vlc.util.Permissions
import org.videolan.vlc.util.Permissions.canReadStorage
@@ -81,7 +80,8 @@ class StoragePermissionsDelegate : BaseHeadlessFragment() {
when (requestCode) {
Permissions.PERMISSION_STORAGE_TAG -> {
// If request is cancelled, the result arrays are empty.
- val ctx = VLCApplication.getAppContext()
+ val ctx = activity
+ if (ctx === null) return
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (mActivity is CustomActionController) {
(mActivity as CustomActionController).onStorageAccessGranted()
More information about the Android
mailing list