https://github.com/aminography/redirectglide
RedirectGlide empowers Glide to load images with indirect URLs.
https://github.com/aminography/redirectglide
glide glidev4 redirect-urls
Last synced: 10 months ago
JSON representation
RedirectGlide empowers Glide to load images with indirect URLs.
- Host: GitHub
- URL: https://github.com/aminography/redirectglide
- Owner: aminography
- Created: 2018-11-12T19:44:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-23T15:42:41.000Z (over 3 years ago)
- Last Synced: 2023-07-26T21:14:34.623Z (almost 3 years ago)
- Topics: glide, glidev4, redirect-urls
- Language: Kotlin
- Homepage:
- Size: 354 KB
- Stars: 38
- Watchers: 3
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RedirectGlide :zap:
[](https://android-arsenal.com/details/1/7431)
[](https://android-arsenal.com/api?level=14)

## **RedirectGlide** empowers [Glide][1] 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][2] 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:
```gradle
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:
```gradle
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:latest_version'
}
```
How to use RedirectGlide?
--------
You can simply use **RedirectGlide** by [Glide's generated API][3]. Note that you **should clean and rebuild** your project to create the `GlideApp` class in compile time.
```kotlin
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`.
```kotlin
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.
```
[1]: https://github.com/bumptech/glide
[2]: https://github.com/bumptech/glide/tree/master/integration/okhttp3
[3]: https://bumptech.github.io/glide/doc/generatedapi.html