ArthurHub / Android-Image-Cropper

Image Cropping Library for Android, optimized for Camera / Gallery.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

targetSdk 30 issues and how I fixed them

donhill opened this issue · comments

This is how I fixed my latest issue with this library. I found the following in a PR and use this in my build.gradle

Add to gradle
implementation 'com.github.ravindu1024:Android-Image-Cropper:2.8.2'

After this the gallery/camera wasn't allowed a camera selection

I added the following chooser, after that everything that I needed was fixed.

the function used to allow the user to select files, camera, and gallery

`fun imageSourceChooser() {
val documentsIntent = Intent(Intent.ACTION_GET_CONTENT)
documentsIntent.type = "image/*"

val otherGalleriesIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
otherGalleriesIntent.type = "image/*"

val camera = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
val chooserIntent = Intent.createChooser(
  documentsIntent,
  getString(R.string.pick_image_intent_chooser_title)
).putExtra(Intent.EXTRA_INITIAL_INTENTS, arrayOf(otherGalleriesIntent, camera))


startActivityForResult(
  chooserIntent,
  CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE
)

}`