When subsequent loads fail, image displayed with GlideRequest.error() blinks (reloads?) instead of being still image
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
**Glide Version**: 4.11.0
**Integration libraries**: OkHttp 4.4.1, okhttp3-integration 4.11.0
**Device/Android Version**: Android TV STB, Android 9
**Issue details / Repro steps / Use case background**:
I want to specify some Android resource to be displayed when Glide fails to load target image from the internet, so I use the `GlideRequest.error()` method. My problem is: when subsequent `load()` calls fail, resource file is being displayed all the time, but with the visible blink (like a reloading look) after (or during?) each call to `load()`. I don't want this blinking to be visible.
This behavior is not limited to Android Drawable resource, I can reproduce it also with passing url or ColorDrawable.
I will use ColorDrawable to demonstrate this issue.
```
GlideApp.with(fragment)
.load(imageUrl)
.error(ColorDrawable(Color.RED))
.into(view)
```
What happens (more or less as I see this):
```
1. Trying to load url1 -> fail -> red color is displayed
2. Trying to load url2 -> fail -> blink -> red color is displayed
3. Trying to load url3 -> fail -> blink -> red color is displayed
```
I would like to see still image without blinking in such case.
Interesting thing is when I use `placeholder()` instead of `error()`, for failed loading of these urls, I get the still placeholder image, without blinking:
```
GlideApp.with(fragment)
.load(imageUrl)
.placeholder(ColorDrawable(Color.RED))
.into(view)
```
Another interesting fact is that without trying to load urls from the internet, just only trying to display ColorDrawable, there is also no blinking after subsequent calls:
```
GlideApp.with(fragment)
.load(ColorDrawable(Color.RED))
.into(view)
```
So, it looks like the problem (blinking/reloading) is visible only when using `error()` method.
**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```java
class MyImageView : AppCompatImageView {
fun loadImage(fragment: Fragment, imageUrl: String?) {
GlideApp.with(fragment)
.load(imageUrl)
.error(ColorDrawable(Color.RED))
.into(view)
}
```
Contributor guide
Assessment
This issue has not been assessed yet.