what-the-bank/sources/o/C8997dbR.java

98 lines
3.6 KiB
Java

package o;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import com.google.firebase.crashlytics.internal.common.AbstractSpiCall;
import java.io.IOException;
import java.util.List;
/* renamed from: o.dbR, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C8997dbR implements iYP<Uri, Drawable> {
private static wrW<Resources.Theme> a = wrW.c("com.bumptech.glide.load.resource.bitmap.Downsampler.Theme");
private final Context b;
@Override // o.iYP
public final /* synthetic */ Ezi<Drawable> a(Uri uri, int i, int i2, unA una) throws IOException {
return Fp_(uri, una);
}
@Override // o.iYP
public final /* synthetic */ boolean a(Uri uri, unA una) throws IOException {
return uri.getScheme().equals("android.resource");
}
public C8997dbR(Context context) {
this.b = context.getApplicationContext();
}
public final Ezi<Drawable> Fp_(Uri uri, unA una) {
Drawable Fl_;
String authority = uri.getAuthority();
Context Fm_ = Fm_(uri, authority);
int Fo_ = Fo_(Fm_, uri);
wrW<Resources.Theme> wrw = a;
Resources.Theme theme = (Resources.Theme) (una.d.containsKey(wrw) ? una.d.get(wrw) : wrw.a);
if (!(Fm_.getPackageName().equals(authority) || theme == null)) {
throw new IllegalArgumentException("Can't get a theme from another package");
}
if (theme != null) {
Context context = this.b;
Fl_ = tqX.Fl_(context, context, Fo_, theme);
} else {
Fl_ = tqX.Fl_(this.b, Fm_, Fo_, null);
}
if (Fl_ != null) {
return new ePX(Fl_);
}
return null;
}
private Context Fm_(Uri uri, String str) {
if (str.equals(this.b.getPackageName())) {
return this.b;
}
try {
return this.b.createPackageContext(str, 0);
} catch (PackageManager.NameNotFoundException e) {
if (str.contains(this.b.getPackageName())) {
return this.b;
}
throw new IllegalArgumentException("Failed to obtain context or unrecognized Uri format for: ".concat(String.valueOf(uri)), e);
}
}
private static int Fo_(Context context, Uri uri) {
List<String> pathSegments = uri.getPathSegments();
if (pathSegments.size() != 2) {
if (pathSegments.size() == 1) {
return Fn_(uri);
}
throw new IllegalArgumentException("Unrecognized Uri format: ".concat(String.valueOf(uri)));
}
List<String> pathSegments2 = uri.getPathSegments();
String authority = uri.getAuthority();
String str = pathSegments2.get(0);
String str2 = pathSegments2.get(1);
int identifier = context.getResources().getIdentifier(str2, str, authority);
if (identifier == 0) {
identifier = Resources.getSystem().getIdentifier(str2, str, AbstractSpiCall.ANDROID_CLIENT_TYPE);
}
if (identifier != 0) {
return identifier;
}
throw new IllegalArgumentException("Failed to find resource id for: ".concat(String.valueOf(uri)));
}
private static int Fn_(Uri uri) {
try {
return Integer.parseInt(uri.getPathSegments().get(0));
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Unrecognized Uri format: ".concat(String.valueOf(uri)), e);
}
}
}