build.gradle
repositories {
mavenCentral() // jcenter() works as well because it pulls from Maven Central
}
dependencies {
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.android.support:support-v4:25.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
}
ProGaurd
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.AppGlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
# for DexGuard only
-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
Generated API
MyAppGlideModule.java
package com.example.myapp;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}
Kotlin
apply plugin: 'kotlin-kapt'
kapt 'com.github.bumptech.glide:compiler:4.0.0'
Use :
GlideApp.with(context)
.load(image.getFile())
.override(measuredWidth,measuredWidth)
.centerCrop()
.placeholder(context.getResources().getDrawable(R.mipmap.image_placeholder))
.into(holder.imageViewThumbnail);
References
http://bumptech.github.io/glide/
https://github.com/bumptech/glide
http://bumptech.github.io/glide/doc/generatedapi.html
https://inthecheesefactory.com/blog/get-to-know-glide-recommended-by-google/en