Initial commit
This commit is contained in:
118
sources/androidx/core/content/ContextCompat.java
Normal file
118
sources/androidx/core/content/ContextCompat.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package androidx.core.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ContextCompat {
|
||||
private static final Object a = new Object();
|
||||
private static TypedValue b;
|
||||
|
||||
public static boolean a(Context context, Intent[] intentArr, Bundle bundle) {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
context.startActivities(intentArr, bundle);
|
||||
return true;
|
||||
}
|
||||
context.startActivities(intentArr);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static File[] b(Context context, String str) {
|
||||
return Build.VERSION.SDK_INT >= 19 ? context.getExternalFilesDirs(str) : new File[]{context.getExternalFilesDir(str)};
|
||||
}
|
||||
|
||||
public static Drawable c(Context context, int i) {
|
||||
int i2;
|
||||
int i3 = Build.VERSION.SDK_INT;
|
||||
if (i3 >= 21) {
|
||||
return context.getDrawable(i);
|
||||
}
|
||||
if (i3 >= 16) {
|
||||
return context.getResources().getDrawable(i);
|
||||
}
|
||||
synchronized (a) {
|
||||
if (b == null) {
|
||||
b = new TypedValue();
|
||||
}
|
||||
context.getResources().getValue(i, b, true);
|
||||
i2 = b.resourceId;
|
||||
}
|
||||
return context.getResources().getDrawable(i2);
|
||||
}
|
||||
|
||||
public static void a(Context context, Intent intent, Bundle bundle) {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
context.startActivity(intent, bundle);
|
||||
} else {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static ColorStateList b(Context context, int i) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return context.getColorStateList(i);
|
||||
}
|
||||
return context.getResources().getColorStateList(i);
|
||||
}
|
||||
|
||||
public static File[] a(Context context) {
|
||||
return Build.VERSION.SDK_INT >= 19 ? context.getExternalCacheDirs() : new File[]{context.getExternalCacheDir()};
|
||||
}
|
||||
|
||||
public static File b(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
return context.getNoBackupFilesDir();
|
||||
}
|
||||
return a(new File(context.getApplicationInfo().dataDir, "no_backup"));
|
||||
}
|
||||
|
||||
public static int a(Context context, int i) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return context.getColor(i);
|
||||
}
|
||||
return context.getResources().getColor(i);
|
||||
}
|
||||
|
||||
public static boolean c(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
return context.isDeviceProtectedStorage();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int a(Context context, String str) {
|
||||
if (str != null) {
|
||||
return context.checkPermission(str, Process.myPid(), Process.myUid());
|
||||
}
|
||||
throw new IllegalArgumentException("permission is null");
|
||||
}
|
||||
|
||||
private static synchronized File a(File file) {
|
||||
synchronized (ContextCompat.class) {
|
||||
if (file.exists() || file.mkdirs()) {
|
||||
return file;
|
||||
}
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
Log.w("ContextCompat", "Unable to create files subdir " + file.getPath());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Context context, Intent intent) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
context.startForegroundService(intent);
|
||||
} else {
|
||||
context.startService(intent);
|
||||
}
|
||||
}
|
||||
}
|
301
sources/androidx/core/content/FileProvider.java
Normal file
301
sources/androidx/core/content/FileProvider.java
Normal file
@@ -0,0 +1,301 @@
|
||||
package androidx.core.content;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ProviderInfo;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.text.TextUtils;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FileProvider extends ContentProvider {
|
||||
private static final String ATTR_NAME = "name";
|
||||
private static final String ATTR_PATH = "path";
|
||||
private static final String META_DATA_FILE_PROVIDER_PATHS = "android.support.FILE_PROVIDER_PATHS";
|
||||
private static final String TAG_CACHE_PATH = "cache-path";
|
||||
private static final String TAG_EXTERNAL = "external-path";
|
||||
private static final String TAG_EXTERNAL_CACHE = "external-cache-path";
|
||||
private static final String TAG_EXTERNAL_FILES = "external-files-path";
|
||||
private static final String TAG_EXTERNAL_MEDIA = "external-media-path";
|
||||
private static final String TAG_FILES_PATH = "files-path";
|
||||
private static final String TAG_ROOT_PATH = "root-path";
|
||||
private PathStrategy mStrategy;
|
||||
private static final String[] COLUMNS = {"_display_name", "_size"};
|
||||
private static final File DEVICE_ROOT = new File("/");
|
||||
private static HashMap<String, PathStrategy> sCache = new HashMap<>();
|
||||
|
||||
interface PathStrategy {
|
||||
Uri a(File file);
|
||||
|
||||
File a(Uri uri);
|
||||
}
|
||||
|
||||
private static File buildPath(File file, String... strArr) {
|
||||
for (String str : strArr) {
|
||||
if (str != null) {
|
||||
file = new File(file, str);
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
private static String[] copyOf(String[] strArr, int i) {
|
||||
String[] strArr2 = new String[i];
|
||||
System.arraycopy(strArr, 0, strArr2, 0, i);
|
||||
return strArr2;
|
||||
}
|
||||
|
||||
private static PathStrategy getPathStrategy(Context context, String str) {
|
||||
PathStrategy pathStrategy;
|
||||
synchronized (sCache) {
|
||||
pathStrategy = sCache.get(str);
|
||||
if (pathStrategy == null) {
|
||||
try {
|
||||
pathStrategy = parsePathStrategy(context, str);
|
||||
sCache.put(str, pathStrategy);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Failed to parse android.support.FILE_PROVIDER_PATHS meta-data", e);
|
||||
} catch (XmlPullParserException e2) {
|
||||
throw new IllegalArgumentException("Failed to parse android.support.FILE_PROVIDER_PATHS meta-data", e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pathStrategy;
|
||||
}
|
||||
|
||||
public static Uri getUriForFile(Context context, String str, File file) {
|
||||
return getPathStrategy(context, str).a(file);
|
||||
}
|
||||
|
||||
private static int modeToMode(String str) {
|
||||
if ("r".equals(str)) {
|
||||
return 268435456;
|
||||
}
|
||||
if ("w".equals(str) || "wt".equals(str)) {
|
||||
return 738197504;
|
||||
}
|
||||
if ("wa".equals(str)) {
|
||||
return 704643072;
|
||||
}
|
||||
if ("rw".equals(str)) {
|
||||
return 939524096;
|
||||
}
|
||||
if ("rwt".equals(str)) {
|
||||
return 1006632960;
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid mode: " + str);
|
||||
}
|
||||
|
||||
private static PathStrategy parsePathStrategy(Context context, String str) throws IOException, XmlPullParserException {
|
||||
SimplePathStrategy simplePathStrategy = new SimplePathStrategy(str);
|
||||
XmlResourceParser loadXmlMetaData = context.getPackageManager().resolveContentProvider(str, PeripheralType.SERVO).loadXmlMetaData(context.getPackageManager(), META_DATA_FILE_PROVIDER_PATHS);
|
||||
if (loadXmlMetaData == null) {
|
||||
throw new IllegalArgumentException("Missing android.support.FILE_PROVIDER_PATHS meta-data");
|
||||
}
|
||||
while (true) {
|
||||
int next = loadXmlMetaData.next();
|
||||
if (next == 1) {
|
||||
return simplePathStrategy;
|
||||
}
|
||||
if (next == 2) {
|
||||
String name = loadXmlMetaData.getName();
|
||||
File file = null;
|
||||
String attributeValue = loadXmlMetaData.getAttributeValue(null, "name");
|
||||
String attributeValue2 = loadXmlMetaData.getAttributeValue(null, "path");
|
||||
if (TAG_ROOT_PATH.equals(name)) {
|
||||
file = DEVICE_ROOT;
|
||||
} else if (TAG_FILES_PATH.equals(name)) {
|
||||
file = context.getFilesDir();
|
||||
} else if (TAG_CACHE_PATH.equals(name)) {
|
||||
file = context.getCacheDir();
|
||||
} else if (TAG_EXTERNAL.equals(name)) {
|
||||
file = Environment.getExternalStorageDirectory();
|
||||
} else if (TAG_EXTERNAL_FILES.equals(name)) {
|
||||
File[] b = ContextCompat.b(context, (String) null);
|
||||
if (b.length > 0) {
|
||||
file = b[0];
|
||||
}
|
||||
} else if (TAG_EXTERNAL_CACHE.equals(name)) {
|
||||
File[] a = ContextCompat.a(context);
|
||||
if (a.length > 0) {
|
||||
file = a[0];
|
||||
}
|
||||
} else if (Build.VERSION.SDK_INT >= 21 && TAG_EXTERNAL_MEDIA.equals(name)) {
|
||||
File[] externalMediaDirs = context.getExternalMediaDirs();
|
||||
if (externalMediaDirs.length > 0) {
|
||||
file = externalMediaDirs[0];
|
||||
}
|
||||
}
|
||||
if (file != null) {
|
||||
simplePathStrategy.a(attributeValue, buildPath(file, attributeValue2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public void attachInfo(Context context, ProviderInfo providerInfo) {
|
||||
super.attachInfo(context, providerInfo);
|
||||
if (providerInfo.exported) {
|
||||
throw new SecurityException("Provider must not be exported");
|
||||
}
|
||||
if (!providerInfo.grantUriPermissions) {
|
||||
throw new SecurityException("Provider must grant uri permissions");
|
||||
}
|
||||
this.mStrategy = getPathStrategy(context, providerInfo.authority);
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public int delete(Uri uri, String str, String[] strArr) {
|
||||
return this.mStrategy.a(uri).delete() ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public String getType(Uri uri) {
|
||||
File a = this.mStrategy.a(uri);
|
||||
int lastIndexOf = a.getName().lastIndexOf(46);
|
||||
if (lastIndexOf < 0) {
|
||||
return "application/octet-stream";
|
||||
}
|
||||
String mimeTypeFromExtension = MimeTypeMap.getSingleton().getMimeTypeFromExtension(a.getName().substring(lastIndexOf + 1));
|
||||
return mimeTypeFromExtension != null ? mimeTypeFromExtension : "application/octet-stream";
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public Uri insert(Uri uri, ContentValues contentValues) {
|
||||
throw new UnsupportedOperationException("No external inserts");
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public boolean onCreate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public ParcelFileDescriptor openFile(Uri uri, String str) throws FileNotFoundException {
|
||||
return ParcelFileDescriptor.open(this.mStrategy.a(uri), modeToMode(str));
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
|
||||
int i;
|
||||
File a = this.mStrategy.a(uri);
|
||||
if (strArr == null) {
|
||||
strArr = COLUMNS;
|
||||
}
|
||||
String[] strArr3 = new String[strArr.length];
|
||||
Object[] objArr = new Object[strArr.length];
|
||||
int i2 = 0;
|
||||
for (String str3 : strArr) {
|
||||
if ("_display_name".equals(str3)) {
|
||||
strArr3[i2] = "_display_name";
|
||||
i = i2 + 1;
|
||||
objArr[i2] = a.getName();
|
||||
} else if ("_size".equals(str3)) {
|
||||
strArr3[i2] = "_size";
|
||||
i = i2 + 1;
|
||||
objArr[i2] = Long.valueOf(a.length());
|
||||
}
|
||||
i2 = i;
|
||||
}
|
||||
String[] copyOf = copyOf(strArr3, i2);
|
||||
Object[] copyOf2 = copyOf(objArr, i2);
|
||||
MatrixCursor matrixCursor = new MatrixCursor(copyOf, 1);
|
||||
matrixCursor.addRow(copyOf2);
|
||||
return matrixCursor;
|
||||
}
|
||||
|
||||
@Override // android.content.ContentProvider
|
||||
public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
|
||||
throw new UnsupportedOperationException("No external updates");
|
||||
}
|
||||
|
||||
private static Object[] copyOf(Object[] objArr, int i) {
|
||||
Object[] objArr2 = new Object[i];
|
||||
System.arraycopy(objArr, 0, objArr2, 0, i);
|
||||
return objArr2;
|
||||
}
|
||||
|
||||
static class SimplePathStrategy implements PathStrategy {
|
||||
private final String a;
|
||||
private final HashMap<String, File> b = new HashMap<>();
|
||||
|
||||
SimplePathStrategy(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
void a(String str, File file) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
throw new IllegalArgumentException("Name must not be empty");
|
||||
}
|
||||
try {
|
||||
this.b.put(str, file.getCanonicalFile());
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException("Failed to resolve canonical path for " + file, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.content.FileProvider.PathStrategy
|
||||
public Uri a(File file) {
|
||||
String substring;
|
||||
try {
|
||||
String canonicalPath = file.getCanonicalPath();
|
||||
Map.Entry<String, File> entry = null;
|
||||
for (Map.Entry<String, File> entry2 : this.b.entrySet()) {
|
||||
String path = entry2.getValue().getPath();
|
||||
if (canonicalPath.startsWith(path) && (entry == null || path.length() > entry.getValue().getPath().length())) {
|
||||
entry = entry2;
|
||||
}
|
||||
}
|
||||
if (entry != null) {
|
||||
String path2 = entry.getValue().getPath();
|
||||
if (path2.endsWith("/")) {
|
||||
substring = canonicalPath.substring(path2.length());
|
||||
} else {
|
||||
substring = canonicalPath.substring(path2.length() + 1);
|
||||
}
|
||||
return new Uri.Builder().scheme("content").authority(this.a).encodedPath(Uri.encode(entry.getKey()) + '/' + Uri.encode(substring, "/")).build();
|
||||
}
|
||||
throw new IllegalArgumentException("Failed to find configured root that contains " + canonicalPath);
|
||||
} catch (IOException unused) {
|
||||
throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.content.FileProvider.PathStrategy
|
||||
public File a(Uri uri) {
|
||||
String encodedPath = uri.getEncodedPath();
|
||||
int indexOf = encodedPath.indexOf(47, 1);
|
||||
String decode = Uri.decode(encodedPath.substring(1, indexOf));
|
||||
String decode2 = Uri.decode(encodedPath.substring(indexOf + 1));
|
||||
File file = this.b.get(decode);
|
||||
if (file != null) {
|
||||
File file2 = new File(file, decode2);
|
||||
try {
|
||||
File canonicalFile = file2.getCanonicalFile();
|
||||
if (canonicalFile.getPath().startsWith(file.getPath())) {
|
||||
return canonicalFile;
|
||||
}
|
||||
throw new SecurityException("Resolved path jumped beyond configured root");
|
||||
} catch (IOException unused) {
|
||||
throw new IllegalArgumentException("Failed to resolve canonical path for " + file2);
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unable to find configured root for " + uri);
|
||||
}
|
||||
}
|
||||
}
|
30
sources/androidx/core/content/PermissionChecker.java
Normal file
30
sources/androidx/core/content/PermissionChecker.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package androidx.core.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Process;
|
||||
import androidx.core.app.AppOpsManagerCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class PermissionChecker {
|
||||
public static int a(Context context, String str, int i, int i2, String str2) {
|
||||
if (context.checkPermission(str, i, i2) == -1) {
|
||||
return -1;
|
||||
}
|
||||
String a = AppOpsManagerCompat.a(str);
|
||||
if (a == null) {
|
||||
return 0;
|
||||
}
|
||||
if (str2 == null) {
|
||||
String[] packagesForUid = context.getPackageManager().getPackagesForUid(i2);
|
||||
if (packagesForUid == null || packagesForUid.length <= 0) {
|
||||
return -1;
|
||||
}
|
||||
str2 = packagesForUid[0];
|
||||
}
|
||||
return AppOpsManagerCompat.a(context, a, str2) != 0 ? -2 : 0;
|
||||
}
|
||||
|
||||
public static int a(Context context, String str) {
|
||||
return a(context, str, Process.myPid(), Process.myUid(), context.getPackageName());
|
||||
}
|
||||
}
|
@@ -0,0 +1,105 @@
|
||||
package androidx.core.content.res;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.StateSet;
|
||||
import android.util.Xml;
|
||||
import androidx.core.R$attr;
|
||||
import androidx.core.R$styleable;
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ColorStateListInflaterCompat {
|
||||
public static ColorStateList a(Resources resources, XmlPullParser xmlPullParser, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int next;
|
||||
AttributeSet asAttributeSet = Xml.asAttributeSet(xmlPullParser);
|
||||
do {
|
||||
next = xmlPullParser.next();
|
||||
if (next == 2) {
|
||||
break;
|
||||
}
|
||||
} while (next != 1);
|
||||
if (next == 2) {
|
||||
return a(resources, xmlPullParser, asAttributeSet, theme);
|
||||
}
|
||||
throw new XmlPullParserException("No start tag found");
|
||||
}
|
||||
|
||||
private static ColorStateList b(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
int depth;
|
||||
int i = 1;
|
||||
int depth2 = xmlPullParser.getDepth() + 1;
|
||||
int[][] iArr = new int[20][];
|
||||
int[] iArr2 = new int[iArr.length];
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
int next = xmlPullParser.next();
|
||||
if (next == i || ((depth = xmlPullParser.getDepth()) < depth2 && next == 3)) {
|
||||
break;
|
||||
}
|
||||
if (next == 2 && depth <= depth2 && xmlPullParser.getName().equals("item")) {
|
||||
TypedArray a = a(resources, theme, attributeSet, R$styleable.ColorStateListItem);
|
||||
int color = a.getColor(R$styleable.ColorStateListItem_android_color, -65281);
|
||||
float f = 1.0f;
|
||||
if (a.hasValue(R$styleable.ColorStateListItem_android_alpha)) {
|
||||
f = a.getFloat(R$styleable.ColorStateListItem_android_alpha, 1.0f);
|
||||
} else if (a.hasValue(R$styleable.ColorStateListItem_alpha)) {
|
||||
f = a.getFloat(R$styleable.ColorStateListItem_alpha, 1.0f);
|
||||
}
|
||||
a.recycle();
|
||||
int attributeCount = attributeSet.getAttributeCount();
|
||||
int[] iArr3 = new int[attributeCount];
|
||||
int i3 = 0;
|
||||
for (int i4 = 0; i4 < attributeCount; i4++) {
|
||||
int attributeNameResource = attributeSet.getAttributeNameResource(i4);
|
||||
if (attributeNameResource != 16843173 && attributeNameResource != 16843551 && attributeNameResource != R$attr.alpha) {
|
||||
int i5 = i3 + 1;
|
||||
if (!attributeSet.getAttributeBooleanValue(i4, false)) {
|
||||
attributeNameResource = -attributeNameResource;
|
||||
}
|
||||
iArr3[i3] = attributeNameResource;
|
||||
i3 = i5;
|
||||
}
|
||||
}
|
||||
int[] trimStateSet = StateSet.trimStateSet(iArr3, i3);
|
||||
int a2 = a(color, f);
|
||||
if (i2 != 0) {
|
||||
int length = trimStateSet.length;
|
||||
}
|
||||
iArr2 = GrowingArrayUtils.a(iArr2, i2, a2);
|
||||
iArr = (int[][]) GrowingArrayUtils.a(iArr, i2, trimStateSet);
|
||||
i2++;
|
||||
}
|
||||
i = 1;
|
||||
}
|
||||
int[] iArr4 = new int[i2];
|
||||
int[][] iArr5 = new int[i2][];
|
||||
System.arraycopy(iArr2, 0, iArr4, 0, i2);
|
||||
System.arraycopy(iArr, 0, iArr5, 0, i2);
|
||||
return new ColorStateList(iArr5, iArr4);
|
||||
}
|
||||
|
||||
public static ColorStateList a(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
String name = xmlPullParser.getName();
|
||||
if (name.equals("selector")) {
|
||||
return b(resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid color state list tag " + name);
|
||||
}
|
||||
|
||||
private static TypedArray a(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) {
|
||||
if (theme == null) {
|
||||
return resources.obtainAttributes(attributeSet, iArr);
|
||||
}
|
||||
return theme.obtainStyledAttributes(attributeSet, iArr, 0, 0);
|
||||
}
|
||||
|
||||
private static int a(int i, float f) {
|
||||
return (i & 16777215) | (Math.round(Color.alpha(i) * f) << 24);
|
||||
}
|
||||
}
|
114
sources/androidx/core/content/res/ComplexColorCompat.java
Normal file
114
sources/androidx/core/content/res/ComplexColorCompat.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package androidx.core.content.res;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ComplexColorCompat {
|
||||
private final Shader a;
|
||||
private final ColorStateList b;
|
||||
private int c;
|
||||
|
||||
private ComplexColorCompat(Shader shader, ColorStateList colorStateList, int i) {
|
||||
this.a = shader;
|
||||
this.b = colorStateList;
|
||||
this.c = i;
|
||||
}
|
||||
|
||||
static ComplexColorCompat a(Shader shader) {
|
||||
return new ComplexColorCompat(shader, null, 0);
|
||||
}
|
||||
|
||||
static ComplexColorCompat b(int i) {
|
||||
return new ComplexColorCompat(null, null, i);
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return this.a != null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
ColorStateList colorStateList;
|
||||
return this.a == null && (colorStateList = this.b) != null && colorStateList.isStateful();
|
||||
}
|
||||
|
||||
public boolean e() {
|
||||
return c() || this.c != 0;
|
||||
}
|
||||
|
||||
static ComplexColorCompat a(ColorStateList colorStateList) {
|
||||
return new ComplexColorCompat(null, colorStateList, colorStateList.getDefaultColor());
|
||||
}
|
||||
|
||||
public Shader b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public static ComplexColorCompat b(Resources resources, int i, Resources.Theme theme) {
|
||||
try {
|
||||
return a(resources, i, theme);
|
||||
} catch (Exception e) {
|
||||
Log.e("ComplexColorCompat", "Failed to inflate ComplexColor.", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.c = i;
|
||||
}
|
||||
|
||||
public boolean a(int[] iArr) {
|
||||
if (d()) {
|
||||
ColorStateList colorStateList = this.b;
|
||||
int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor());
|
||||
if (colorForState != this.c) {
|
||||
this.c = colorForState;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static ComplexColorCompat a(Resources resources, int i, Resources.Theme theme) throws IOException, XmlPullParserException {
|
||||
int next;
|
||||
XmlResourceParser xml = resources.getXml(i);
|
||||
AttributeSet asAttributeSet = Xml.asAttributeSet(xml);
|
||||
do {
|
||||
next = xml.next();
|
||||
if (next == 2) {
|
||||
break;
|
||||
}
|
||||
} while (next != 1);
|
||||
if (next == 2) {
|
||||
String name = xml.getName();
|
||||
char c = 65535;
|
||||
int hashCode = name.hashCode();
|
||||
if (hashCode != 89650992) {
|
||||
if (hashCode == 1191572447 && name.equals("selector")) {
|
||||
c = 0;
|
||||
}
|
||||
} else if (name.equals("gradient")) {
|
||||
c = 1;
|
||||
}
|
||||
if (c == 0) {
|
||||
return a(ColorStateListInflaterCompat.a(resources, xml, asAttributeSet, theme));
|
||||
}
|
||||
if (c == 1) {
|
||||
return a(GradientColorInflaterCompat.a(resources, xml, asAttributeSet, theme));
|
||||
}
|
||||
throw new XmlPullParserException(xml.getPositionDescription() + ": unsupported complex color tag " + name);
|
||||
}
|
||||
throw new XmlPullParserException("No start tag found");
|
||||
}
|
||||
}
|
228
sources/androidx/core/content/res/FontResourcesParserCompat.java
Normal file
228
sources/androidx/core/content/res/FontResourcesParserCompat.java
Normal file
@@ -0,0 +1,228 @@
|
||||
package androidx.core.content.res;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.util.Base64;
|
||||
import android.util.TypedValue;
|
||||
import android.util.Xml;
|
||||
import androidx.core.R$styleable;
|
||||
import androidx.core.provider.FontRequest;
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FontResourcesParserCompat {
|
||||
|
||||
public interface FamilyResourceEntry {
|
||||
}
|
||||
|
||||
public static final class FontFamilyFilesResourceEntry implements FamilyResourceEntry {
|
||||
private final FontFileResourceEntry[] a;
|
||||
|
||||
public FontFamilyFilesResourceEntry(FontFileResourceEntry[] fontFileResourceEntryArr) {
|
||||
this.a = fontFileResourceEntryArr;
|
||||
}
|
||||
|
||||
public FontFileResourceEntry[] a() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class FontFileResourceEntry {
|
||||
private final String a;
|
||||
private int b;
|
||||
private boolean c;
|
||||
private String d;
|
||||
private int e;
|
||||
private int f;
|
||||
|
||||
public FontFileResourceEntry(String str, int i, boolean z, String str2, int i2, int i3) {
|
||||
this.a = str;
|
||||
this.b = i;
|
||||
this.c = z;
|
||||
this.d = str2;
|
||||
this.e = i2;
|
||||
this.f = i3;
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String d() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
return this.c;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class ProviderResourceEntry implements FamilyResourceEntry {
|
||||
private final FontRequest a;
|
||||
private final int b;
|
||||
private final int c;
|
||||
|
||||
public ProviderResourceEntry(FontRequest fontRequest, int i, int i2) {
|
||||
this.a = fontRequest;
|
||||
this.c = i;
|
||||
this.b = i2;
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public FontRequest b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
||||
public static FamilyResourceEntry a(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
|
||||
int next;
|
||||
do {
|
||||
next = xmlPullParser.next();
|
||||
if (next == 2) {
|
||||
break;
|
||||
}
|
||||
} while (next != 1);
|
||||
if (next == 2) {
|
||||
return b(xmlPullParser, resources);
|
||||
}
|
||||
throw new XmlPullParserException("No start tag found");
|
||||
}
|
||||
|
||||
private static FamilyResourceEntry b(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
|
||||
xmlPullParser.require(2, null, "font-family");
|
||||
if (xmlPullParser.getName().equals("font-family")) {
|
||||
return c(xmlPullParser, resources);
|
||||
}
|
||||
a(xmlPullParser);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static FamilyResourceEntry c(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
|
||||
TypedArray obtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), R$styleable.FontFamily);
|
||||
String string = obtainAttributes.getString(R$styleable.FontFamily_fontProviderAuthority);
|
||||
String string2 = obtainAttributes.getString(R$styleable.FontFamily_fontProviderPackage);
|
||||
String string3 = obtainAttributes.getString(R$styleable.FontFamily_fontProviderQuery);
|
||||
int resourceId = obtainAttributes.getResourceId(R$styleable.FontFamily_fontProviderCerts, 0);
|
||||
int integer = obtainAttributes.getInteger(R$styleable.FontFamily_fontProviderFetchStrategy, 1);
|
||||
int integer2 = obtainAttributes.getInteger(R$styleable.FontFamily_fontProviderFetchTimeout, SingleClickListener.FAST_CLICK_DELAY_TIME);
|
||||
obtainAttributes.recycle();
|
||||
if (string != null && string2 != null && string3 != null) {
|
||||
while (xmlPullParser.next() != 3) {
|
||||
a(xmlPullParser);
|
||||
}
|
||||
return new ProviderResourceEntry(new FontRequest(string, string2, string3, a(resources, resourceId)), integer, integer2);
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
while (xmlPullParser.next() != 3) {
|
||||
if (xmlPullParser.getEventType() == 2) {
|
||||
if (xmlPullParser.getName().equals("font")) {
|
||||
arrayList.add(d(xmlPullParser, resources));
|
||||
} else {
|
||||
a(xmlPullParser);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arrayList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return new FontFamilyFilesResourceEntry((FontFileResourceEntry[]) arrayList.toArray(new FontFileResourceEntry[arrayList.size()]));
|
||||
}
|
||||
|
||||
private static FontFileResourceEntry d(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
|
||||
TypedArray obtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), R$styleable.FontFamilyFont);
|
||||
int i = obtainAttributes.getInt(obtainAttributes.hasValue(R$styleable.FontFamilyFont_fontWeight) ? R$styleable.FontFamilyFont_fontWeight : R$styleable.FontFamilyFont_android_fontWeight, 400);
|
||||
boolean z = 1 == obtainAttributes.getInt(obtainAttributes.hasValue(R$styleable.FontFamilyFont_fontStyle) ? R$styleable.FontFamilyFont_fontStyle : R$styleable.FontFamilyFont_android_fontStyle, 0);
|
||||
int i2 = obtainAttributes.hasValue(R$styleable.FontFamilyFont_ttcIndex) ? R$styleable.FontFamilyFont_ttcIndex : R$styleable.FontFamilyFont_android_ttcIndex;
|
||||
String string = obtainAttributes.getString(obtainAttributes.hasValue(R$styleable.FontFamilyFont_fontVariationSettings) ? R$styleable.FontFamilyFont_fontVariationSettings : R$styleable.FontFamilyFont_android_fontVariationSettings);
|
||||
int i3 = obtainAttributes.getInt(i2, 0);
|
||||
int i4 = obtainAttributes.hasValue(R$styleable.FontFamilyFont_font) ? R$styleable.FontFamilyFont_font : R$styleable.FontFamilyFont_android_font;
|
||||
int resourceId = obtainAttributes.getResourceId(i4, 0);
|
||||
String string2 = obtainAttributes.getString(i4);
|
||||
obtainAttributes.recycle();
|
||||
while (xmlPullParser.next() != 3) {
|
||||
a(xmlPullParser);
|
||||
}
|
||||
return new FontFileResourceEntry(string2, i, z, string, i3, resourceId);
|
||||
}
|
||||
|
||||
private static int a(TypedArray typedArray, int i) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
return typedArray.getType(i);
|
||||
}
|
||||
TypedValue typedValue = new TypedValue();
|
||||
typedArray.getValue(i, typedValue);
|
||||
return typedValue.type;
|
||||
}
|
||||
|
||||
public static List<List<byte[]>> a(Resources resources, int i) {
|
||||
if (i == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
TypedArray obtainTypedArray = resources.obtainTypedArray(i);
|
||||
try {
|
||||
if (obtainTypedArray.length() == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (a(obtainTypedArray, 0) == 1) {
|
||||
for (int i2 = 0; i2 < obtainTypedArray.length(); i2++) {
|
||||
int resourceId = obtainTypedArray.getResourceId(i2, 0);
|
||||
if (resourceId != 0) {
|
||||
arrayList.add(a(resources.getStringArray(resourceId)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
arrayList.add(a(resources.getStringArray(i)));
|
||||
}
|
||||
return arrayList;
|
||||
} finally {
|
||||
obtainTypedArray.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
private static List<byte[]> a(String[] strArr) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (String str : strArr) {
|
||||
arrayList.add(Base64.decode(str, 0));
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private static void a(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
|
||||
int i = 1;
|
||||
while (i > 0) {
|
||||
int next = xmlPullParser.next();
|
||||
if (next == 2) {
|
||||
i++;
|
||||
} else if (next == 3) {
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,175 @@
|
||||
package androidx.core.content.res;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.RadialGradient;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.SweepGradient;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.core.R$styleable;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class GradientColorInflaterCompat {
|
||||
static Shader a(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws IOException, XmlPullParserException {
|
||||
String name = xmlPullParser.getName();
|
||||
if (!name.equals("gradient")) {
|
||||
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid gradient color tag " + name);
|
||||
}
|
||||
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, R$styleable.GradientColor);
|
||||
float a2 = TypedArrayUtils.a(a, xmlPullParser, "startX", R$styleable.GradientColor_android_startX, 0.0f);
|
||||
float a3 = TypedArrayUtils.a(a, xmlPullParser, "startY", R$styleable.GradientColor_android_startY, 0.0f);
|
||||
float a4 = TypedArrayUtils.a(a, xmlPullParser, "endX", R$styleable.GradientColor_android_endX, 0.0f);
|
||||
float a5 = TypedArrayUtils.a(a, xmlPullParser, "endY", R$styleable.GradientColor_android_endY, 0.0f);
|
||||
float a6 = TypedArrayUtils.a(a, xmlPullParser, "centerX", R$styleable.GradientColor_android_centerX, 0.0f);
|
||||
float a7 = TypedArrayUtils.a(a, xmlPullParser, "centerY", R$styleable.GradientColor_android_centerY, 0.0f);
|
||||
int b = TypedArrayUtils.b(a, xmlPullParser, "type", R$styleable.GradientColor_android_type, 0);
|
||||
int a8 = TypedArrayUtils.a(a, xmlPullParser, "startColor", R$styleable.GradientColor_android_startColor, 0);
|
||||
boolean a9 = TypedArrayUtils.a(xmlPullParser, "centerColor");
|
||||
int a10 = TypedArrayUtils.a(a, xmlPullParser, "centerColor", R$styleable.GradientColor_android_centerColor, 0);
|
||||
int a11 = TypedArrayUtils.a(a, xmlPullParser, "endColor", R$styleable.GradientColor_android_endColor, 0);
|
||||
int b2 = TypedArrayUtils.b(a, xmlPullParser, "tileMode", R$styleable.GradientColor_android_tileMode, 0);
|
||||
float a12 = TypedArrayUtils.a(a, xmlPullParser, "gradientRadius", R$styleable.GradientColor_android_gradientRadius, 0.0f);
|
||||
a.recycle();
|
||||
ColorStops a13 = a(b(resources, xmlPullParser, attributeSet, theme), a8, a11, a9, a10);
|
||||
if (b != 1) {
|
||||
return b != 2 ? new LinearGradient(a2, a3, a4, a5, a13.a, a13.b, a(b2)) : new SweepGradient(a6, a7, a13.a, a13.b);
|
||||
}
|
||||
if (a12 > 0.0f) {
|
||||
return new RadialGradient(a6, a7, a12, a13.a, a13.b, a(b2));
|
||||
}
|
||||
throw new XmlPullParserException("<gradient> tag requires 'gradientRadius' attribute with radial type");
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:31:0x0089, code lost:
|
||||
|
||||
throw new org.xmlpull.v1.XmlPullParserException(r9.getPositionDescription() + ": <item> tag requires a 'color' attribute and a 'offset' attribute!");
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private static androidx.core.content.res.GradientColorInflaterCompat.ColorStops b(android.content.res.Resources r8, org.xmlpull.v1.XmlPullParser r9, android.util.AttributeSet r10, android.content.res.Resources.Theme r11) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException {
|
||||
/*
|
||||
int r0 = r9.getDepth()
|
||||
r1 = 1
|
||||
int r0 = r0 + r1
|
||||
java.util.ArrayList r2 = new java.util.ArrayList
|
||||
r3 = 20
|
||||
r2.<init>(r3)
|
||||
java.util.ArrayList r4 = new java.util.ArrayList
|
||||
r4.<init>(r3)
|
||||
L12:
|
||||
int r3 = r9.next()
|
||||
if (r3 == r1) goto L8a
|
||||
int r5 = r9.getDepth()
|
||||
if (r5 >= r0) goto L21
|
||||
r6 = 3
|
||||
if (r3 == r6) goto L8a
|
||||
L21:
|
||||
r6 = 2
|
||||
if (r3 == r6) goto L25
|
||||
goto L12
|
||||
L25:
|
||||
if (r5 > r0) goto L12
|
||||
java.lang.String r3 = r9.getName()
|
||||
java.lang.String r5 = "item"
|
||||
boolean r3 = r3.equals(r5)
|
||||
if (r3 != 0) goto L34
|
||||
goto L12
|
||||
L34:
|
||||
int[] r3 = androidx.core.R$styleable.GradientColorItem
|
||||
android.content.res.TypedArray r3 = androidx.core.content.res.TypedArrayUtils.a(r8, r11, r10, r3)
|
||||
int r5 = androidx.core.R$styleable.GradientColorItem_android_color
|
||||
boolean r5 = r3.hasValue(r5)
|
||||
int r6 = androidx.core.R$styleable.GradientColorItem_android_offset
|
||||
boolean r6 = r3.hasValue(r6)
|
||||
if (r5 == 0) goto L6a
|
||||
if (r6 == 0) goto L6a
|
||||
int r5 = androidx.core.R$styleable.GradientColorItem_android_color
|
||||
r6 = 0
|
||||
int r5 = r3.getColor(r5, r6)
|
||||
int r6 = androidx.core.R$styleable.GradientColorItem_android_offset
|
||||
r7 = 0
|
||||
float r6 = r3.getFloat(r6, r7)
|
||||
r3.recycle()
|
||||
java.lang.Integer r3 = java.lang.Integer.valueOf(r5)
|
||||
r4.add(r3)
|
||||
java.lang.Float r3 = java.lang.Float.valueOf(r6)
|
||||
r2.add(r3)
|
||||
goto L12
|
||||
L6a:
|
||||
org.xmlpull.v1.XmlPullParserException r8 = new org.xmlpull.v1.XmlPullParserException
|
||||
java.lang.StringBuilder r10 = new java.lang.StringBuilder
|
||||
r10.<init>()
|
||||
java.lang.String r9 = r9.getPositionDescription()
|
||||
r10.append(r9)
|
||||
java.lang.String r9 = ": <item> tag requires a 'color' attribute and a 'offset' "
|
||||
r10.append(r9)
|
||||
java.lang.String r9 = "attribute!"
|
||||
r10.append(r9)
|
||||
java.lang.String r9 = r10.toString()
|
||||
r8.<init>(r9)
|
||||
throw r8
|
||||
L8a:
|
||||
int r8 = r4.size()
|
||||
if (r8 <= 0) goto L96
|
||||
androidx.core.content.res.GradientColorInflaterCompat$ColorStops r8 = new androidx.core.content.res.GradientColorInflaterCompat$ColorStops
|
||||
r8.<init>(r4, r2)
|
||||
return r8
|
||||
L96:
|
||||
r8 = 0
|
||||
return r8
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.core.content.res.GradientColorInflaterCompat.b(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources$Theme):androidx.core.content.res.GradientColorInflaterCompat$ColorStops");
|
||||
}
|
||||
|
||||
static final class ColorStops {
|
||||
final int[] a;
|
||||
final float[] b;
|
||||
|
||||
ColorStops(List<Integer> list, List<Float> list2) {
|
||||
int size = list.size();
|
||||
this.a = new int[size];
|
||||
this.b = new float[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.a[i] = list.get(i).intValue();
|
||||
this.b[i] = list2.get(i).floatValue();
|
||||
}
|
||||
}
|
||||
|
||||
ColorStops(int i, int i2) {
|
||||
this.a = new int[]{i, i2};
|
||||
this.b = new float[]{0.0f, 1.0f};
|
||||
}
|
||||
|
||||
ColorStops(int i, int i2, int i3) {
|
||||
this.a = new int[]{i, i2, i3};
|
||||
this.b = new float[]{0.0f, 0.5f, 1.0f};
|
||||
}
|
||||
}
|
||||
|
||||
private static ColorStops a(ColorStops colorStops, int i, int i2, boolean z, int i3) {
|
||||
if (colorStops != null) {
|
||||
return colorStops;
|
||||
}
|
||||
if (z) {
|
||||
return new ColorStops(i, i3, i2);
|
||||
}
|
||||
return new ColorStops(i, i2);
|
||||
}
|
||||
|
||||
private static Shader.TileMode a(int i) {
|
||||
if (i == 1) {
|
||||
return Shader.TileMode.REPEAT;
|
||||
}
|
||||
if (i != 2) {
|
||||
return Shader.TileMode.CLAMP;
|
||||
}
|
||||
return Shader.TileMode.MIRROR;
|
||||
}
|
||||
}
|
35
sources/androidx/core/content/res/GrowingArrayUtils.java
Normal file
35
sources/androidx/core/content/res/GrowingArrayUtils.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package androidx.core.content.res;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class GrowingArrayUtils {
|
||||
public static int a(int i) {
|
||||
if (i <= 4) {
|
||||
return 8;
|
||||
}
|
||||
return i * 2;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, java.lang.Object[]] */
|
||||
public static <T> T[] a(T[] tArr, int i, T t) {
|
||||
if (i + 1 > tArr.length) {
|
||||
?? r0 = (Object[]) Array.newInstance(tArr.getClass().getComponentType(), a(i));
|
||||
System.arraycopy(tArr, 0, r0, 0, i);
|
||||
tArr = r0;
|
||||
}
|
||||
tArr[i] = t;
|
||||
return tArr;
|
||||
}
|
||||
|
||||
public static int[] a(int[] iArr, int i, int i2) {
|
||||
if (i + 1 > iArr.length) {
|
||||
int[] iArr2 = new int[a(i)];
|
||||
System.arraycopy(iArr, 0, iArr2, 0, i);
|
||||
iArr = iArr2;
|
||||
}
|
||||
iArr[i] = i2;
|
||||
return iArr;
|
||||
}
|
||||
}
|
178
sources/androidx/core/content/res/ResourcesCompat.java
Normal file
178
sources/androidx/core/content/res/ResourcesCompat.java
Normal file
@@ -0,0 +1,178 @@
|
||||
package androidx.core.content.res;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.TypedValue;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ResourcesCompat {
|
||||
public static Drawable a(Resources resources, int i, Resources.Theme theme) throws Resources.NotFoundException {
|
||||
return Build.VERSION.SDK_INT >= 21 ? resources.getDrawable(i, theme) : resources.getDrawable(i);
|
||||
}
|
||||
|
||||
public static abstract class FontCallback {
|
||||
public abstract void a(int i);
|
||||
|
||||
public abstract void a(Typeface typeface);
|
||||
|
||||
public final void a(final Typeface typeface, Handler handler) {
|
||||
if (handler == null) {
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
handler.post(new Runnable() { // from class: androidx.core.content.res.ResourcesCompat.FontCallback.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
FontCallback.this.a(typeface);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final void a(final int i, Handler handler) {
|
||||
if (handler == null) {
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
handler.post(new Runnable() { // from class: androidx.core.content.res.ResourcesCompat.FontCallback.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
FontCallback.this.a(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static Typeface a(Context context, int i, TypedValue typedValue, int i2, FontCallback fontCallback) throws Resources.NotFoundException {
|
||||
if (context.isRestricted()) {
|
||||
return null;
|
||||
}
|
||||
return a(context, i, typedValue, i2, fontCallback, null, true);
|
||||
}
|
||||
|
||||
private static Typeface a(Context context, int i, TypedValue typedValue, int i2, FontCallback fontCallback, Handler handler, boolean z) {
|
||||
Resources resources = context.getResources();
|
||||
resources.getValue(i, typedValue, true);
|
||||
Typeface a = a(context, resources, typedValue, i, i2, fontCallback, handler, z);
|
||||
if (a != null || fontCallback != null) {
|
||||
return a;
|
||||
}
|
||||
throw new Resources.NotFoundException("Font resource ID #0x" + Integer.toHexString(i) + " could not be retrieved.");
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:34:0x00a3 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private static android.graphics.Typeface a(android.content.Context r15, android.content.res.Resources r16, android.util.TypedValue r17, int r18, int r19, androidx.core.content.res.ResourcesCompat.FontCallback r20, android.os.Handler r21, boolean r22) {
|
||||
/*
|
||||
r0 = r16
|
||||
r1 = r17
|
||||
r4 = r18
|
||||
r5 = r19
|
||||
r9 = r20
|
||||
r10 = r21
|
||||
java.lang.String r11 = "ResourcesCompat"
|
||||
java.lang.CharSequence r2 = r1.string
|
||||
if (r2 == 0) goto La7
|
||||
java.lang.String r12 = r2.toString()
|
||||
java.lang.String r1 = "res/"
|
||||
boolean r1 = r12.startsWith(r1)
|
||||
r13 = 0
|
||||
r14 = -3
|
||||
if (r1 != 0) goto L26
|
||||
if (r9 == 0) goto L25
|
||||
r9.a(r14, r10)
|
||||
L25:
|
||||
return r13
|
||||
L26:
|
||||
android.graphics.Typeface r1 = androidx.core.graphics.TypefaceCompat.b(r0, r4, r5)
|
||||
if (r1 == 0) goto L32
|
||||
if (r9 == 0) goto L31
|
||||
r9.a(r1, r10)
|
||||
L31:
|
||||
return r1
|
||||
L32:
|
||||
java.lang.String r1 = r12.toLowerCase() // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
java.lang.String r2 = ".xml"
|
||||
boolean r1 = r1.endsWith(r2) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
if (r1 == 0) goto L65
|
||||
android.content.res.XmlResourceParser r1 = r0.getXml(r4) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
androidx.core.content.res.FontResourcesParserCompat$FamilyResourceEntry r2 = androidx.core.content.res.FontResourcesParserCompat.a(r1, r0) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
if (r2 != 0) goto L53
|
||||
java.lang.String r0 = "Failed to find font-family tag"
|
||||
android.util.Log.e(r11, r0) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
if (r9 == 0) goto L52
|
||||
r9.a(r14, r10) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
L52:
|
||||
return r13
|
||||
L53:
|
||||
r1 = r15
|
||||
r3 = r16
|
||||
r4 = r18
|
||||
r5 = r19
|
||||
r6 = r20
|
||||
r7 = r21
|
||||
r8 = r22
|
||||
android.graphics.Typeface r0 = androidx.core.graphics.TypefaceCompat.a(r1, r2, r3, r4, r5, r6, r7, r8) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
return r0
|
||||
L65:
|
||||
r1 = r15
|
||||
android.graphics.Typeface r0 = androidx.core.graphics.TypefaceCompat.a(r15, r0, r4, r12, r5) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
if (r9 == 0) goto L75
|
||||
if (r0 == 0) goto L72
|
||||
r9.a(r0, r10) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
goto L75
|
||||
L72:
|
||||
r9.a(r14, r10) // Catch: java.io.IOException -> L76 org.xmlpull.v1.XmlPullParserException -> L8c
|
||||
L75:
|
||||
return r0
|
||||
L76:
|
||||
r0 = move-exception
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
||||
r1.<init>()
|
||||
java.lang.String r2 = "Failed to read xml resource "
|
||||
r1.append(r2)
|
||||
r1.append(r12)
|
||||
java.lang.String r1 = r1.toString()
|
||||
android.util.Log.e(r11, r1, r0)
|
||||
goto La1
|
||||
L8c:
|
||||
r0 = move-exception
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
||||
r1.<init>()
|
||||
java.lang.String r2 = "Failed to parse xml resource "
|
||||
r1.append(r2)
|
||||
r1.append(r12)
|
||||
java.lang.String r1 = r1.toString()
|
||||
android.util.Log.e(r11, r1, r0)
|
||||
La1:
|
||||
if (r9 == 0) goto La6
|
||||
r9.a(r14, r10)
|
||||
La6:
|
||||
return r13
|
||||
La7:
|
||||
android.content.res.Resources$NotFoundException r2 = new android.content.res.Resources$NotFoundException
|
||||
java.lang.StringBuilder r3 = new java.lang.StringBuilder
|
||||
r3.<init>()
|
||||
java.lang.String r5 = "Resource \""
|
||||
r3.append(r5)
|
||||
java.lang.String r0 = r0.getResourceName(r4)
|
||||
r3.append(r0)
|
||||
java.lang.String r0 = "\" ("
|
||||
r3.append(r0)
|
||||
java.lang.String r0 = java.lang.Integer.toHexString(r18)
|
||||
r3.append(r0)
|
||||
java.lang.String r0 = ") is not a Font: "
|
||||
r3.append(r0)
|
||||
r3.append(r1)
|
||||
java.lang.String r0 = r3.toString()
|
||||
r2.<init>(r0)
|
||||
throw r2
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.core.content.res.ResourcesCompat.a(android.content.Context, android.content.res.Resources, android.util.TypedValue, int, int, androidx.core.content.res.ResourcesCompat$FontCallback, android.os.Handler, boolean):android.graphics.Typeface");
|
||||
}
|
||||
}
|
71
sources/androidx/core/content/res/TypedArrayUtils.java
Normal file
71
sources/androidx/core/content/res/TypedArrayUtils.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package androidx.core.content.res;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TypedArrayUtils {
|
||||
public static boolean a(XmlPullParser xmlPullParser, String str) {
|
||||
return xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", str) != null;
|
||||
}
|
||||
|
||||
public static int b(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, int i2) {
|
||||
return !a(xmlPullParser, str) ? i2 : typedArray.getInt(i, i2);
|
||||
}
|
||||
|
||||
public static int c(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, int i2) {
|
||||
return !a(xmlPullParser, str) ? i2 : typedArray.getResourceId(i, i2);
|
||||
}
|
||||
|
||||
public static float a(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, float f) {
|
||||
return !a(xmlPullParser, str) ? f : typedArray.getFloat(i, f);
|
||||
}
|
||||
|
||||
public static TypedValue b(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i) {
|
||||
if (a(xmlPullParser, str)) {
|
||||
return typedArray.peekValue(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean a(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, boolean z) {
|
||||
return !a(xmlPullParser, str) ? z : typedArray.getBoolean(i, z);
|
||||
}
|
||||
|
||||
public static int a(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i, int i2) {
|
||||
return !a(xmlPullParser, str) ? i2 : typedArray.getColor(i, i2);
|
||||
}
|
||||
|
||||
public static ComplexColorCompat a(TypedArray typedArray, XmlPullParser xmlPullParser, Resources.Theme theme, String str, int i, int i2) {
|
||||
if (a(xmlPullParser, str)) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
typedArray.getValue(i, typedValue);
|
||||
int i3 = typedValue.type;
|
||||
if (i3 >= 28 && i3 <= 31) {
|
||||
return ComplexColorCompat.b(typedValue.data);
|
||||
}
|
||||
ComplexColorCompat b = ComplexColorCompat.b(typedArray.getResources(), typedArray.getResourceId(i, 0), theme);
|
||||
if (b != null) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return ComplexColorCompat.b(i2);
|
||||
}
|
||||
|
||||
public static String a(TypedArray typedArray, XmlPullParser xmlPullParser, String str, int i) {
|
||||
if (a(xmlPullParser, str)) {
|
||||
return typedArray.getString(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TypedArray a(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) {
|
||||
if (theme == null) {
|
||||
return resources.obtainAttributes(attributeSet, iArr);
|
||||
}
|
||||
return theme.obtainStyledAttributes(attributeSet, iArr, 0, 0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user