package defpackage;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Property;
import android.view.View;
import android.view.ViewPropertyAnimator;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.ImageView;
import androidx.fragment.app.o;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import defpackage.dw7;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\u0018\u00002\u00020\u0001:\u0001\u0002¨\u0006\u0003"}, d2 = {"Le24;", "", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class e24 {
    public final o a;
    public final View b;
    public final ImageView c;
    public final View d;
    public ImageView e;
    public ImageView f;
    public long g;
    public g24 h;
    public boolean i;
    public AnimatorSet j;
    public final boolean k;
    public h24 l;
    public BitmapDrawable m;
    public Drawable n;
    public boolean o;
    public BitmapDrawable p;
    public boolean q;
    public qq3 r;
    public final AccelerateDecelerateInterpolator s;

    @Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0010\u0007\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0006\u001a\u00020\u00058\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0006\u0010\u0007R\u0014\u0010\b\u001a\u00020\u00058\u0002X\u0082T¢\u0006\u0006\n\u0004\b\b\u0010\u0007R\u0014\u0010\t\u001a\u00020\u00058\u0002X\u0082T¢\u0006\u0006\n\u0004\b\t\u0010\u0007R\u0014\u0010\n\u001a\u00020\u00058\u0002X\u0082T¢\u0006\u0006\n\u0004\b\n\u0010\u0007R\u0014\u0010\u000b\u001a\u00020\u00058\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000b\u0010\u0007R\u0014\u0010\f\u001a\u00020\u00058\u0002X\u0082T¢\u0006\u0006\n\u0004\b\f\u0010\u0007R\u0014\u0010\u000e\u001a\u00020\r8\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000e\u0010\u000fR\u0014\u0010\u0010\u001a\u00020\r8\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0010\u0010\u000f¨\u0006\u0011"}, d2 = {"Le24$a;", "", "", "FADE_IN_DURATION", "J", "", "OVERLAY_ALPHA", "I", "SIDECAR_BLUR_RADIUS", "SIDECAR_BLUR_SAMPLING", "SIDECAR_WIDTH", "SIDECAR_HEIGHT", "SIDECAR_TRANSITION_DURATION", "", "SIDECAR_SATURATION", "F", "SIDECAR_BRIGHTNESS", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class a {
    }

    public e24(o oVar, ImageView imageView, ImageView imageView2, View view, ImageView imageView3, View view2) {
        cr4.g(oVar, "fragment");
        cr4.g(imageView, "backdropView");
        cr4.g(imageView2, "backdropIncomingView");
        cr4.g(view, "ambientOverlay");
        this.a = oVar;
        this.b = view;
        this.c = imageView3;
        this.d = view2;
        this.e = imageView;
        this.f = imageView2;
        this.k = imageView3 != null;
        this.s = new AccelerateDecelerateInterpolator();
    }

    public static final void a(e24 e24Var) {
        ImageView imageView;
        if (e24Var.o && e24Var.q) {
            Drawable drawable = e24Var.n;
            if (drawable != null) {
                e24Var.d(drawable);
            }
            BitmapDrawable bitmapDrawable = e24Var.p;
            if (bitmapDrawable != null && (imageView = e24Var.c) != null) {
                imageView.animate().cancel();
                if (e24Var.m == null) {
                    imageView.setImageDrawable(bitmapDrawable);
                    imageView.setAlpha(1.0f);
                } else {
                    imageView.animate().alpha(0.0f).setDuration(200L).withEndAction(new yg(imageView, bitmapDrawable, 24)).start();
                }
                e24Var.m = bitmapDrawable;
            }
            qq3 qq3Var = e24Var.r;
            if (qq3Var != null) {
                qq3Var.invoke();
            }
            e24Var.n = null;
            e24Var.p = null;
            e24Var.o = false;
            e24Var.q = false;
            e24Var.r = null;
        }
    }

    public final void b() {
        ViewPropertyAnimator viewPropertyAnimatorAnimate;
        AnimatorSet animatorSet = this.j;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        this.j = null;
        this.f.setImageDrawable(null);
        this.f.setAlpha(0.0f);
        ImageView imageView = this.c;
        if (imageView == null || (viewPropertyAnimatorAnimate = imageView.animate()) == null) {
            return;
        }
        viewPropertyAnimatorAnimate.cancel();
    }

    public final void c() {
        b();
        this.n = null;
        this.p = null;
        this.o = false;
        this.q = false;
        this.r = null;
        g24 g24Var = this.h;
        o oVar = this.a;
        if (g24Var != null) {
            com.bumptech.glide.a.h(oVar).j(g24Var);
        }
        this.h = null;
        h24 h24Var = this.l;
        if (h24Var != null) {
            com.bumptech.glide.a.h(oVar).j(h24Var);
        }
        this.l = null;
        this.m = null;
        this.e.setImageDrawable(null);
        this.f.setImageDrawable(null);
        ImageView imageView = this.c;
        if (imageView != null) {
            imageView.setImageDrawable(null);
        }
    }

    public final void d(Drawable drawable) {
        Drawable.ConstantState constantState;
        Drawable drawableNewDrawable;
        Drawable drawableMutate;
        b();
        if (drawable != null && (constantState = drawable.getConstantState()) != null && (drawableNewDrawable = constantState.newDrawable()) != null && (drawableMutate = drawableNewDrawable.mutate()) != null) {
            drawable = drawableMutate;
        }
        if (drawable == null) {
            return;
        }
        if (this.e.getDrawable() == null) {
            this.e.setImageDrawable(drawable);
            this.e.setAlpha(1.0f);
            return;
        }
        ImageView imageView = this.e;
        ImageView imageView2 = this.f;
        imageView2.setImageDrawable(drawable);
        imageView2.setAlpha(0.0f);
        ObjectAnimator objectAnimatorOfFloat = ObjectAnimator.ofFloat(imageView2, (Property<ImageView, Float>) View.ALPHA, 0.0f, 1.0f);
        objectAnimatorOfFloat.setDuration(700L);
        objectAnimatorOfFloat.setInterpolator(this.s);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(objectAnimatorOfFloat);
        animatorSet.addListener(new f24(new dw7.a(), this, imageView2, imageView));
        animatorSet.start();
        this.j = animatorSet;
    }

    public final void e(String str, Drawable drawable, c62 c62Var) {
        long j = this.g + 1;
        this.g = j;
        b();
        this.n = null;
        this.p = null;
        this.o = false;
        this.q = false;
        this.r = null;
        g24 g24Var = this.h;
        o oVar = this.a;
        if (g24Var != null) {
            com.bumptech.glide.a.h(oVar).j(g24Var);
        }
        h24 h24Var = this.l;
        if (h24Var != null) {
            com.bumptech.glide.a.h(oVar).j(h24Var);
        }
        if (!this.i) {
            int iK = g61.k(-16777216, 80);
            View view = this.b;
            view.setBackgroundColor(iK);
            view.setAlpha(1.0f);
            this.i = true;
        }
        boolean z = this.k;
        if (str == null || n89.ab(str)) {
            if (drawable != null) {
                d(drawable);
            }
            if (z) {
                ImageView imageView = this.c;
                if (imageView != null) {
                    imageView.setImageDrawable(null);
                }
                if (imageView != null) {
                    imageView.setAlpha(0.0f);
                }
                this.m = null;
            }
            if (c62Var != null) {
                c62Var.invoke();
                return;
            }
            return;
        }
        this.r = c62Var;
        boolean zAr = n89.ar(str, "drawable://", false);
        Object objValueOf = str;
        if (zAr) {
            int identifier = oVar.requireContext().getResources().getIdentifier(n89.ai(str, "drawable://"), "drawable", oVar.requireContext().getPackageName());
            objValueOf = str;
            if (identifier != 0) {
                objValueOf = Integer.valueOf(identifier);
            }
        }
        dc2 dc2Var = zAr ? dc2.b : dc2.d;
        this.h = new g24(j, this, drawable);
        l08 l08VarB = com.bumptech.glide.a.h(oVar).b(Bitmap.class);
        f18 f18Var = a18.m;
        l08 l08Var = (l08) ((l08) ((l08) l08VarB.a(f18Var).aj(objValueOf).e(dc2Var)).k(1280, 720)).b();
        nj9 nj9Var = this.h;
        cr4.d(nj9Var);
        l08Var.ag(nj9Var, l08Var);
        if (!z) {
            this.q = true;
            return;
        }
        fc6 fc6Var = new fc6(new q51(), new nd0(4));
        this.l = new h24(j, this, drawable);
        l08 l08Var2 = (l08) ((l08) ((l08) com.bumptech.glide.a.c(oVar.getContext()).d(oVar).b(Bitmap.class).a(f18Var).aj(objValueOf).e(dc2Var)).k(390, 220)).x(fc6Var, true);
        nj9 nj9Var2 = this.l;
        cr4.d(nj9Var2);
        l08Var2.ag(nj9Var2, l08Var2);
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ e24(o oVar, ImageView imageView, ImageView imageView2, View view, ImageView imageView3, View view2, int i) {
        this(oVar, imageView, imageView2, view, imageView3, view2);
        Color.parseColor("#80000000");
    }
}
