https://github.com/prongbang/photolib
PhotoKit Library for Android
https://github.com/prongbang/photolib
android camera capture gallery library photokit-library
Last synced: 3 months ago
JSON representation
PhotoKit Library for Android
- Host: GitHub
- URL: https://github.com/prongbang/photolib
- Owner: prongbang
- License: mit
- Created: 2018-09-04T17:11:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-17T07:58:08.000Z (about 5 years ago)
- Last Synced: 2025-07-30T21:46:28.983Z (3 months ago)
- Topics: android, camera, capture, gallery, library, photokit-library
- Language: Kotlin
- Homepage:
- Size: 145 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PhotoKit Library
## How to use:
- Add it in your root build.gradle at the end of repositories:
```gragle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
- Add the dependency for support library
```gradle
dependencies {
implementation 'com.github.prongbang:photolib:1.0.0'
}
```- Add the dependency for androidX
```gradle
dependencies {
implementation 'com.github.prongbang:photolib:1.2.0'
}
```- Select Image from Gallery
```kotlin
PhotoKit.Builder(this, BuildConfig.APPLICATION_ID)
.addOnPhotoListener { uri ->
ivPreview.setImageURI(uri)
}
.build()
.gallery()
```- Select Image by options
```kotlin
PhotoKit.Builder(this, BuildConfig.APPLICATION_ID)
.addOnPhotoListener { uri ->
ivPreview.setImageURI(uri)
}
.addOnCameraListener { bitmap ->
ivPreview.setImageBitmap(bitmap)
}
.build()
.selectImage()
```- Take a Photo
```kotlin
PhotoKit.Builder(this, BuildConfig.APPLICATION_ID)
.addOnCameraListener { bitmap ->
ivPreview.setImageBitmap(bitmap)
}
.build()
.takePhoto()
```- On Activity Result
```kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)PhotoKit.onActivityResult(requestCode, resultCode, data)
}```