Rabbit-R1/android (non root)/java/sources/androidx/appcompat/widget/DrawableUtils.java
2024-05-21 17:08:36 -04:00

180 lines
6.7 KiB
Java

package androidx.appcompat.widget;
import android.R;
import android.graphics.Insets;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public class DrawableUtils {
private static final int[] CHECKED_STATE_SET = {R.attr.state_checked};
private static final int[] EMPTY_STATE_SET = new int[0];
public static final Rect INSETS_NONE = new Rect();
public static boolean canSafelyMutateDrawable(Drawable drawable) {
return true;
}
private DrawableUtils() {
}
public static Rect getOpticalBounds(Drawable drawable) {
Insets opticalInsets = Api29Impl.getOpticalInsets(drawable);
return new Rect(opticalInsets.left, opticalInsets.top, opticalInsets.right, opticalInsets.bottom);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void fixDrawable(Drawable drawable) {
drawable.getClass().getName();
}
private static void forceDrawableStateChange(Drawable drawable) {
int[] state = drawable.getState();
if (state == null || state.length == 0) {
drawable.setState(CHECKED_STATE_SET);
} else {
drawable.setState(EMPTY_STATE_SET);
}
drawable.setState(state);
}
public static PorterDuff.Mode parseTintMode(int i, PorterDuff.Mode mode) {
if (i == 3) {
return PorterDuff.Mode.SRC_OVER;
}
if (i == 5) {
return PorterDuff.Mode.SRC_IN;
}
if (i == 9) {
return PorterDuff.Mode.SRC_ATOP;
}
switch (i) {
case 14:
return PorterDuff.Mode.MULTIPLY;
case 15:
return PorterDuff.Mode.SCREEN;
case 16:
return PorterDuff.Mode.ADD;
default:
return mode;
}
}
/* loaded from: classes.dex */
static class Api18Impl {
private static final Field sBottom;
private static final Method sGetOpticalInsets;
private static final Field sLeft;
private static final boolean sReflectionSuccessful;
private static final Field sRight;
private static final Field sTop;
/* JADX WARN: Removed duplicated region for block: B:16:0x004c */
/* JADX WARN: Removed duplicated region for block: B:19:0x0059 */
static {
/*
r0 = 1
r1 = 0
r2 = 0
java.lang.String r3 = "android.graphics.Insets"
java.lang.Class r3 = java.lang.Class.forName(r3) // Catch: java.lang.NoSuchFieldException -> L3c java.lang.ClassNotFoundException -> L40 java.lang.NoSuchMethodException -> L44
java.lang.Class<android.graphics.drawable.Drawable> r4 = android.graphics.drawable.Drawable.class
java.lang.String r5 = "getOpticalInsets"
java.lang.Class[] r6 = new java.lang.Class[r2] // Catch: java.lang.NoSuchFieldException -> L3c java.lang.ClassNotFoundException -> L40 java.lang.NoSuchMethodException -> L44
java.lang.reflect.Method r4 = r4.getMethod(r5, r6) // Catch: java.lang.NoSuchFieldException -> L3c java.lang.ClassNotFoundException -> L40 java.lang.NoSuchMethodException -> L44
java.lang.String r5 = "left"
java.lang.reflect.Field r5 = r3.getField(r5) // Catch: java.lang.NoSuchFieldException -> L36 java.lang.ClassNotFoundException -> L38 java.lang.NoSuchMethodException -> L3a
java.lang.String r6 = "top"
java.lang.reflect.Field r6 = r3.getField(r6) // Catch: java.lang.NoSuchFieldException -> L30 java.lang.ClassNotFoundException -> L32 java.lang.NoSuchMethodException -> L34
java.lang.String r7 = "right"
java.lang.reflect.Field r7 = r3.getField(r7) // Catch: java.lang.Throwable -> L2e
java.lang.String r8 = "bottom"
java.lang.reflect.Field r3 = r3.getField(r8) // Catch: java.lang.Throwable -> L48
r8 = r0
goto L4a
L2e:
r7 = r1
goto L48
L30:
r6 = r1
goto L47
L32:
r6 = r1
goto L47
L34:
r6 = r1
goto L47
L36:
r5 = r1
goto L3e
L38:
r5 = r1
goto L42
L3a:
r5 = r1
goto L46
L3c:
r4 = r1
r5 = r4
L3e:
r6 = r5
goto L47
L40:
r4 = r1
r5 = r4
L42:
r6 = r5
goto L47
L44:
r4 = r1
r5 = r4
L46:
r6 = r5
L47:
r7 = r6
L48:
r3 = r1
r8 = r2
L4a:
if (r8 == 0) goto L59
androidx.appcompat.widget.DrawableUtils.Api18Impl.sGetOpticalInsets = r4
androidx.appcompat.widget.DrawableUtils.Api18Impl.sLeft = r5
androidx.appcompat.widget.DrawableUtils.Api18Impl.sTop = r6
androidx.appcompat.widget.DrawableUtils.Api18Impl.sRight = r7
androidx.appcompat.widget.DrawableUtils.Api18Impl.sBottom = r3
androidx.appcompat.widget.DrawableUtils.Api18Impl.sReflectionSuccessful = r0
goto L65
L59:
androidx.appcompat.widget.DrawableUtils.Api18Impl.sGetOpticalInsets = r1
androidx.appcompat.widget.DrawableUtils.Api18Impl.sLeft = r1
androidx.appcompat.widget.DrawableUtils.Api18Impl.sTop = r1
androidx.appcompat.widget.DrawableUtils.Api18Impl.sRight = r1
androidx.appcompat.widget.DrawableUtils.Api18Impl.sBottom = r1
androidx.appcompat.widget.DrawableUtils.Api18Impl.sReflectionSuccessful = r2
L65:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DrawableUtils.Api18Impl.<clinit>():void");
}
private Api18Impl() {
}
static Rect getOpticalInsets(Drawable drawable) {
return DrawableUtils.INSETS_NONE;
}
}
/* loaded from: classes.dex */
static class Api29Impl {
private Api29Impl() {
}
static Insets getOpticalInsets(Drawable drawable) {
return drawable.getOpticalInsets();
}
}
}