Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.keepLove:SImagePicker:Tag'
}
ImagePicker.with(this)
// 是否裁剪
.setCrop(true)
.setListener(object : ImagePickerListener<Uri> {
override fun callback(t: Uri?) {
mBinding.imageView.setImageBitmap(
t?.toBitmap(this@MainActivity)?.compressBitmap(this@MainActivity)
)
}
})
.jumpToCamera()
ImagePicker.with(this)
// 是否裁剪
.setCrop(true)
.asBitmap()
.setListener(object : ImagePickerListener<Bitmap> {
override fun callback(t: Bitmap?) {
mBinding.imageView.setImageBitmap(t?.compressBitmap(this@MainActivity))
}
})
.jumpToPicture()