Skip to content

Kotlin extensions of Blurhash for ImageView, Added support for third-party libraries (Glide Coil Picasso and Fresco).

License

Notifications You must be signed in to change notification settings

hushenghao/blurhash-android

Repository files navigation

Blurhash-Android

Kotlin extensions of Blurhash for ImageView, Added support for third-party libraries (Glide Coil Picasso and Fresco).

To find out more about Blurhash, see https://github.com/woltapp/blurhash.

Usage

Add the library to a project

repositories {
    mavenCentral()
}

dependencies {
    implementation "io.github.hushenghao:blurhash-android:1.0.1"
}

Samples

// Example hash
private const val BLUR_HASH = "LVPO*{9docS\$}Nn4R.oy\$]\${n\$bI"
// Simulate network failure
private val nullData: String? = null

BlurHashDrawable

imageView.setImageDrawable(BlurHashDrawable(BLUR_HASH))

Glide

Glide.with(ivGlide).load(nullData).blurHash(BLUR_HASH).into(ivGlide)

Coil

ivCoil.load(nullData) {
    blurHash(BLUR_HASH)
}

Picasso

Picasso.get().load(nullData).blurHash(BLUR_HASH).into(ivPicasso)

Fresco

icFresco.hierarchy.blurHash(BLUR_HASH)
icFresco.setImageURI(nullData)

Other

You can also see nice examples and try it out yourself at blurha.sh!

About

Kotlin extensions of Blurhash for ImageView, Added support for third-party libraries (Glide Coil Picasso and Fresco).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages