package p138.p145.p146.p151.p160.p165;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import java.util.ArrayList;
import java.util.List;
import p000.p001.p002.p003.p004.C0567;
import p138.p145.p146.C2814;
import p138.p145.p146.ComponentCallbacks2C2806;
import p138.p145.p146.ComponentCallbacks2C2816;
import p138.p145.p146.p148.InterfaceC2830;
import p138.p145.p146.p151.InterfaceC2852;
import p138.p145.p146.p151.p154.AbstractC2905;
import p138.p145.p146.p151.p154.p155.InterfaceC2942;
import p138.p145.p146.p170.AbstractC3199;
import p138.p145.p146.p170.C3203;
import p138.p145.p146.p170.p171.AbstractC3209;
import p138.p145.p146.p170.p172.InterfaceC3223;
import p138.p145.p146.p173.C3226;
import p138.p145.p146.p174.C3233;
import p138.p145.p146.p174.C3240;

/* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ތ.ބ.ބ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C3147 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final InterfaceC2830 f9390;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final Handler f9391;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final List<InterfaceC3149> f9392;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final ComponentCallbacks2C2816 f9393;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final InterfaceC2942 f9394;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public boolean f9395;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public boolean f9396;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public boolean f9397;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public C2814<Bitmap> f9398;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public C3148 f9399;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public boolean f9400;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public C3148 f9401;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public Bitmap f9402;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public C3148 f9403;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public int f9404;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public int f9405;

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public int f9406;

    /* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ތ.ބ.ބ$֏, reason: contains not printable characters */
    public static class C3148 extends AbstractC3209<Bitmap> {

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public final Handler f9407;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public final int f9408;

        /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
        public final long f9409;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public Bitmap f9410;

        public C3148(Handler handler, int i, long j) {
            this.f9407 = handler;
            this.f9408 = i;
            this.f9409 = j;
        }

        @Override // p138.p145.p146.p170.p171.InterfaceC3217
        /* JADX INFO: renamed from: ֏ */
        public void mo4924(Object obj, InterfaceC3223 interfaceC3223) {
            this.f9410 = (Bitmap) obj;
            this.f9407.sendMessageAtTime(this.f9407.obtainMessage(1, this), this.f9409);
        }

        @Override // p138.p145.p146.p170.p171.InterfaceC3217
        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public void mo5221(Drawable drawable) {
            this.f9410 = null;
        }
    }

    /* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ތ.ބ.ބ$ؠ, reason: contains not printable characters */
    public interface InterfaceC3149 {
        /* JADX INFO: renamed from: ֏ */
        void mo5213();
    }

    /* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ތ.ބ.ބ$ހ, reason: contains not printable characters */
    public class C3150 implements Handler.Callback {
        public C3150() {
        }

        @Override // android.os.Handler.Callback
        public boolean handleMessage(Message message) {
            int i = message.what;
            if (i == 1) {
                C3147.this.m5220((C3148) message.obj);
                return true;
            }
            if (i != 2) {
                return false;
            }
            C3147.this.f9393.m4915((C3148) message.obj);
            return false;
        }
    }

    public C3147(ComponentCallbacks2C2806 componentCallbacks2C2806, InterfaceC2830 interfaceC2830, int i, int i2, InterfaceC2852<Bitmap> interfaceC2852, Bitmap bitmap) {
        InterfaceC2942 interfaceC2942 = componentCallbacks2C2806.f8634;
        Context baseContext = componentCallbacks2C2806.f8636.getBaseContext();
        C0567.m1858(baseContext, "You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null (which usually occurs when getActivity() is called before the Fragment is attached or after the Fragment is destroyed).");
        ComponentCallbacks2C2816 componentCallbacks2C2816M5237 = ComponentCallbacks2C2806.m4903(baseContext).f8639.m5237(baseContext);
        Context baseContext2 = componentCallbacks2C2806.f8636.getBaseContext();
        C0567.m1858(baseContext2, "You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null (which usually occurs when getActivity() is called before the Fragment is attached or after the Fragment is destroyed).");
        C2814<Bitmap> c2814Mo2527 = ComponentCallbacks2C2806.m4903(baseContext2).f8639.m5237(baseContext2).mo2549().mo2527((AbstractC3199<?>) new C3203().mo2534(AbstractC2905.f8959).mo2539(true).mo2536(true).mo2528(i, i2));
        this.f9392 = new ArrayList();
        this.f9393 = componentCallbacks2C2816M5237;
        Handler handler = new Handler(Looper.getMainLooper(), new C3150());
        this.f9394 = interfaceC2942;
        this.f9391 = handler;
        this.f9398 = c2814Mo2527;
        this.f9390 = interfaceC2830;
        m5219(interfaceC2852, bitmap);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m5218() {
        if (!this.f9395 || this.f9396) {
            return;
        }
        if (this.f9397) {
            C0567.m1898(this.f9403 == null, "Pending target must be null when starting from the first frame");
            this.f9390.mo4958();
            this.f9397 = false;
        }
        C3148 c3148 = this.f9403;
        if (c3148 != null) {
            this.f9403 = null;
            m5220(c3148);
            return;
        }
        this.f9396 = true;
        long jUptimeMillis = SystemClock.uptimeMillis() + ((long) this.f9390.mo4955());
        this.f9390.mo4953();
        this.f9401 = new C3148(this.f9391, this.f9390.mo4950(), jUptimeMillis);
        C2814<Bitmap> c2814Mo2545 = this.f9398.mo2527((AbstractC3199<?>) new C3203().mo2532(new C3226(Double.valueOf(Math.random())))).mo2545(this.f9390);
        C3148 c31482 = this.f9401;
        if (c2814Mo2545 == null) {
            throw null;
        }
        c2814Mo2545.m4913(c31482, null, c2814Mo2545, C3233.f9578);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m5219(InterfaceC2852<Bitmap> interfaceC2852, Bitmap bitmap) {
        C0567.m1858(interfaceC2852, "Argument must not be null");
        C0567.m1858(bitmap, "Argument must not be null");
        this.f9402 = bitmap;
        this.f9398 = this.f9398.mo2527((AbstractC3199<?>) new C3203().m5266(interfaceC2852, true));
        this.f9404 = C3240.m5330(bitmap);
        this.f9405 = bitmap.getWidth();
        this.f9406 = bitmap.getHeight();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m5220(C3148 c3148) {
        this.f9396 = false;
        if (this.f9400) {
            this.f9391.obtainMessage(2, c3148).sendToTarget();
            return;
        }
        if (!this.f9395) {
            this.f9403 = c3148;
            return;
        }
        if (c3148.f9410 != null) {
            Bitmap bitmap = this.f9402;
            if (bitmap != null) {
                this.f9394.mo5088(bitmap);
                this.f9402 = null;
            }
            C3148 c31482 = this.f9399;
            this.f9399 = c3148;
            int size = this.f9392.size();
            while (true) {
                size--;
                if (size < 0) {
                    break;
                } else {
                    this.f9392.get(size).mo5213();
                }
            }
            if (c31482 != null) {
                this.f9391.obtainMessage(2, c31482).sendToTarget();
            }
        }
        m5218();
    }
}
