NetMirror.apk
Download file
package androidx.core.graphics;
import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.fonts.FontVariationAxis;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import androidx.core.content.res.d;
import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.Map;
import p.g;
/* JADX INFO: loaded from: classes.dex */
public class g extends e {
/* JADX INFO: renamed from: g, reason: collision with root package name */
protected final Class f4500g;
/* JADX INFO: renamed from: h, reason: collision with root package name */
protected final Constructor f4501h;
/* JADX INFO: renamed from: i, reason: collision with root package name */
protected final Method f4502i;
/* JADX INFO: renamed from: j, reason: collision with root package name */
protected final Method f4503j;
/* JADX INFO: renamed from: k, reason: collision with root package name */
protected final Method f4504k;
/* JADX INFO: renamed from: l, reason: collision with root package name */
protected final Method f4505l;
/* JADX INFO: renamed from: m, reason: collision with root package name */
protected final Method f4506m;
public g() {
Class clsV;
Constructor constructorW;
Method methodS;
Method methodT;
Method methodX;
Method methodR;
Method methodU;
try {
clsV = v();
constructorW = w(clsV);
methodS = s(clsV);
methodT = t(clsV);
methodX = x(clsV);
methodR = r(clsV);
methodU = u(clsV);
} catch (ClassNotFoundException | NoSuchMethodException e4) {
Log.e("TypefaceCompatApi26Impl", "Unable to collect necessary methods for class " + e4.getClass().getName(), e4);
clsV = null;
constructorW = null;
methodS = null;
methodT = null;
methodX = null;
methodR = null;
methodU = null;
}
this.f4500g = clsV;
this.f4501h = constructorW;
this.f4502i = methodS;
this.f4503j = methodT;
this.f4504k = methodX;
this.f4505l = methodR;
this.f4506m = methodU;
}
private Object l() {
try {
return this.f4501h.newInstance(new Object[0]);
} catch (IllegalAccessException | InstantiationException | InvocationTargetException unused) {
return null;
}
}
private void m(Object obj) {
try {
this.f4505l.invoke(obj, new Object[0]);
} catch (IllegalAccessException | InvocationTargetException unused) {
}
}
private boolean n(Context context, Object obj, String str, int i3, int i4, int i5, FontVariationAxis[] fontVariationAxisArr) {
try {
return ((Boolean) this.f4502i.invoke(obj, context.getAssets(), str, 0, Boolean.FALSE, Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5), fontVariationAxisArr)).booleanValue();
} catch (IllegalAccessException | InvocationTargetException unused) {
return false;
}
}
private boolean o(Object obj, ByteBuffer byteBuffer, int i3, int i4, int i5) {
try {
return ((Boolean) this.f4503j.invoke(obj, byteBuffer, Integer.valueOf(i3), null, Integer.valueOf(i4), Integer.valueOf(i5))).booleanValue();
} catch (IllegalAccessException | InvocationTargetException unused) {
return false;
}
}
private boolean p(Object obj) {
try {
return ((Boolean) this.f4504k.invoke(obj, new Object[0])).booleanValue();
} catch (IllegalAccessException | InvocationTargetException unused) {
return false;
}
}
private boolean q() {
if (this.f4502i == null) {
Log.w("TypefaceCompatApi26Impl", "Unable to collect necessary private methods. Fallback to legacy implementation.");
}
return this.f4502i != null;
}
@Override // androidx.core.graphics.e, androidx.core.graphics.j
public Typeface a(Context context, d.c cVar, Resources resources, int i3) {
if (!q()) {
return super.a(context, cVar, resources, i3);
}
Object objL = l();
if (objL == null) {
return null;
}
for (d.C0060d c0060d : cVar.a()) {
if (!n(context, objL, c0060d.a(), c0060d.c(), c0060d.e(), c0060d.f() ? 1 : 0, FontVariationAxis.fromFontVariationSettings(c0060d.d()))) {
m(objL);
return null;
}
}
if (p(objL)) {
return i(objL);
}
return null;
}
@Override // androidx.core.graphics.e, androidx.core.graphics.j
public Typeface b(Context context, CancellationSignal cancellationSignal, g.b[] bVarArr, int i3) {
Typeface typefaceI;
if (bVarArr.length < 1) {
return null;
}
if (!q()) {
g.b bVarG = g(bVarArr, i3);
try {
ParcelFileDescriptor parcelFileDescriptorOpenFileDescriptor = context.getContentResolver().openFileDescriptor(bVarG.d(), "r", cancellationSignal);
if (parcelFileDescriptorOpenFileDescriptor == null) {
if (parcelFileDescriptorOpenFileDescriptor != null) {
parcelFileDescriptorOpenFileDescriptor.close();
}
return null;
}
try {
Typeface typefaceBuild = new Typeface.Builder(parcelFileDescriptorOpenFileDescriptor.getFileDescriptor()).setWeight(bVarG.e()).setItalic(bVarG.f()).build();
parcelFileDescriptorOpenFileDescriptor.close();
return typefaceBuild;
} finally {
}
} catch (IOException unused) {
return null;
}
}
Map mapH = k.h(context, bVarArr, cancellationSignal);
Object objL = l();
if (objL == null) {
return null;
}
boolean z3 = false;
for (g.b bVar : bVarArr) {
ByteBuffer byteBuffer = (ByteBuffer) mapH.get(bVar.d());
if (byteBuffer != null) {
if (!o(objL, byteBuffer, bVar.c(), bVar.e(), bVar.f() ? 1 : 0)) {
m(objL);
return null;
}
z3 = true;
}
}
if (!z3) {
m(objL);
return null;
}
if (p(objL) && (typefaceI = i(objL)) != null) {
return Typeface.create(typefaceI, i3);
}
return null;
}
@Override // androidx.core.graphics.j
public Typeface d(Context context, Resources resources, int i3, String str, int i4) {
if (!q()) {
return super.d(context, resources, i3, str, i4);
}
Object objL = l();
if (objL == null) {
return null;
}
if (!n(context, objL, str, 0, -1, -1, null)) {
m(objL);
return null;
}
if (p(objL)) {
return i(objL);
}
return null;
}
protected Typeface i(Object obj) {
try {
Object objNewInstance = Array.newInstance((Class<?>) this.f4500g, 1);
Array.set(objNewInstance, 0, obj);
return (Typeface) this.f4506m.invoke(null, objNewInstance, -1, -1);
} catch (IllegalAccessException | InvocationTargetException unused) {
return null;
}
}
protected Method r(Class cls) {
return cls.getMethod("abortCreation", new Class[0]);
}
protected Method s(Class cls) {
Class cls2 = Integer.TYPE;
return cls.getMethod("addFontFromAssetManager", AssetManager.class, String.class, cls2, Boolean.TYPE, cls2, cls2, cls2, FontVariationAxis[].class);
}
protected Method t(Class cls) {
Class cls2 = Integer.TYPE;
return cls.getMethod("addFontFromBuffer", ByteBuffer.class, cls2, FontVariationAxis[].class, cls2, cls2);
}
protected Method u(Class cls) throws NoSuchMethodException {
Class<?> cls2 = Array.newInstance((Class<?>) cls, 1).getClass();
Class cls3 = Integer.TYPE;
Method declaredMethod = Typeface.class.getDeclaredMethod("createFromFamiliesWithDefault", cls2, cls3, cls3);
declaredMethod.setAccessible(true);
return declaredMethod;
}
protected Class v() {
return Class.forName("android.graphics.FontFamily");
}
protected Constructor w(Class cls) {
return cls.getConstructor(new Class[0]);
}
protected Method x(Class cls) {
return cls.getMethod("freeze", new Class[0]);
}
}
⚠️ This content was hidden by an advertisement filtering extension in your browser. Please disable it and reload the page to access the decompiled content.
We only display one small text ad to keep this service free. Here's what it looks like:
Read the Docs for Business: You write the docs. We do the rest.
Try it today!Ad by EthicalAds
Download file