Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matteocrippa/Parrot
A simple way to handle remote image in Kotlin.
https://github.com/matteocrippa/Parrot
fuel glide image image-download image-downloader imageview kotlin network
Last synced: 2 months ago
JSON representation
A simple way to handle remote image in Kotlin.
- Host: GitHub
- URL: https://github.com/matteocrippa/Parrot
- Owner: matteocrippa
- License: mit
- Created: 2017-12-23T11:09:45.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-22T13:15:49.000Z (over 6 years ago)
- Last Synced: 2024-08-03T03:04:35.928Z (6 months ago)
- Topics: fuel, glide, image, image-download, image-downloader, imageview, kotlin, network
- Language: Kotlin
- Homepage:
- Size: 92.8 KB
- Stars: 22
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin - Parrot - ImageView extension for async loading. (Libraries / Android)
README
# Parrot
A kotlin extension to load easily remote images in your `ImageView`.
![parrot](https://github.com/matteocrippa/parrot/blob/master/.github/parrot.png?raw=true)
# Install
Add to **gradle** in _allprojects_
```
maven { url 'https://jitpack.io' }
```then add this
```
compile 'com.github.matteocrippa:Parrot:0.0.6'
```# Usage
`Parrot` needs to be init once, passing the app context:```kotlin
Parrot(context)
```then provides you a simple function to tame all your needs:
`ImageView.load`
This function has the following parameters:
- `url`, _optional_ string with current remote image url
- `placeholder`, _optional_ bitmap placeholder or resource Id
- `caching`, you can set your favorite caching system, see below
- `manipulate`, _optional_ callback returns the image before setting to your imageview, here you can tweak the image
- `onPlaceholder`, _optional_ callback returns if a placeholder has been set
- `onComplete`, _optional_ callback returns when the image has been applied to the imageview## Caching
`Parrot` provide an easy way to handle images caching:- `NetOnly`, _default_ option, force always reloading from net
- `NetThenDisk`, download once and use local version## Examples
Simple usage
```kotlinimageView.loadImage("http://the-most-awesome-image.png")
```Callback usage
```kotlin
imageView.loadImage("http://the-most-awesome-image.png",
manipulate = { bitmap ->
// alter bitmap
bitmap
}, onComplete = { completed ->
// do something
}```
#### Credits
Icon is taken by free emojii set by [Vincent Le Moign](https://dribbble.com/webalys)