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 extends ViewTarget 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) 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) 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) 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 transition) { if (transition != null && transition.a(z, this)) { b((ImageViewTarget) z); } else { c((ImageViewTarget) 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); b((ImageViewTarget) z); } }