diff --git a/library/build.gradle b/library/build.gradle index 720d907..6fd4d9e 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -13,7 +13,7 @@ android { minSdkVersion 17 targetSdkVersion 29 versionCode 1 - versionName "1.1.1" + versionName "1.1.2" } compileOptions { targetCompatibility = JavaVersion.VERSION_1_8 @@ -41,9 +41,9 @@ dependencies { implementation 'androidx.core:core-ktx:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' - api 'com.google.android.material:material:1.1.0-rc01' + api 'com.google.android.material:material:1.1.0-rc02' - implementation 'com.kroegerama:android-kaiteki:2.9.0' + implementation 'com.kroegerama:android-kaiteki:2.9.1' implementation 'com.kroegerama:recyclerview-kaiteki:1.0.10' implementation("com.github.bumptech.glide:glide:$glide") { diff --git a/library/src/main/java/com/kroegerama/imgpicker/BottomSheetImagePicker.kt b/library/src/main/java/com/kroegerama/imgpicker/BottomSheetImagePicker.kt index faf8c58..d633ea1 100644 --- a/library/src/main/java/com/kroegerama/imgpicker/BottomSheetImagePicker.kt +++ b/library/src/main/java/com/kroegerama/imgpicker/BottomSheetImagePicker.kt @@ -22,6 +22,7 @@ import android.widget.Toast import androidx.annotation.DimenRes import androidx.annotation.PluralsRes import androidx.annotation.StringRes +import androidx.core.content.FileProvider import androidx.core.view.isVisible import androidx.fragment.app.FragmentManager import androidx.loader.app.LoaderManager @@ -229,6 +230,8 @@ class BottomSheetImagePicker internal constructor() : currentPhotoUri = photoUri intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri) + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + requireContext().packageManager.queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY @@ -270,7 +273,7 @@ class BottomSheetImagePicker internal constructor() : if (!success && BuildConfig.DEBUG) { Log.d(TAG, "Failed to delete temp file: $image") } - Uri.fromFile(image) + FileProvider.getUriForFile(requireContext(), providerAuthority, image) } @SuppressLint("SimpleDateFormat")