A simple way to handle remote image in Kotlin.

Overview

Parrot

A kotlin extension to load easily remote images in your ImageView.

parrot

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:

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

imageView.loadImage("http://the-most-awesome-image.png")

Callback usage

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

You might also like...
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.

Only 💐 An easy way to persist and run code block only as many times as necessary on Android. Download Gradle Add below codes to your root build.gradl

The easiest way to bring validation to your project
The easiest way to bring validation to your project

RxValidationTextInputLayout The easiest way to bring validation to EditText with TextInputLayout. Getting Started Add dependency to your project using

Android Library that provide simpler way to achieve modularity
Android Library that provide simpler way to achieve modularity

ToyBricks 中文文档 ToyBricks简介以及原理分析 ToyBricks用户手册 Introduction Android Library that provide simpler way to achieve modularity. Compile System requirement

:bouquet: An easy way to persist and run code block only as many times as necessary on Android.
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.

Only 💐 An easy way to persist and run code block only as many times as necessary on Android. Download Gradle Add below codes to your root build.gradl

:closed_umbrella: An easy way to implement modern permission instructions popup.
:closed_umbrella: An easy way to implement modern permission instructions popup.

Needs An easy way to implement modern permission instructions popup. Needs can be fully customized and showing with animations. Download Gradle Add be

:performing_arts: An easy, flexible way to implement veil skeletons and shimmering effect for Android.
:performing_arts: An easy, flexible way to implement veil skeletons and shimmering effect for Android.

AndroidVeil An easy, flexible way to implement veil skeletons and shimmering effect for Android. Download Gradle Add below codes to your root build.gr

A fragment binding library - the easier, efficient way.

Byda allprojects { repositories { ... maven { url 'https://jitpack.io' } } } dependencies { implementation 'com.github.Codzure:B

A lightweight alternative to Android's ViewModels. The easiest way to retain instances in Activities, Fragments or Composables.

A lightweight alternative to Android's ViewModels. The easiest way to retain instances in Activities, Fragments or Composables.

Modern Calendar View Supporting Both Hijri and Gregorian Calendars but in highly dynamic way
Modern Calendar View Supporting Both Hijri and Gregorian Calendars but in highly dynamic way

KCalendar-View Modern calendar view supporting both Hijri and Gregorian calendar

Owner
Matteo Crippa
👨🏻‍💻 Senior Software Engineer
Matteo Crippa
💫 Small microservice to handle state changes of Kubernetes pods and post them to Instatus or Statuspages

?? Kanata Small microservice to handle state changes of Kubernetes pods and post them to Instatus or Statuspages ?? Why? I don't really want to implem

Noel 4 Mar 4, 2022
Parking Robot based on 3D LiDAR. Keywords: Automatic Parking, SLAM, 3D Navigation, Remote Control, ROS, RRT

ELEC3875-Final-Project My undergraduate final project: Parking Robot based on 3D LiDAR. ELEC3875 / XJEL3875 Keywords: Automatic Parking, SLAM, 3D Navi

Hugo Hu 6 Oct 1, 2022
Blinking-image-view - A variant of Android View that blinks only the source image (not the background)

Blinker View for Android What is this? Blinker View is an Android View that blinks a given drawable. Yes, it's that simple. Place it in your layout an

Milos Marinkovic 4 Jul 29, 2020
A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.

native_memory_allocator A library which uses sun.misc.Unsafe to allocate off-heap native memory. Motivation The goal of this project is to provide a s

Target 5 Dec 8, 2022
Kotlin-native webserver for simple image annotations

Kotlin-native webserver for simple image annotations

null 1 Feb 26, 2022
Simple Android Library, that provides easy way to start the Activities with arguments.

Warning: Library is not maintained anymore. If you want to take care of this library, propose it via Pull Request. It needs adjustmensts for newer ver

Marcin Moskała 429 Dec 15, 2022
Extension functions over Android's callback-based APIs which allows writing them in a sequential way within coroutines or observe multiple callbacks through kotlin flow.

callback-ktx A lightweight Android library that wraps Android's callback-based APIs into suspending extension functions which allow writing them in a

Sagar Viradiya 171 Oct 31, 2022
kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin.

kinstall kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin. use First, install kinstall its

david kilmer 0 Apr 24, 2022
Image loading for Android backed by Kotlin Coroutines.

An image loading library for Android backed by Kotlin Coroutines. Coil is: Fast: Coil performs a number of optimizations including memory and disk cac

Coil 8.8k Jan 7, 2023
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Kirill Biakov 827 Dec 22, 2022