86 lines
2.6 KiB
Java
86 lines
2.6 KiB
Java
package com.bumptech.glide.request.target;
|
|
|
|
import android.graphics.drawable.Animatable;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.widget.ImageView;
|
|
import com.bumptech.glide.request.transition.Transition;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class ImageViewTarget<Z> extends ViewTarget<ImageView, Z> implements Transition.ViewAdapter {
|
|
private Animatable h;
|
|
|
|
public ImageViewTarget(ImageView imageView) {
|
|
super(imageView);
|
|
}
|
|
|
|
@Override // com.bumptech.glide.request.target.BaseTarget, com.bumptech.glide.request.target.Target
|
|
public void a(Drawable drawable) {
|
|
super.a(drawable);
|
|
c((ImageViewTarget<Z>) null);
|
|
d(drawable);
|
|
}
|
|
|
|
protected abstract void a(Z z);
|
|
|
|
@Override // com.bumptech.glide.request.target.ViewTarget, com.bumptech.glide.request.target.BaseTarget, com.bumptech.glide.request.target.Target
|
|
public void b(Drawable drawable) {
|
|
super.b(drawable);
|
|
c((ImageViewTarget<Z>) null);
|
|
d(drawable);
|
|
}
|
|
|
|
@Override // com.bumptech.glide.request.target.ViewTarget, com.bumptech.glide.request.target.BaseTarget, com.bumptech.glide.request.target.Target
|
|
public void c(Drawable drawable) {
|
|
super.c(drawable);
|
|
Animatable animatable = this.h;
|
|
if (animatable != null) {
|
|
animatable.stop();
|
|
}
|
|
c((ImageViewTarget<Z>) null);
|
|
d(drawable);
|
|
}
|
|
|
|
public void d(Drawable drawable) {
|
|
((ImageView) this.b).setImageDrawable(drawable);
|
|
}
|
|
|
|
@Override // com.bumptech.glide.request.target.BaseTarget, com.bumptech.glide.manager.LifecycleListener
|
|
public void onStart() {
|
|
Animatable animatable = this.h;
|
|
if (animatable != null) {
|
|
animatable.start();
|
|
}
|
|
}
|
|
|
|
@Override // com.bumptech.glide.request.target.Target
|
|
public void a(Z z, Transition<? super Z> transition) {
|
|
if (transition != null && transition.a(z, this)) {
|
|
b((ImageViewTarget<Z>) z);
|
|
} else {
|
|
c((ImageViewTarget<Z>) z);
|
|
}
|
|
}
|
|
|
|
@Override // com.bumptech.glide.request.target.BaseTarget, com.bumptech.glide.manager.LifecycleListener
|
|
public void b() {
|
|
Animatable animatable = this.h;
|
|
if (animatable != null) {
|
|
animatable.stop();
|
|
}
|
|
}
|
|
|
|
private void b(Z z) {
|
|
if (z instanceof Animatable) {
|
|
this.h = (Animatable) z;
|
|
this.h.start();
|
|
} else {
|
|
this.h = null;
|
|
}
|
|
}
|
|
|
|
private void c(Z z) {
|
|
a((ImageViewTarget<Z>) z);
|
|
b((ImageViewTarget<Z>) z);
|
|
}
|
|
}
|