Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/WendyYanto/android-image-picker
Image gallery library by using coroutine to help user to choose image (single or multi) from android device without usage of android gallery intent
https://github.com/WendyYanto/android-image-picker
coroutines-android custom-view image-gallery image-picker-android image-picker-library kotlin-android kotlin-coroutines viewbinding
Last synced: about 1 month ago
JSON representation
Image gallery library by using coroutine to help user to choose image (single or multi) from android device without usage of android gallery intent
- Host: GitHub
- URL: https://github.com/WendyYanto/android-image-picker
- Owner: WendyYanto
- License: apache-2.0
- Created: 2019-04-30T04:08:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-27T15:52:53.000Z (over 2 years ago)
- Last Synced: 2024-08-02T20:45:42.259Z (4 months ago)
- Topics: coroutines-android, custom-view, image-gallery, image-picker-android, image-picker-library, kotlin-android, kotlin-coroutines, viewbinding
- Language: Kotlin
- Homepage:
- Size: 1.41 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-indo-projects - Android Image Picker - Non-blocking image gallery library built using Kotlin and Coroutine to help users when choosing images. (Android)
- awesome-indonesia-repo - Android Image Picker - Non-blocking image gallery library built using Kotlin and Coroutine to help users when choosing images. (Android)
README
# Android Image Picker
Image gallery library by using coroutine to help user to choose image (single or multi) from android device without usage of android gallery implicit intent. This library supports **AndroidX** and it is **very recommended** to use **AndroidX** in your project.
[![](https://jitpack.io/v/WendyYanto/android-image-picker.svg)](https://jitpack.io/#WendyYanto/android-image-picker)
![Demo](https://github.com/WendyYanto/android-image-picker/blob/master/images/sample.png)
## Implementation Steps
1. This library has already been included in jitpack.io. In order to use it, you should add it in your root build.gradle at the end of repositories:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
2. Add the dependency
```
dependencies {
implementation 'com.github.WendyYanto:android-image-picker:v1.3.0'
}
```
3. Register the code below in Android.Manifest.xml
```
// Provide permission to read image in android device// Register Activity
```
4. Implement dependency injection of this plugin by initialize this code once. Usage of MediaDao is to fetch images using coroutines. It is recommended to add this code when in the UI that require `GalleryActivity`
```kotlin
// Kotlin
override fun onCreate() {
super.onCreate()
Injector.store(MediaDao::class.java, MediaDao(this))
}
``````java
// Java
@Override
public void onCreate() {
Injector.INSTANCE.store(MediaDao.class, new MediaDao(this));
}
```## Configuration
Definition of Intent Extra's for GalleryActivity :
1. `MAX_COUNT`: Maximum images user can select from gallery (default value: 1)
2. `SUBMIT_BUTTON_STYLE`: Style attributes for submit button (default: android button style)
3. `THEME`: Theme for GalleryActivity (default: your app theme)
4. `CATEGORY_DROPDOWN_ITEM_LAYOUT`: Layout for your image category spinner item at the toolbar (default: `android.R.layout.simple_spinner_dropdown_item`)Example:
```
val intent = Intent(this@MainActivity, GalleryActivity::class.java)
intent.putExtra(GalleryActivity.MAX_COUNT, 10)
intent.putExtra(GalleryActivity.SUBMIT_BUTTON_STYLE, R.style.MyButton)
intent.putExtra(GalleryActivity.THEME, R.style.GalleryTheme)
intent.putExtra(GalleryActivity.CATEGORY_DROPDOWN_ITEM_LAYOUT, R.layout.spinner_item)
```
Example Output:![Styled Gallery](https://github.com/WendyYanto/android-image-picker/blob/master/images/custom_sample.png)