RedirectGlide

Additional

Language
Java
Version
N/A
Created
Nov 13, 2018
Updated
Apr 28, 2019
Owner
Mohammad Amin Hassani (aminography)
Contributor
Mohammad Amin Hassani (aminography)
1
Activity
Badge
Generate
Download
Source code
APK file

Show card

RedirectGlide ⚡️

RedirectGlide empowers Glide to load images with indirect URLs.

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.

Download

Add the following lines to your build.gradle file:

repositories {
    jcenter()
}
  
dependencies {
    implementation 'com.aminography:redirectglide:1.0.3'
    
    // The normal Glide dependencies
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}

How to use RedirectGlide?

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);

• Customize the maximum redirection count

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);