/slight

:octocat: Easy, sample and flexible library for loading, caching and displaying images on Android. written in Kotlin

Primary LanguageKotlinMIT LicenseMIT

Android Image Loader

Codacy Badge minSdkVersion compileSdkVersion

Easy, sample and flexible library for loading, caching and displaying images on Android.

How to include

With gradle: edit your build.gradle:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

dependencies {
    compile 'com.github.intelligo-systems:slight:1.1.3'
}

Or declare it into your pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.intelligo-systems</groupId>
    <artifactId>slight</artifactId>
    <version>1.1.3</version>
</dependency>

How to use

Basic Usage

add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Java

@Override 
public void onCreate(Bundle savedInstanceState) {
  ...
  ImageView imageView = (ImageView) findViewById(R.id.my_image_view);
  
  ImageLoader imageLoader = new ImageLoader(context);
  
  imageLoader.DisplayImage(url, imageView);
}

Kotlin

override fun onCreate(savedInstanceState: Bundle?) {
    ...
    val imageView = findViewById(R.id.my_image_view) as ImageView

    val imageLoader = ImageLoader(this)

    imageLoader.DisplayImage(url, imageView)
}