diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 5401ef3e7..13cbe344d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -100,7 +100,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } setupOptionsMenu() - handlePartialMediaPermissions(getPermissionsToRequest()) { + handlePermission(getPermissionToRequest()) { if (!it) { toast(com.simplemobiletools.commons.R.string.no_storage_permissions) finish() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 59b860f18..b52bd673e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -168,16 +168,19 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } private fun handleMediaPermissions(callback: (granted: Boolean) -> Unit) { - if (!hasAllPermissions(getPermissionsToRequest())) { - handlePartialMediaPermissions(getPermissionsToRequest(), true) { - callback(it) + handlePermission(getPermissionToRequest()) { granted -> + callback(granted) + if (granted && isRPlus()) { + handlePermission(PERMISSION_MEDIA_LOCATION) {} + if (isTiramisuPlus()) { + handlePermission(PERMISSION_READ_MEDIA_VIDEO) {} + } + if (!mWasMediaManagementPromptShown) { mWasMediaManagementPromptShown = true handleMediaManagementPrompt { } } } - } else { - callback(true) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 4959158e5..281c745b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -381,7 +381,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } private fun tryLoadGallery() { - handlePartialMediaPermissions(getPermissionsToRequest()) { + handlePermission(getPermissionToRequest()) { if (it) { val dirName = when { mPath == FAVORITES -> getString(com.simplemobiletools.commons.R.string.favorites) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt index 30655d7b3..6e9b2a0d7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt @@ -47,7 +47,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList setupOptionsMenu() refreshMenuItems() - handlePartialMediaPermissions(getPermissionsToRequest()) { + handlePermission(getPermissionToRequest()) { if (it) { checkIntent(savedInstanceState) } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 3bc3f8371..6b1ed15f8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -96,7 +96,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View checkNotchSupport() (MediaActivity.mMedia.clone() as ArrayList).filterIsInstanceTo(mMediaFiles, Medium::class.java) - handlePartialMediaPermissions(getPermissionsToRequest()) { + handlePermission(getPermissionToRequest()) { if (it) { initViewPager() } else {