Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esafirm/android-image-picker
Image Picker for Android 🤖
https://github.com/esafirm/android-image-picker
android camera gallery hacktoberfest image-picker picker-library
Last synced: 25 days ago
JSON representation
Image Picker for Android 🤖
- Host: GitHub
- URL: https://github.com/esafirm/android-image-picker
- Owner: esafirm
- License: mit
- Created: 2016-10-15T12:35:19.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-07-24T01:49:10.000Z (3 months ago)
- Last Synced: 2024-09-27T04:02:43.450Z (about 1 month ago)
- Topics: android, camera, gallery, hacktoberfest, image-picker, picker-library
- Language: Kotlin
- Homepage:
- Size: 920 KB
- Stars: 1,106
- Watchers: 24
- Forks: 327
- Open Issues: 62
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-android - Android Image Picker - A library that makes images and videos selection from gallery feels easy. It also support GIF and simple camera action (Libraries / GUI)
- awesome-indonesia-repo - ImagePicker - A configureable library to select image from gallery and camera without hassle. (Android)
- awesome-github-android-ui - android-image-picker - 选择图像的简单的库 (图片)
- awesome-indo-projects - ImagePicker - A configureable library to select image from gallery and camera without hassle. (Android)
README
Android Image Picker
No config yet highly configurable image picker for Android
# Screenshot
Click to see how image picker looks…
## Download
Add this to your project's `build.gradle`
```groovy
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
```And add this to your module's `build.gradle`
```groovy
dependencies {
implementation 'com.github.esafirm:android-image-picker:x.y.z'
}
```change `x.y.z` to version in the [release page](https://github.com/esafirm/android-image-picker/releases)
# Usage
For full example, please refer to the `sample` app.
Also you can browse the issue labeled as
question [here](https://github.com/esafirm/android-image-picker/issues?utf8=%E2%9C%93&q=label%3Aquestion+)## Start image picker activity
The simplest way to start
```kotlin
val launcher = registerImagePicker {
// handle result here
}launcher.launch()
```Complete features of what you can do with ImagePicker
```kotlin
val config = ImagePickerConfig {
mode = ImagePickerMode.SINGLE // default is multi image mode
language = "in" // Set image picker language
theme = R.style.ImagePickerTheme// set whether pick action or camera action should return immediate result or not. Only works in single mode for image picker
returnMode = if (returnAfterCapture) ReturnMode.ALL else ReturnMode.NONEisFolderMode = folderMode // set folder mode (false by default)
isIncludeVideo = includeVideo // include video (false by default)
isOnlyVideo = onlyVideo // include video (false by default)
arrowColor = Color.RED // set toolbar arrow up color
folderTitle = "Folder" // folder selection title
imageTitle = "Tap to select" // image selection title
doneButtonText = "DONE" // done button text
limit = 10 // max images can be selected (99 by default)
isShowCamera = true // show camera or not (true by default)
savePath = ImagePickerSavePath("Camera") // captured image directory name ("Camera" folder by default)
savePath =
ImagePickerSavePath(Environment.getExternalStorageDirectory().path, isRelative = false) // can be a full pathexcludedImages = images.toFiles() // don't show anything on this selected images
selectedImages = images // original selected images, used in multi mode
}
```If you want to call it outside `Activity` or `Fragment`, you can get the `Intent` with `createImagePickerIntent`
> Please note: handling in `onActivityResult` is not recommended since it's already deprecated in favor of the new
> result API```kotlin
val intent = createImagePickerIntent(context, ImagePickerConfig())
startActivityForResult(intent, RC_IMAGE_PICKER)
```## Receive result
when you're done picking images, result will be returned on launcher callback with type `List`. This list cannot
be null but can be empty```kotlin
val launcher = registerImagePicker { result: List ->
result.forEach { image ->
println(image)
}
}
```## Camera Only
Use `CameraOnlyConfig` instead of `ImagePickerConfig`
```kotlin
val launcher = registerImagePicker { }
launcher.launch(CameraOnlyConfig())
```You also still can use the `DefaultCameraModule` but discouraged to do it.
# Wiki
- [Custom components](https://github.com/esafirm/android-image-picker/blob/main/docs/custom_components.md)
- [Using another image library](https://github.com/esafirm/android-image-picker/blob/main/docs/another_image_library.md)
- [Return mode](https://github.com/esafirm/android-image-picker/blob/main/docs/return_mode.md)
- [Save location](https://github.com/esafirm/android-image-picker/blob/main/docs/save_location.md)# Version 2.x.x
If you still use the previous version, you can check `2.x` branch
in [here](https://github.com/esafirm/android-image-picker/tree/2.x)# Support Me!
I would make myself more commited to this repo and OSS works in general.
Would you help me achieving this goals?
# Credits
- AIP Logo by [anaufalm](https://github.com/anaufalm)
# License
MIT @ Esa Firman