package defpackage;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.view.Gravity;
import java.util.ArrayList;

/* JADX INFO: renamed from: ˈᵞˌᵔ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C1087 extends Drawable implements Animatable {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final C0068 f4626;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public boolean f4627;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public Rect f4628;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public boolean f4629;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public boolean f4630;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public boolean f4631;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public int f4633;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public Paint f4634;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public boolean f4632 = true;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public final int f4625 = -1;

    public C1087(C0068 c0068) {
        this.f4626 = c0068;
    }

    @Override // android.graphics.drawable.Drawable
    public final void draw(Canvas canvas) {
        if (this.f4631) {
            return;
        }
        if (this.f4627) {
            int intrinsicWidth = getIntrinsicWidth();
            int intrinsicHeight = getIntrinsicHeight();
            Rect bounds = getBounds();
            if (this.f4628 == null) {
                this.f4628 = new Rect();
            }
            Gravity.apply(119, intrinsicWidth, intrinsicHeight, bounds, this.f4628);
            this.f4627 = false;
        }
        C0870 c0870 = (C0870) this.f4626.f1275;
        C1101 c1101 = c0870.f3862;
        Bitmap bitmap = c1101 != null ? c1101.f4686 : c0870.f3856;
        if (this.f4628 == null) {
            this.f4628 = new Rect();
        }
        Rect rect = this.f4628;
        if (this.f4634 == null) {
            this.f4634 = new Paint(2);
        }
        canvas.drawBitmap(bitmap, (Rect) null, rect, this.f4634);
    }

    @Override // android.graphics.drawable.Drawable
    public final Drawable.ConstantState getConstantState() {
        return this.f4626;
    }

    @Override // android.graphics.drawable.Drawable
    public final int getIntrinsicHeight() {
        return ((C0870) this.f4626.f1275).f3853;
    }

    @Override // android.graphics.drawable.Drawable
    public final int getIntrinsicWidth() {
        return ((C0870) this.f4626.f1275).f3855;
    }

    @Override // android.graphics.drawable.Drawable
    public final int getOpacity() {
        return -2;
    }

    @Override // android.graphics.drawable.Animatable
    public final boolean isRunning() {
        return this.f4630;
    }

    @Override // android.graphics.drawable.Drawable
    public final void onBoundsChange(Rect rect) {
        super.onBoundsChange(rect);
        this.f4627 = true;
    }

    @Override // android.graphics.drawable.Drawable
    public final void setAlpha(int i) {
        if (this.f4634 == null) {
            this.f4634 = new Paint(2);
        }
        this.f4634.setAlpha(i);
    }

    @Override // android.graphics.drawable.Drawable
    public final void setColorFilter(ColorFilter colorFilter) {
        if (this.f4634 == null) {
            this.f4634 = new Paint(2);
        }
        this.f4634.setColorFilter(colorFilter);
    }

    @Override // android.graphics.drawable.Drawable
    public final boolean setVisible(boolean z, boolean z2) {
        ᵿᵽᵤ.ᵲᵶᵳˈ("Cannot change the visibility of a recycled resource. Ensure that you unset the Drawable from your View before changing the View's visibility.", !this.f4631);
        this.f4632 = z;
        if (!z) {
            this.f4630 = false;
            C0870 c0870 = (C0870) this.f4626.f1275;
            ArrayList arrayList = c0870.f3851;
            arrayList.remove(this);
            if (arrayList.isEmpty()) {
                c0870.f3863 = false;
            }
        } else if (this.f4629) {
            m3527();
        }
        return super.setVisible(z, z2);
    }

    @Override // android.graphics.drawable.Animatable
    public final void start() {
        this.f4629 = true;
        this.f4633 = 0;
        if (this.f4632) {
            m3527();
        }
    }

    @Override // android.graphics.drawable.Animatable
    public final void stop() {
        this.f4629 = false;
        this.f4630 = false;
        C0870 c0870 = (C0870) this.f4626.f1275;
        ArrayList arrayList = c0870.f3851;
        arrayList.remove(this);
        if (arrayList.isEmpty()) {
            c0870.f3863 = false;
        }
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void m3527() {
        ᵿᵽᵤ.ᵲᵶᵳˈ("You cannot start a recycled Drawable. Ensure thatyou clear any references to the Drawable when clearing the corresponding request.", !this.f4631);
        C0870 c0870 = (C0870) this.f4626.f1275;
        if (c0870.f3858.f7589.f2200 == 1) {
            invalidateSelf();
            return;
        }
        if (this.f4630) {
            return;
        }
        this.f4630 = true;
        ArrayList arrayList = c0870.f3851;
        if (c0870.f3857) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Cannot subscribe to a cleared frame loader");
            return;
        }
        if (arrayList.contains(this)) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Cannot subscribe twice in a row");
            return;
        }
        boolean zIsEmpty = arrayList.isEmpty();
        arrayList.add(this);
        if (zIsEmpty && !c0870.f3863) {
            c0870.f3863 = true;
            c0870.f3857 = false;
            c0870.m3060();
        }
        invalidateSelf();
    }
}
