package ph;

import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import com.bumptech.glide.load.data.d;
import java.io.IOException;
import java.io.InputStream;
import ph.n;

/* loaded from: classes4.dex */
public final class f implements n {

    /* renamed from: a, reason: collision with root package name */
    private final Context f32663a;

    /* renamed from: b, reason: collision with root package name */
    private final e f32664b;

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class a implements o, e {

        /* renamed from: a, reason: collision with root package name */
        private final Context f32665a;

        a(Context context) {
            this.f32665a = context;
        }

        @Override // ph.f.e
        public Class a() {
            return AssetFileDescriptor.class;
        }

        @Override // ph.o
        public void d() {
        }

        @Override // ph.o
        public n e(r rVar) {
            return new f(this.f32665a, this);
        }

        @Override // ph.f.e
        /* renamed from: f, reason: merged with bridge method [inline-methods] */
        public void b(AssetFileDescriptor assetFileDescriptor) {
            assetFileDescriptor.close();
        }

        @Override // ph.f.e
        /* renamed from: g, reason: merged with bridge method [inline-methods] */
        public AssetFileDescriptor c(Resources.Theme theme, Resources resources, int i10) {
            return resources.openRawResourceFd(i10);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class b implements o, e {

        /* renamed from: a, reason: collision with root package name */
        private final Context f32666a;

        b(Context context) {
            this.f32666a = context;
        }

        @Override // ph.f.e
        public Class a() {
            return Drawable.class;
        }

        @Override // ph.o
        public void d() {
        }

        @Override // ph.o
        public n e(r rVar) {
            return new f(this.f32666a, this);
        }

        @Override // ph.f.e
        /* renamed from: f, reason: merged with bridge method [inline-methods] */
        public void b(Drawable drawable) {
        }

        @Override // ph.f.e
        /* renamed from: g, reason: merged with bridge method [inline-methods] */
        public Drawable c(Resources.Theme theme, Resources resources, int i10) {
            return uh.b.a(this.f32666a, i10, theme);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class c implements o, e {

        /* renamed from: a, reason: collision with root package name */
        private final Context f32667a;

        c(Context context) {
            this.f32667a = context;
        }

        @Override // ph.f.e
        public Class a() {
            return InputStream.class;
        }

        @Override // ph.o
        public void d() {
        }

        @Override // ph.o
        public n e(r rVar) {
            return new f(this.f32667a, this);
        }

        @Override // ph.f.e
        /* renamed from: f, reason: merged with bridge method [inline-methods] */
        public void b(InputStream inputStream) {
            inputStream.close();
        }

        @Override // ph.f.e
        /* renamed from: g, reason: merged with bridge method [inline-methods] */
        public InputStream c(Resources.Theme theme, Resources resources, int i10) {
            return resources.openRawResource(i10);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class d implements com.bumptech.glide.load.data.d {

        /* renamed from: p, reason: collision with root package name */
        private final Resources.Theme f32668p;

        /* renamed from: q, reason: collision with root package name */
        private final Resources f32669q;

        /* renamed from: r, reason: collision with root package name */
        private final e f32670r;

        /* renamed from: s, reason: collision with root package name */
        private final int f32671s;

        /* renamed from: t, reason: collision with root package name */
        private Object f32672t;

        d(Resources.Theme theme, Resources resources, e eVar, int i10) {
            this.f32668p = theme;
            this.f32669q = resources;
            this.f32670r = eVar;
            this.f32671s = i10;
        }

        @Override // com.bumptech.glide.load.data.d
        public Class a() {
            return this.f32670r.a();
        }

        @Override // com.bumptech.glide.load.data.d
        public void b() {
            Object obj = this.f32672t;
            if (obj != null) {
                try {
                    this.f32670r.b(obj);
                } catch (IOException unused) {
                }
            }
        }

        @Override // com.bumptech.glide.load.data.d
        public void cancel() {
        }

        @Override // com.bumptech.glide.load.data.d
        public jh.a d() {
            return jh.a.LOCAL;
        }

        @Override // com.bumptech.glide.load.data.d
        public void e(com.bumptech.glide.g gVar, d.a aVar) {
            try {
                Object c10 = this.f32670r.c(this.f32668p, this.f32669q, this.f32671s);
                this.f32672t = c10;
                aVar.f(c10);
            } catch (Resources.NotFoundException e10) {
                aVar.c(e10);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public interface e {
        Class a();

        void b(Object obj);

        Object c(Resources.Theme theme, Resources resources, int i10);
    }

    f(Context context, e eVar) {
        this.f32663a = context.getApplicationContext();
        this.f32664b = eVar;
    }

    public static o c(Context context) {
        return new a(context);
    }

    public static o e(Context context) {
        return new b(context);
    }

    public static o g(Context context) {
        return new c(context);
    }

    @Override // ph.n
    /* renamed from: d, reason: merged with bridge method [inline-methods] */
    public n.a b(Integer num, int i10, int i11, jh.h hVar) {
        Resources.Theme theme = (Resources.Theme) hVar.c(uh.e.f37219b);
        return new n.a(new di.b(num), new d(theme, theme != null ? theme.getResources() : this.f32663a.getResources(), this.f32664b, num.intValue()));
    }

    @Override // ph.n
    /* renamed from: f, reason: merged with bridge method [inline-methods] */
    public boolean a(Integer num) {
        return true;
    }
}
