A modern image picker implemented as BottomSheet. Project must be cimoatble with java 1.8
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
- select single/multiple images or videos right in the bottom sheet
- use camera with camera preview to take a picture
- handles all permission requests
This library is based on bottomsheet-imagepicker. Changed design: Removed camera and gallery tiles Added support of video, also added camera preview
Minimum SDK: 21
First make sure jitpack
is included as a repository in your project's build.gradle:
allprojects {
repositories {
//...
maven { url 'https://jitpack.io' }
}
}
And then add the below to your app's build.gradle:
implementation 'implementation 'com.github.timkabot:GalleryPicker:<version>'
### Create the image picker using the Builder
The setters are all **optional** and the builder will fallback to default values.
##### Kotlin
```kotlin
BottomSheetGalleryPicker
.Builder(onImagesSelectedListener)
.peekHeight(R.dimen.peekHeight)
.columnSize(R.dimen.columnSize)
.selectionRange(1, 6)
.selectionTitles(
R.plurals.imagePickerMulti, //"you have selected <count> images
R.string.imagePickerMultiLimit //"You cannot select more than <max> images"
)
.show(supportFragmentManager)
private val onImagesSelectedListener =
object : BottomSheetGalleryPicker.OnImagesSelectedListener {
override fun onImagesSelected(uris: List<Uri>, fromCamera: Boolean) {
if( fromCamera)
{ do somethng with camera }
else { handle chosen files }
}
}
//inside activity
.show(supportFragmentManager)
//inside fragment
.show(childFragmentManager)