RedirectGlide ⚡
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
.
• NOTE: Currently it's implemented only for Glide-v4.
Download
RedirectGlide
is available on MavenCentral to download using build tools systems. Add the following lines to your build.gradle file:
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
dependencies {
implementation 'com.aminography:redirectglide:2.1.0'
// Glide dependencies
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
}
- If you write code in Java, you should also add kotlin dependency too:
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:latest_version'
}
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.
val 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(RedirectGlideUrl(imageUrl, 10))
.into(imageView)
Change Log
Version 2.0.1
- Fixing compatibility with Glide 4.11.0.
Version 2.0.0
- Migrating to AndroidX.
- Migrating to Kotlin.
License
Copyright 2019 Mohammad Amin Hassani.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.