RedirectGlide empowers Glide to load images with indirect URL
s.
Sometimes the images you want to show with Glide
have indirect link and you should redirect the URL
to reach the real direct link. RedirectGlide is an extension over Glide's OkHttp3 Integration which adds the redirection functionality to Glide
.
• Currently it's implemented only for Glide-v4.
Add the following lines to your build.gradle
file:
repositories {
jcenter()
}
dependencies {
implementation 'com.aminography:redirectglide:1.0.2'
// The normal Glide dependencies
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
You can simply use RedirectGlide by Glide's generated API. Note that you should clean and rebuild your project to create the GlideApp
class in compile time.
String imageUrl = "https://bit.ly/2zeMrFB";
GlideApp.with(context)
.load(imageUrl)
.into(imageView);
The default value for maximum redirection count is set to 5. However you can change it by wrapping the image URL
with an instance of RedirectGlideUrl
.
GlideApp.with(context)
.load(new RedirectGlideUrl(imageUrl, 10))
.into(imageView);