- BottomSheet Image Picker by kroegerama
- ChiliPhotoPicker by ChiliLabs
- Single or multiselect for images
- Can use camera to take a picture
- Can also pick any files via SAF (configured with mimetypes)
- Android 10+ support, pure Kotlin (minSDK 21)
- Image library independent (included samples for Coil and Glide)
Sorry, there are no public library yet. Download code, compile aar
and include to you project yourself
Just follow the guide from Official Android Document. See the demo application provider_paths.xml and AndroidManifest.xml.
Initialize FilePicker
in your Application
's class onCreate
loader
- your preferredImageLoader
implementation (ready examples for Glide and Coil are here)authority
- your file provider authority. Is needed if you configurecameraButton(enabled = true)
so picker could take temporary photo from camera
FilePicker.init(
loader = GlideImageLoader(),
authority = "${BuildConfig.APPLICATION_ID}.provider"
)
The setters are all optional and the builder will fallback to default values.
BottomSheetImagePicker.Builder()
.requestTag(tag)
.multiSelect() // enables multiselect mode
.cameraButton(enabled = true) // enables camera
.storageButton(mimeTypes = arrayOf("image/*", "application/pdf")) // enables SAF for mimeTypes
.show(childFragmentManager) // inside activity use supportFragmentManager
The caller Activity or Fragment has to implement BottomSheetImagePicker.OnImagesSelectedListener
to receive the selection callbacks. It will automatically be used by the picker.
override fun onImagesSelected(uris: List<Uri>, tag: String?) {
TODO("your implementation")
}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.