mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 02:17:18 +01:00
195 lines
7.3 KiB
Java
195 lines
7.3 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 android.os.Build;
|
|
import androidx.annotation.DoNotInline;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Method;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
/* 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();
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public 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:15:0x0050 */
|
|
/* JADX WARN: Removed duplicated region for block: B:18:0x005d */
|
|
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 -> L43 java.lang.ClassNotFoundException -> L46 java.lang.NoSuchMethodException -> L49
|
|
java.lang.Class<android.graphics.drawable.Drawable> r4 = android.graphics.drawable.Drawable.class
|
|
java.lang.String r5 = "getOpticalInsets"
|
|
java.lang.reflect.Method r4 = r4.getMethod(r5, r1) // Catch: java.lang.NoSuchFieldException -> L43 java.lang.ClassNotFoundException -> L46 java.lang.NoSuchMethodException -> L49
|
|
java.lang.String r5 = "left"
|
|
java.lang.reflect.Field r5 = r3.getField(r5) // Catch: java.lang.NoSuchFieldException -> L3a java.lang.ClassNotFoundException -> L3d java.lang.NoSuchMethodException -> L40
|
|
java.lang.String r6 = "top"
|
|
java.lang.reflect.Field r6 = r3.getField(r6) // Catch: java.lang.NoSuchFieldException -> L33 java.lang.ClassNotFoundException -> L36 java.lang.NoSuchMethodException -> L38
|
|
java.lang.String r7 = "right"
|
|
java.lang.reflect.Field r7 = r3.getField(r7) // Catch: java.lang.Throwable -> L31
|
|
java.lang.String r8 = "bottom"
|
|
java.lang.reflect.Field r3 = r3.getField(r8) // Catch: java.lang.Throwable -> L4c
|
|
r8 = r0
|
|
goto L4e
|
|
L31:
|
|
r7 = r1
|
|
goto L4c
|
|
L33:
|
|
r6 = r1
|
|
L34:
|
|
r7 = r6
|
|
goto L4c
|
|
L36:
|
|
r6 = r1
|
|
goto L34
|
|
L38:
|
|
r6 = r1
|
|
goto L34
|
|
L3a:
|
|
r5 = r1
|
|
L3b:
|
|
r6 = r5
|
|
goto L34
|
|
L3d:
|
|
r5 = r1
|
|
L3e:
|
|
r6 = r5
|
|
goto L34
|
|
L40:
|
|
r5 = r1
|
|
L41:
|
|
r6 = r5
|
|
goto L34
|
|
L43:
|
|
r4 = r1
|
|
r5 = r4
|
|
goto L3b
|
|
L46:
|
|
r4 = r1
|
|
r5 = r4
|
|
goto L3e
|
|
L49:
|
|
r4 = r1
|
|
r5 = r4
|
|
goto L41
|
|
L4c:
|
|
r3 = r1
|
|
r8 = r2
|
|
L4e:
|
|
if (r8 == 0) goto L5d
|
|
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 L69
|
|
L5d:
|
|
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
|
|
L69:
|
|
return
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DrawableUtils.Api18Impl.<clinit>():void");
|
|
}
|
|
|
|
private Api18Impl() {
|
|
}
|
|
|
|
@NonNull
|
|
public static Rect getOpticalInsets(@NonNull Drawable drawable) {
|
|
return DrawableUtils.INSETS_NONE;
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RequiresApi(29)
|
|
public static class Api29Impl {
|
|
private Api29Impl() {
|
|
}
|
|
|
|
@DoNotInline
|
|
public static Insets getOpticalInsets(Drawable drawable) {
|
|
return drawable.getOpticalInsets();
|
|
}
|
|
}
|
|
|
|
private DrawableUtils() {
|
|
}
|
|
|
|
@Deprecated
|
|
public static boolean canSafelyMutateDrawable(@NonNull Drawable drawable) {
|
|
return true;
|
|
}
|
|
|
|
public static void fixDrawable(@NonNull Drawable drawable) {
|
|
String name = drawable.getClass().getName();
|
|
if (Build.VERSION.SDK_INT >= 31 || !"android.graphics.drawable.ColorStateListDrawable".equals(name)) {
|
|
return;
|
|
}
|
|
forceDrawableStateChange(drawable);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
@NonNull
|
|
public static Rect getOpticalBounds(@NonNull Drawable drawable) {
|
|
Insets opticalInsets = Api29Impl.getOpticalInsets(drawable);
|
|
return new Rect(opticalInsets.left, opticalInsets.top, opticalInsets.right, opticalInsets.bottom);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|