ADD week 5
This commit is contained in:
124
02-Easy5/E5/sources/androidx/core/graphics/BitmapCompat.java
Normal file
124
02-Easy5/E5/sources/androidx/core/graphics/BitmapCompat.java
Normal file
@ -0,0 +1,124 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BlendMode;
|
||||
import android.graphics.ColorSpace;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class BitmapCompat {
|
||||
public static int sizeAtStep(int i, int i2, int i3, int i4) {
|
||||
return i3 == 0 ? i2 : i3 > 0 ? i * (1 << (i4 - i3)) : i2 << ((-i3) - 1);
|
||||
}
|
||||
|
||||
public static boolean hasMipMap(Bitmap bitmap) {
|
||||
return Api17Impl.hasMipMap(bitmap);
|
||||
}
|
||||
|
||||
public static void setHasMipMap(Bitmap bitmap, boolean z) {
|
||||
Api17Impl.setHasMipMap(bitmap, z);
|
||||
}
|
||||
|
||||
public static int getAllocationByteCount(Bitmap bitmap) {
|
||||
return Api19Impl.getAllocationByteCount(bitmap);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:95:0x01a5, code lost:
|
||||
|
||||
if (androidx.core.graphics.BitmapCompat.Api27Impl.isAlreadyF16AndLinear(r10) == false) goto L122;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public static android.graphics.Bitmap createScaledBitmap(android.graphics.Bitmap r22, int r23, int r24, android.graphics.Rect r25, boolean r26) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 530
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.core.graphics.BitmapCompat.createScaledBitmap(android.graphics.Bitmap, int, int, android.graphics.Rect, boolean):android.graphics.Bitmap");
|
||||
}
|
||||
|
||||
private BitmapCompat() {
|
||||
}
|
||||
|
||||
static class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static boolean hasMipMap(Bitmap bitmap) {
|
||||
return bitmap.hasMipMap();
|
||||
}
|
||||
|
||||
static void setHasMipMap(Bitmap bitmap, boolean z) {
|
||||
bitmap.setHasMipMap(z);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api19Impl {
|
||||
private Api19Impl() {
|
||||
}
|
||||
|
||||
static int getAllocationByteCount(Bitmap bitmap) {
|
||||
return bitmap.getAllocationByteCount();
|
||||
}
|
||||
}
|
||||
|
||||
static class Api27Impl {
|
||||
private Api27Impl() {
|
||||
}
|
||||
|
||||
static Bitmap createBitmapWithSourceColorspace(int i, int i2, Bitmap bitmap, boolean z) {
|
||||
Bitmap.Config config = bitmap.getConfig();
|
||||
ColorSpace colorSpace = bitmap.getColorSpace();
|
||||
ColorSpace colorSpace2 = ColorSpace.get(ColorSpace.Named.LINEAR_EXTENDED_SRGB);
|
||||
if (z && !bitmap.getColorSpace().equals(colorSpace2)) {
|
||||
config = Bitmap.Config.RGBA_F16;
|
||||
colorSpace = colorSpace2;
|
||||
} else if (bitmap.getConfig() == Bitmap.Config.HARDWARE) {
|
||||
config = Bitmap.Config.ARGB_8888;
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
config = Api31Impl.getHardwareBitmapConfig(bitmap);
|
||||
}
|
||||
}
|
||||
return Bitmap.createBitmap(i, i2, config, bitmap.hasAlpha(), colorSpace);
|
||||
}
|
||||
|
||||
static boolean isAlreadyF16AndLinear(Bitmap bitmap) {
|
||||
return bitmap.getConfig() == Bitmap.Config.RGBA_F16 && bitmap.getColorSpace().equals(ColorSpace.get(ColorSpace.Named.LINEAR_EXTENDED_SRGB));
|
||||
}
|
||||
|
||||
static Bitmap copyBitmapIfHardware(Bitmap bitmap) {
|
||||
if (bitmap.getConfig() != Bitmap.Config.HARDWARE) {
|
||||
return bitmap;
|
||||
}
|
||||
Bitmap.Config config = Bitmap.Config.ARGB_8888;
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
config = Api31Impl.getHardwareBitmapConfig(bitmap);
|
||||
}
|
||||
return bitmap.copy(config, true);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static void setPaintBlendMode(Paint paint) {
|
||||
paint.setBlendMode(BlendMode.SRC);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api31Impl {
|
||||
private Api31Impl() {
|
||||
}
|
||||
|
||||
static Bitmap.Config getHardwareBitmapConfig(Bitmap bitmap) {
|
||||
if (bitmap.getHardwareBuffer().getFormat() == 22) {
|
||||
return Bitmap.Config.RGBA_F16;
|
||||
}
|
||||
return Bitmap.Config.ARGB_8888;
|
||||
}
|
||||
}
|
||||
}
|
112
02-Easy5/E5/sources/androidx/core/graphics/BitmapKt.java
Normal file
112
02-Easy5/E5/sources/androidx/core/graphics/BitmapKt.java
Normal file
@ -0,0 +1,112 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorSpace;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Bitmap.kt */
|
||||
@Metadata(d1 = {"\u0000D\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u001a#\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00032\b\b\u0002\u0010\u0005\u001a\u00020\u0006H\u0086\b\u001a7\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00032\b\b\u0002\u0010\u0005\u001a\u00020\u00062\b\b\u0002\u0010\u0007\u001a\u00020\b2\b\b\u0002\u0010\t\u001a\u00020\nH\u0087\b\u001a)\u0010\u000b\u001a\u00020\u0001*\u00020\u00012\u0017\u0010\f\u001a\u0013\u0012\u0004\u0012\u00020\u000e\u0012\u0004\u0012\u00020\u000f0\r¢\u0006\u0002\b\u0010H\u0086\bø\u0001\u0000\u001a\u0015\u0010\u0011\u001a\u00020\b*\u00020\u00012\u0006\u0010\u0012\u001a\u00020\u0013H\u0086\n\u001a\u0015\u0010\u0011\u001a\u00020\b*\u00020\u00012\u0006\u0010\u0012\u001a\u00020\u0014H\u0086\n\u001a\u001d\u0010\u0015\u001a\u00020\u0003*\u00020\u00012\u0006\u0010\u0016\u001a\u00020\u00032\u0006\u0010\u0017\u001a\u00020\u0003H\u0086\n\u001a'\u0010\u0018\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00032\b\b\u0002\u0010\u0019\u001a\u00020\bH\u0086\b\u001a'\u0010\u001a\u001a\u00020\u000f*\u00020\u00012\u0006\u0010\u0016\u001a\u00020\u00032\u0006\u0010\u0017\u001a\u00020\u00032\b\b\u0001\u0010\u001b\u001a\u00020\u0003H\u0086\n\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u001c"}, d2 = {"createBitmap", "Landroid/graphics/Bitmap;", "width", "", "height", "config", "Landroid/graphics/Bitmap$Config;", "hasAlpha", "", "colorSpace", "Landroid/graphics/ColorSpace;", "applyCanvas", "block", "Lkotlin/Function1;", "Landroid/graphics/Canvas;", "", "Lkotlin/ExtensionFunctionType;", "contains", "p", "Landroid/graphics/Point;", "Landroid/graphics/PointF;", "get", "x", "y", "scale", "filter", "set", TypedValues.Custom.S_COLOR, "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class BitmapKt {
|
||||
public static final Bitmap applyCanvas(Bitmap bitmap, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
block.invoke(new Canvas(bitmap));
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static final int get(Bitmap bitmap, int i, int i2) {
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
return bitmap.getPixel(i, i2);
|
||||
}
|
||||
|
||||
public static final void set(Bitmap bitmap, int i, int i2, int i3) {
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
bitmap.setPixel(i, i2, i3);
|
||||
}
|
||||
|
||||
public static /* synthetic */ Bitmap scale$default(Bitmap bitmap, int i, int i2, boolean z, int i3, Object obj) {
|
||||
if ((i3 & 4) != 0) {
|
||||
z = true;
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, i, i2, z);
|
||||
Intrinsics.checkNotNullExpressionValue(createScaledBitmap, "createScaledBitmap(this, width, height, filter)");
|
||||
return createScaledBitmap;
|
||||
}
|
||||
|
||||
public static final Bitmap scale(Bitmap bitmap, int i, int i2, boolean z) {
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, i, i2, z);
|
||||
Intrinsics.checkNotNullExpressionValue(createScaledBitmap, "createScaledBitmap(this, width, height, filter)");
|
||||
return createScaledBitmap;
|
||||
}
|
||||
|
||||
public static /* synthetic */ Bitmap createBitmap$default(int i, int i2, Bitmap.Config config, int i3, Object obj) {
|
||||
if ((i3 & 4) != 0) {
|
||||
config = Bitmap.Config.ARGB_8888;
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(config, "config");
|
||||
Bitmap createBitmap = Bitmap.createBitmap(i, i2, config);
|
||||
Intrinsics.checkNotNullExpressionValue(createBitmap, "createBitmap(width, height, config)");
|
||||
return createBitmap;
|
||||
}
|
||||
|
||||
public static final Bitmap createBitmap(int i, int i2, Bitmap.Config config) {
|
||||
Intrinsics.checkNotNullParameter(config, "config");
|
||||
Bitmap createBitmap = Bitmap.createBitmap(i, i2, config);
|
||||
Intrinsics.checkNotNullExpressionValue(createBitmap, "createBitmap(width, height, config)");
|
||||
return createBitmap;
|
||||
}
|
||||
|
||||
public static /* synthetic */ Bitmap createBitmap$default(int i, int i2, Bitmap.Config config, boolean z, ColorSpace colorSpace, int i3, Object obj) {
|
||||
Bitmap createBitmap;
|
||||
ColorSpace.Named named;
|
||||
if ((i3 & 4) != 0) {
|
||||
config = Bitmap.Config.ARGB_8888;
|
||||
}
|
||||
if ((i3 & 8) != 0) {
|
||||
z = true;
|
||||
}
|
||||
if ((i3 & 16) != 0) {
|
||||
named = ColorSpace.Named.SRGB;
|
||||
colorSpace = ColorSpace.get(named);
|
||||
Intrinsics.checkNotNullExpressionValue(colorSpace, "get(ColorSpace.Named.SRGB)");
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(config, "config");
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
createBitmap = Bitmap.createBitmap(i, i2, config, z, colorSpace);
|
||||
Intrinsics.checkNotNullExpressionValue(createBitmap, "createBitmap(width, heig…ig, hasAlpha, colorSpace)");
|
||||
return createBitmap;
|
||||
}
|
||||
|
||||
public static final Bitmap createBitmap(int i, int i2, Bitmap.Config config, boolean z, ColorSpace colorSpace) {
|
||||
Bitmap createBitmap;
|
||||
Intrinsics.checkNotNullParameter(config, "config");
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
createBitmap = Bitmap.createBitmap(i, i2, config, z, colorSpace);
|
||||
Intrinsics.checkNotNullExpressionValue(createBitmap, "createBitmap(width, heig…ig, hasAlpha, colorSpace)");
|
||||
return createBitmap;
|
||||
}
|
||||
|
||||
public static final boolean contains(Bitmap bitmap, Point p) {
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
int width = bitmap.getWidth();
|
||||
int i = p.x;
|
||||
return i >= 0 && i < width && p.y >= 0 && p.y < bitmap.getHeight();
|
||||
}
|
||||
|
||||
public static final boolean contains(Bitmap bitmap, PointF p) {
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
return p.x >= 0.0f && p.x < ((float) bitmap.getWidth()) && p.y >= 0.0f && p.y < ((float) bitmap.getHeight());
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.BlendMode;
|
||||
import android.graphics.BlendModeColorFilter;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.os.Build;
|
||||
import androidx.core.graphics.BlendModeUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BlendModeColorFilterCompat {
|
||||
public static ColorFilter createBlendModeColorFilterCompat(int i, BlendModeCompat blendModeCompat) {
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
Object obtainBlendModeFromCompat = BlendModeUtils.Api29Impl.obtainBlendModeFromCompat(blendModeCompat);
|
||||
if (obtainBlendModeFromCompat != null) {
|
||||
return Api29Impl.createBlendModeColorFilter(i, obtainBlendModeFromCompat);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
PorterDuff.Mode obtainPorterDuffFromCompat = BlendModeUtils.obtainPorterDuffFromCompat(blendModeCompat);
|
||||
if (obtainPorterDuffFromCompat != null) {
|
||||
return new PorterDuffColorFilter(i, obtainPorterDuffFromCompat);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private BlendModeColorFilterCompat() {
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static ColorFilter createBlendModeColorFilter(int i, Object obj) {
|
||||
return new BlendModeColorFilter(i, (BlendMode) obj);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum BlendModeCompat {
|
||||
CLEAR,
|
||||
SRC,
|
||||
DST,
|
||||
SRC_OVER,
|
||||
DST_OVER,
|
||||
SRC_IN,
|
||||
DST_IN,
|
||||
SRC_OUT,
|
||||
DST_OUT,
|
||||
SRC_ATOP,
|
||||
DST_ATOP,
|
||||
XOR,
|
||||
PLUS,
|
||||
MODULATE,
|
||||
SCREEN,
|
||||
OVERLAY,
|
||||
DARKEN,
|
||||
LIGHTEN,
|
||||
COLOR_DODGE,
|
||||
COLOR_BURN,
|
||||
HARD_LIGHT,
|
||||
SOFT_LIGHT,
|
||||
DIFFERENCE,
|
||||
EXCLUSION,
|
||||
MULTIPLY,
|
||||
HUE,
|
||||
SATURATION,
|
||||
COLOR,
|
||||
LUMINOSITY
|
||||
}
|
215
02-Easy5/E5/sources/androidx/core/graphics/BlendModeUtils.java
Normal file
215
02-Easy5/E5/sources/androidx/core/graphics/BlendModeUtils.java
Normal file
@ -0,0 +1,215 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.BlendMode;
|
||||
import android.graphics.PorterDuff;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class BlendModeUtils {
|
||||
private BlendModeUtils() {
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static Object obtainBlendModeFromCompat(BlendModeCompat blendModeCompat) {
|
||||
switch (AnonymousClass1.$SwitchMap$androidx$core$graphics$BlendModeCompat[blendModeCompat.ordinal()]) {
|
||||
case 1:
|
||||
return BlendMode.CLEAR;
|
||||
case 2:
|
||||
return BlendMode.SRC;
|
||||
case 3:
|
||||
return BlendMode.DST;
|
||||
case 4:
|
||||
return BlendMode.SRC_OVER;
|
||||
case 5:
|
||||
return BlendMode.DST_OVER;
|
||||
case 6:
|
||||
return BlendMode.SRC_IN;
|
||||
case 7:
|
||||
return BlendMode.DST_IN;
|
||||
case 8:
|
||||
return BlendMode.SRC_OUT;
|
||||
case 9:
|
||||
return BlendMode.DST_OUT;
|
||||
case 10:
|
||||
return BlendMode.SRC_ATOP;
|
||||
case 11:
|
||||
return BlendMode.DST_ATOP;
|
||||
case 12:
|
||||
return BlendMode.XOR;
|
||||
case 13:
|
||||
return BlendMode.PLUS;
|
||||
case 14:
|
||||
return BlendMode.MODULATE;
|
||||
case 15:
|
||||
return BlendMode.SCREEN;
|
||||
case 16:
|
||||
return BlendMode.OVERLAY;
|
||||
case 17:
|
||||
return BlendMode.DARKEN;
|
||||
case 18:
|
||||
return BlendMode.LIGHTEN;
|
||||
case 19:
|
||||
return BlendMode.COLOR_DODGE;
|
||||
case 20:
|
||||
return BlendMode.COLOR_BURN;
|
||||
case 21:
|
||||
return BlendMode.HARD_LIGHT;
|
||||
case 22:
|
||||
return BlendMode.SOFT_LIGHT;
|
||||
case 23:
|
||||
return BlendMode.DIFFERENCE;
|
||||
case 24:
|
||||
return BlendMode.EXCLUSION;
|
||||
case 25:
|
||||
return BlendMode.MULTIPLY;
|
||||
case 26:
|
||||
return BlendMode.HUE;
|
||||
case 27:
|
||||
return BlendMode.SATURATION;
|
||||
case 28:
|
||||
return BlendMode.COLOR;
|
||||
case 29:
|
||||
return BlendMode.LUMINOSITY;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* renamed from: androidx.core.graphics.BlendModeUtils$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] $SwitchMap$androidx$core$graphics$BlendModeCompat;
|
||||
|
||||
static {
|
||||
int[] iArr = new int[BlendModeCompat.values().length];
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat = iArr;
|
||||
try {
|
||||
iArr[BlendModeCompat.CLEAR.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SRC.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.DST.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SRC_OVER.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.DST_OVER.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError unused5) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SRC_IN.ordinal()] = 6;
|
||||
} catch (NoSuchFieldError unused6) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.DST_IN.ordinal()] = 7;
|
||||
} catch (NoSuchFieldError unused7) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SRC_OUT.ordinal()] = 8;
|
||||
} catch (NoSuchFieldError unused8) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.DST_OUT.ordinal()] = 9;
|
||||
} catch (NoSuchFieldError unused9) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SRC_ATOP.ordinal()] = 10;
|
||||
} catch (NoSuchFieldError unused10) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.DST_ATOP.ordinal()] = 11;
|
||||
} catch (NoSuchFieldError unused11) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.XOR.ordinal()] = 12;
|
||||
} catch (NoSuchFieldError unused12) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.PLUS.ordinal()] = 13;
|
||||
} catch (NoSuchFieldError unused13) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.MODULATE.ordinal()] = 14;
|
||||
} catch (NoSuchFieldError unused14) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SCREEN.ordinal()] = 15;
|
||||
} catch (NoSuchFieldError unused15) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.OVERLAY.ordinal()] = 16;
|
||||
} catch (NoSuchFieldError unused16) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.DARKEN.ordinal()] = 17;
|
||||
} catch (NoSuchFieldError unused17) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.LIGHTEN.ordinal()] = 18;
|
||||
} catch (NoSuchFieldError unused18) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.COLOR_DODGE.ordinal()] = 19;
|
||||
} catch (NoSuchFieldError unused19) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.COLOR_BURN.ordinal()] = 20;
|
||||
} catch (NoSuchFieldError unused20) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.HARD_LIGHT.ordinal()] = 21;
|
||||
} catch (NoSuchFieldError unused21) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SOFT_LIGHT.ordinal()] = 22;
|
||||
} catch (NoSuchFieldError unused22) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.DIFFERENCE.ordinal()] = 23;
|
||||
} catch (NoSuchFieldError unused23) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.EXCLUSION.ordinal()] = 24;
|
||||
} catch (NoSuchFieldError unused24) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.MULTIPLY.ordinal()] = 25;
|
||||
} catch (NoSuchFieldError unused25) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.HUE.ordinal()] = 26;
|
||||
} catch (NoSuchFieldError unused26) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.SATURATION.ordinal()] = 27;
|
||||
} catch (NoSuchFieldError unused27) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.COLOR.ordinal()] = 28;
|
||||
} catch (NoSuchFieldError unused28) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$androidx$core$graphics$BlendModeCompat[BlendModeCompat.LUMINOSITY.ordinal()] = 29;
|
||||
} catch (NoSuchFieldError unused29) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PorterDuff.Mode obtainPorterDuffFromCompat(BlendModeCompat blendModeCompat) {
|
||||
if (blendModeCompat == null) {
|
||||
return null;
|
||||
}
|
||||
switch (AnonymousClass1.$SwitchMap$androidx$core$graphics$BlendModeCompat[blendModeCompat.ordinal()]) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
281
02-Easy5/E5/sources/androidx/core/graphics/CanvasKt.java
Normal file
281
02-Easy5/E5/sources/androidx/core/graphics/CanvasKt.java
Normal file
@ -0,0 +1,281 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.internal.InlineMarker;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Canvas.kt */
|
||||
@Metadata(d1 = {"\u0000>\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u000b\u001a1\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00042\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001a1\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\b\u001a\u00020\t2\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001a1\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\b\u001a\u00020\n2\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001aI\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u000e\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\f2\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001aI\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u000b\u001a\u00020\u00102\u0006\u0010\r\u001a\u00020\u00102\u0006\u0010\u000e\u001a\u00020\u00102\u0006\u0010\u000f\u001a\u00020\u00102\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001a3\u0010\u0011\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u0012\u001a\u00020\u00132\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001aG\u0010\u0014\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u0015\u001a\u00020\f2\b\b\u0002\u0010\u0016\u001a\u00020\f2\b\b\u0002\u0010\u0017\u001a\u00020\f2\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001a)\u0010\u0018\u001a\u00020\u0001*\u00020\u00022\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001aQ\u0010\u0019\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u001a\u001a\u00020\f2\b\b\u0002\u0010\u001b\u001a\u00020\f2\b\b\u0002\u0010\u0016\u001a\u00020\f2\b\b\u0002\u0010\u0017\u001a\u00020\f2\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001a=\u0010\u001c\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u001a\u001a\u00020\f2\b\b\u0002\u0010\u001b\u001a\u00020\f2\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u001a=\u0010\u001d\u001a\u00020\u0001*\u00020\u00022\b\b\u0002\u0010\u001a\u001a\u00020\f2\b\b\u0002\u0010\u001b\u001a\u00020\f2\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00010\u0006¢\u0006\u0002\b\u0007H\u0086\bø\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u001e"}, d2 = {"withClip", "", "Landroid/graphics/Canvas;", "clipPath", "Landroid/graphics/Path;", "block", "Lkotlin/Function1;", "Lkotlin/ExtensionFunctionType;", "clipRect", "Landroid/graphics/Rect;", "Landroid/graphics/RectF;", "left", "", "top", "right", "bottom", "", "withMatrix", "matrix", "Landroid/graphics/Matrix;", "withRotation", "degrees", "pivotX", "pivotY", "withSave", "withScale", "x", "y", "withSkew", "withTranslation", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class CanvasKt {
|
||||
public static final void withSave(Canvas canvas, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static /* synthetic */ void withTranslation$default(Canvas canvas, float f, float f2, Function1 block, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if ((i & 2) != 0) {
|
||||
f2 = 0.0f;
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.translate(f, f2);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withTranslation(Canvas canvas, float f, float f2, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.translate(f, f2);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static /* synthetic */ void withRotation$default(Canvas canvas, float f, float f2, float f3, Function1 block, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if ((i & 2) != 0) {
|
||||
f2 = 0.0f;
|
||||
}
|
||||
if ((i & 4) != 0) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.rotate(f, f2, f3);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withRotation(Canvas canvas, float f, float f2, float f3, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.rotate(f, f2, f3);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static /* synthetic */ void withScale$default(Canvas canvas, float f, float f2, float f3, float f4, Function1 block, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
f = 1.0f;
|
||||
}
|
||||
if ((i & 2) != 0) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
if ((i & 4) != 0) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
if ((i & 8) != 0) {
|
||||
f4 = 0.0f;
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.scale(f, f2, f3, f4);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withScale(Canvas canvas, float f, float f2, float f3, float f4, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.scale(f, f2, f3, f4);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static /* synthetic */ void withSkew$default(Canvas canvas, float f, float f2, Function1 block, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if ((i & 2) != 0) {
|
||||
f2 = 0.0f;
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.skew(f, f2);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withSkew(Canvas canvas, float f, float f2, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.skew(f, f2);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static /* synthetic */ void withMatrix$default(Canvas canvas, Matrix matrix, Function1 block, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
matrix = new Matrix();
|
||||
}
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(matrix, "matrix");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.concat(matrix);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withMatrix(Canvas canvas, Matrix matrix, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(matrix, "matrix");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.concat(matrix);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withClip(Canvas canvas, Rect clipRect, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(clipRect, "clipRect");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.clipRect(clipRect);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withClip(Canvas canvas, RectF clipRect, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(clipRect, "clipRect");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.clipRect(clipRect);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withClip(Canvas canvas, int i, int i2, int i3, int i4, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.clipRect(i, i2, i3, i4);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withClip(Canvas canvas, float f, float f2, float f3, float f4, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.clipRect(f, f2, f3, f4);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void withClip(Canvas canvas, Path clipPath, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(canvas, "<this>");
|
||||
Intrinsics.checkNotNullParameter(clipPath, "clipPath");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
int save = canvas.save();
|
||||
canvas.clipPath(clipPath);
|
||||
try {
|
||||
block.invoke(canvas);
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
canvas.restoreToCount(save);
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.location.GnssMeasurementsEvent;
|
||||
import android.location.GnssStatus;
|
||||
import android.location.LocationRequest;
|
||||
import android.os.LocaleList;
|
||||
import android.os.OutcomeReceiver;
|
||||
import android.text.PrecomputedText;
|
||||
import android.text.TextPaint;
|
||||
|
||||
/* compiled from: D8$$SyntheticClass */
|
||||
/* loaded from: classes.dex */
|
||||
public final /* synthetic */ class ColorKt$$ExternalSyntheticApiModelOutline0 {
|
||||
public static /* bridge */ /* synthetic */ ImageDecoder.OnHeaderDecodedListener m(Object obj) {
|
||||
return (ImageDecoder.OnHeaderDecodedListener) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ GnssStatus m89m(Object obj) {
|
||||
return (GnssStatus) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ LocationRequest m90m(Object obj) {
|
||||
return (LocationRequest) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ LocaleList m91m(Object obj) {
|
||||
return (LocaleList) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ OutcomeReceiver m92m(Object obj) {
|
||||
return (OutcomeReceiver) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* synthetic */ PrecomputedText.Params.Builder m93m(TextPaint textPaint) {
|
||||
return new PrecomputedText.Params.Builder(textPaint);
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ PrecomputedText m94m(Object obj) {
|
||||
return (PrecomputedText) obj;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ Class m98m() {
|
||||
return GnssMeasurementsEvent.Callback.class;
|
||||
}
|
||||
|
||||
/* renamed from: m, reason: collision with other method in class */
|
||||
public static /* bridge */ /* synthetic */ boolean m109m(Object obj) {
|
||||
return obj instanceof PrecomputedText;
|
||||
}
|
||||
}
|
241
02-Easy5/E5/sources/androidx/core/graphics/ColorKt.java
Normal file
241
02-Easy5/E5/sources/androidx/core/graphics/ColorKt.java
Normal file
@ -0,0 +1,241 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorSpace;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Color.kt */
|
||||
@Metadata(d1 = {"\u0000>\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0007\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\u0002\u001a\r\u0010\u0018\u001a\u00020\u0004*\u00020\u0019H\u0087\n\u001a\r\u0010\u0018\u001a\u00020\u0001*\u00020\u0001H\u0086\n\u001a\r\u0010\u0018\u001a\u00020\u0004*\u00020\u0005H\u0087\n\u001a\r\u0010\u001a\u001a\u00020\u0004*\u00020\u0019H\u0087\n\u001a\r\u0010\u001a\u001a\u00020\u0001*\u00020\u0001H\u0086\n\u001a\r\u0010\u001a\u001a\u00020\u0004*\u00020\u0005H\u0087\n\u001a\r\u0010\u001b\u001a\u00020\u0004*\u00020\u0019H\u0087\n\u001a\r\u0010\u001b\u001a\u00020\u0001*\u00020\u0001H\u0086\n\u001a\r\u0010\u001b\u001a\u00020\u0004*\u00020\u0005H\u0087\n\u001a\r\u0010\u001c\u001a\u00020\u0004*\u00020\u0019H\u0087\n\u001a\r\u0010\u001c\u001a\u00020\u0001*\u00020\u0001H\u0086\n\u001a\r\u0010\u001c\u001a\u00020\u0004*\u00020\u0005H\u0087\n\u001a\u0015\u0010\u001d\u001a\u00020\u0019*\u00020\u00192\u0006\u0010\t\u001a\u00020\nH\u0087\f\u001a\u0015\u0010\u001d\u001a\u00020\u0019*\u00020\u00192\u0006\u0010\t\u001a\u00020\u001eH\u0087\f\u001a\u0015\u0010\u001d\u001a\u00020\u0005*\u00020\u00012\u0006\u0010\t\u001a\u00020\nH\u0087\f\u001a\u0015\u0010\u001d\u001a\u00020\u0005*\u00020\u00012\u0006\u0010\t\u001a\u00020\u001eH\u0087\f\u001a\u0015\u0010\u001d\u001a\u00020\u0005*\u00020\u00052\u0006\u0010\t\u001a\u00020\nH\u0087\f\u001a\u0015\u0010\u001d\u001a\u00020\u0005*\u00020\u00052\u0006\u0010\t\u001a\u00020\u001eH\u0087\f\u001a\u0015\u0010\u001f\u001a\u00020\u0019*\u00020\u00192\u0006\u0010 \u001a\u00020\u0019H\u0087\u0002\u001a\r\u0010!\u001a\u00020\u0019*\u00020\u0001H\u0087\b\u001a\r\u0010!\u001a\u00020\u0019*\u00020\u0005H\u0087\b\u001a\r\u0010\"\u001a\u00020\u0001*\u00020\u0005H\u0087\b\u001a\r\u0010\"\u001a\u00020\u0001*\u00020#H\u0087\b\u001a\r\u0010$\u001a\u00020\u0005*\u00020\u0001H\u0087\b\"\u0016\u0010\u0000\u001a\u00020\u0001*\u00020\u00018Æ\u0002¢\u0006\u0006\u001a\u0004\b\u0002\u0010\u0003\"\u0016\u0010\u0000\u001a\u00020\u0004*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\u0002\u0010\u0006\"\u0016\u0010\u0007\u001a\u00020\u0001*\u00020\u00018Æ\u0002¢\u0006\u0006\u001a\u0004\b\b\u0010\u0003\"\u0016\u0010\u0007\u001a\u00020\u0004*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\b\u0010\u0006\"\u0016\u0010\t\u001a\u00020\n*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\u000b\u0010\f\"\u0016\u0010\r\u001a\u00020\u0001*\u00020\u00018Æ\u0002¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u0003\"\u0016\u0010\r\u001a\u00020\u0004*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u0006\"\u0016\u0010\u000f\u001a\u00020\u0010*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0011\"\u0016\u0010\u0012\u001a\u00020\u0010*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\u0012\u0010\u0011\"\u0016\u0010\u0013\u001a\u00020\u0004*\u00020\u00018Ç\u0002¢\u0006\u0006\u001a\u0004\b\u0014\u0010\u0015\"\u0016\u0010\u0013\u001a\u00020\u0004*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\u0014\u0010\u0006\"\u0016\u0010\u0016\u001a\u00020\u0001*\u00020\u00018Æ\u0002¢\u0006\u0006\u001a\u0004\b\u0017\u0010\u0003\"\u0016\u0010\u0016\u001a\u00020\u0004*\u00020\u00058Ç\u0002¢\u0006\u0006\u001a\u0004\b\u0017\u0010\u0006¨\u0006%"}, d2 = {"alpha", "", "getAlpha", "(I)I", "", "", "(J)F", "blue", "getBlue", "colorSpace", "Landroid/graphics/ColorSpace;", "getColorSpace", "(J)Landroid/graphics/ColorSpace;", "green", "getGreen", "isSrgb", "", "(J)Z", "isWideGamut", "luminance", "getLuminance", "(I)F", "red", "getRed", "component1", "Landroid/graphics/Color;", "component2", "component3", "component4", "convertTo", "Landroid/graphics/ColorSpace$Named;", "plus", "c", "toColor", "toColorInt", "", "toColorLong", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class ColorKt {
|
||||
public static final int component1(int i) {
|
||||
return (i >> 24) & 255;
|
||||
}
|
||||
|
||||
public static final int component2(int i) {
|
||||
return (i >> 16) & 255;
|
||||
}
|
||||
|
||||
public static final int component3(int i) {
|
||||
return (i >> 8) & 255;
|
||||
}
|
||||
|
||||
public static final int component4(int i) {
|
||||
return i & 255;
|
||||
}
|
||||
|
||||
public static final int getAlpha(int i) {
|
||||
return (i >> 24) & 255;
|
||||
}
|
||||
|
||||
public static final int getBlue(int i) {
|
||||
return i & 255;
|
||||
}
|
||||
|
||||
public static final int getGreen(int i) {
|
||||
return (i >> 8) & 255;
|
||||
}
|
||||
|
||||
public static final int getRed(int i) {
|
||||
return (i >> 16) & 255;
|
||||
}
|
||||
|
||||
public static final float component1(Color color) {
|
||||
float component;
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
component = color.getComponent(0);
|
||||
return component;
|
||||
}
|
||||
|
||||
public static final float component2(Color color) {
|
||||
float component;
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
component = color.getComponent(1);
|
||||
return component;
|
||||
}
|
||||
|
||||
public static final float component3(Color color) {
|
||||
float component;
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
component = color.getComponent(2);
|
||||
return component;
|
||||
}
|
||||
|
||||
public static final float component4(Color color) {
|
||||
float component;
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
component = color.getComponent(3);
|
||||
return component;
|
||||
}
|
||||
|
||||
public static final Color plus(Color color, Color c) {
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
Intrinsics.checkNotNullParameter(c, "c");
|
||||
Color compositeColors = ColorUtils.compositeColors(c, color);
|
||||
Intrinsics.checkNotNullExpressionValue(compositeColors, "compositeColors(c, this)");
|
||||
return compositeColors;
|
||||
}
|
||||
|
||||
public static final float getLuminance(int i) {
|
||||
float luminance;
|
||||
luminance = Color.luminance(i);
|
||||
return luminance;
|
||||
}
|
||||
|
||||
public static final Color toColor(int i) {
|
||||
Color valueOf;
|
||||
valueOf = Color.valueOf(i);
|
||||
Intrinsics.checkNotNullExpressionValue(valueOf, "valueOf(this)");
|
||||
return valueOf;
|
||||
}
|
||||
|
||||
public static final long toColorLong(int i) {
|
||||
long pack;
|
||||
pack = Color.pack(i);
|
||||
return pack;
|
||||
}
|
||||
|
||||
public static final float component1(long j) {
|
||||
float red;
|
||||
red = Color.red(j);
|
||||
return red;
|
||||
}
|
||||
|
||||
public static final float component2(long j) {
|
||||
float green;
|
||||
green = Color.green(j);
|
||||
return green;
|
||||
}
|
||||
|
||||
public static final float component3(long j) {
|
||||
float blue;
|
||||
blue = Color.blue(j);
|
||||
return blue;
|
||||
}
|
||||
|
||||
public static final float component4(long j) {
|
||||
float alpha;
|
||||
alpha = Color.alpha(j);
|
||||
return alpha;
|
||||
}
|
||||
|
||||
public static final float getAlpha(long j) {
|
||||
float alpha;
|
||||
alpha = Color.alpha(j);
|
||||
return alpha;
|
||||
}
|
||||
|
||||
public static final float getRed(long j) {
|
||||
float red;
|
||||
red = Color.red(j);
|
||||
return red;
|
||||
}
|
||||
|
||||
public static final float getGreen(long j) {
|
||||
float green;
|
||||
green = Color.green(j);
|
||||
return green;
|
||||
}
|
||||
|
||||
public static final float getBlue(long j) {
|
||||
float blue;
|
||||
blue = Color.blue(j);
|
||||
return blue;
|
||||
}
|
||||
|
||||
public static final float getLuminance(long j) {
|
||||
float luminance;
|
||||
luminance = Color.luminance(j);
|
||||
return luminance;
|
||||
}
|
||||
|
||||
public static final Color toColor(long j) {
|
||||
Color valueOf;
|
||||
valueOf = Color.valueOf(j);
|
||||
Intrinsics.checkNotNullExpressionValue(valueOf, "valueOf(this)");
|
||||
return valueOf;
|
||||
}
|
||||
|
||||
public static final int toColorInt(long j) {
|
||||
int argb;
|
||||
argb = Color.toArgb(j);
|
||||
return argb;
|
||||
}
|
||||
|
||||
public static final boolean isSrgb(long j) {
|
||||
boolean isSrgb;
|
||||
isSrgb = Color.isSrgb(j);
|
||||
return isSrgb;
|
||||
}
|
||||
|
||||
public static final boolean isWideGamut(long j) {
|
||||
boolean isWideGamut;
|
||||
isWideGamut = Color.isWideGamut(j);
|
||||
return isWideGamut;
|
||||
}
|
||||
|
||||
public static final ColorSpace getColorSpace(long j) {
|
||||
ColorSpace colorSpace;
|
||||
colorSpace = Color.colorSpace(j);
|
||||
Intrinsics.checkNotNullExpressionValue(colorSpace, "colorSpace(this)");
|
||||
return colorSpace;
|
||||
}
|
||||
|
||||
public static final long convertTo(int i, ColorSpace.Named colorSpace) {
|
||||
ColorSpace colorSpace2;
|
||||
long convert;
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
colorSpace2 = ColorSpace.get(colorSpace);
|
||||
convert = Color.convert(i, colorSpace2);
|
||||
return convert;
|
||||
}
|
||||
|
||||
public static final long convertTo(int i, ColorSpace colorSpace) {
|
||||
long convert;
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
convert = Color.convert(i, colorSpace);
|
||||
return convert;
|
||||
}
|
||||
|
||||
public static final long convertTo(long j, ColorSpace.Named colorSpace) {
|
||||
ColorSpace colorSpace2;
|
||||
long convert;
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
colorSpace2 = ColorSpace.get(colorSpace);
|
||||
convert = Color.convert(j, colorSpace2);
|
||||
return convert;
|
||||
}
|
||||
|
||||
public static final long convertTo(long j, ColorSpace colorSpace) {
|
||||
long convert;
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
convert = Color.convert(j, colorSpace);
|
||||
return convert;
|
||||
}
|
||||
|
||||
public static final Color convertTo(Color color, ColorSpace.Named colorSpace) {
|
||||
ColorSpace colorSpace2;
|
||||
Color convert;
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
colorSpace2 = ColorSpace.get(colorSpace);
|
||||
convert = color.convert(colorSpace2);
|
||||
Intrinsics.checkNotNullExpressionValue(convert, "convert(ColorSpace.get(colorSpace))");
|
||||
return convert;
|
||||
}
|
||||
|
||||
public static final Color convertTo(Color color, ColorSpace colorSpace) {
|
||||
Color convert;
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
Intrinsics.checkNotNullParameter(colorSpace, "colorSpace");
|
||||
convert = color.convert(colorSpace);
|
||||
Intrinsics.checkNotNullExpressionValue(convert, "convert(colorSpace)");
|
||||
return convert;
|
||||
}
|
||||
|
||||
public static final int toColorInt(String str) {
|
||||
Intrinsics.checkNotNullParameter(str, "<this>");
|
||||
return Color.parseColor(str);
|
||||
}
|
||||
}
|
332
02-Easy5/E5/sources/androidx/core/graphics/ColorUtils.java
Normal file
332
02-Easy5/E5/sources/androidx/core/graphics/ColorUtils.java
Normal file
@ -0,0 +1,332 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Color;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import java.util.Objects;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ColorUtils {
|
||||
private static final int MIN_ALPHA_SEARCH_MAX_ITERATIONS = 10;
|
||||
private static final int MIN_ALPHA_SEARCH_PRECISION = 1;
|
||||
private static final ThreadLocal<double[]> TEMP_ARRAY = new ThreadLocal<>();
|
||||
private static final double XYZ_EPSILON = 0.008856d;
|
||||
private static final double XYZ_KAPPA = 903.3d;
|
||||
private static final double XYZ_WHITE_REFERENCE_X = 95.047d;
|
||||
private static final double XYZ_WHITE_REFERENCE_Y = 100.0d;
|
||||
private static final double XYZ_WHITE_REFERENCE_Z = 108.883d;
|
||||
|
||||
private ColorUtils() {
|
||||
}
|
||||
|
||||
public static int compositeColors(int i, int i2) {
|
||||
int alpha = Color.alpha(i2);
|
||||
int alpha2 = Color.alpha(i);
|
||||
int compositeAlpha = compositeAlpha(alpha2, alpha);
|
||||
return Color.argb(compositeAlpha, compositeComponent(Color.red(i), alpha2, Color.red(i2), alpha, compositeAlpha), compositeComponent(Color.green(i), alpha2, Color.green(i2), alpha, compositeAlpha), compositeComponent(Color.blue(i), alpha2, Color.blue(i2), alpha, compositeAlpha));
|
||||
}
|
||||
|
||||
public static Color compositeColors(Color color, Color color2) {
|
||||
return Api26Impl.compositeColors(color, color2);
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static Color compositeColors(Color color, Color color2) {
|
||||
if (!Objects.equals(color.getModel(), color2.getModel())) {
|
||||
throw new IllegalArgumentException("Color models must match (" + color.getModel() + " vs. " + color2.getModel() + ")");
|
||||
}
|
||||
if (!Objects.equals(color2.getColorSpace(), color.getColorSpace())) {
|
||||
color = color.convert(color2.getColorSpace());
|
||||
}
|
||||
float[] components = color.getComponents();
|
||||
float[] components2 = color2.getComponents();
|
||||
float alpha = color.alpha();
|
||||
float alpha2 = color2.alpha() * (1.0f - alpha);
|
||||
int componentCount = color2.getComponentCount() - 1;
|
||||
float f = alpha + alpha2;
|
||||
components2[componentCount] = f;
|
||||
if (f > 0.0f) {
|
||||
alpha /= f;
|
||||
alpha2 /= f;
|
||||
}
|
||||
for (int i = 0; i < componentCount; i++) {
|
||||
components2[i] = (components[i] * alpha) + (components2[i] * alpha2);
|
||||
}
|
||||
return Color.valueOf(components2, color2.getColorSpace());
|
||||
}
|
||||
}
|
||||
|
||||
private static int compositeAlpha(int i, int i2) {
|
||||
return 255 - (((255 - i2) * (255 - i)) / 255);
|
||||
}
|
||||
|
||||
private static int compositeComponent(int i, int i2, int i3, int i4, int i5) {
|
||||
if (i5 == 0) {
|
||||
return 0;
|
||||
}
|
||||
return (((i * 255) * i2) + ((i3 * i4) * (255 - i2))) / (i5 * 255);
|
||||
}
|
||||
|
||||
public static double calculateLuminance(int i) {
|
||||
double[] tempDouble3Array = getTempDouble3Array();
|
||||
colorToXYZ(i, tempDouble3Array);
|
||||
return tempDouble3Array[1] / XYZ_WHITE_REFERENCE_Y;
|
||||
}
|
||||
|
||||
public static double calculateContrast(int i, int i2) {
|
||||
if (Color.alpha(i2) != 255) {
|
||||
throw new IllegalArgumentException("background can not be translucent: #" + Integer.toHexString(i2));
|
||||
}
|
||||
if (Color.alpha(i) < 255) {
|
||||
i = compositeColors(i, i2);
|
||||
}
|
||||
double calculateLuminance = calculateLuminance(i) + 0.05d;
|
||||
double calculateLuminance2 = calculateLuminance(i2) + 0.05d;
|
||||
return Math.max(calculateLuminance, calculateLuminance2) / Math.min(calculateLuminance, calculateLuminance2);
|
||||
}
|
||||
|
||||
public static int calculateMinimumAlpha(int i, int i2, float f) {
|
||||
int i3 = 255;
|
||||
if (Color.alpha(i2) != 255) {
|
||||
throw new IllegalArgumentException("background can not be translucent: #" + Integer.toHexString(i2));
|
||||
}
|
||||
double d = f;
|
||||
if (calculateContrast(setAlphaComponent(i, 255), i2) < d) {
|
||||
return -1;
|
||||
}
|
||||
int i4 = 0;
|
||||
for (int i5 = 0; i5 <= 10 && i3 - i4 > 1; i5++) {
|
||||
int i6 = (i4 + i3) / 2;
|
||||
if (calculateContrast(setAlphaComponent(i, i6), i2) < d) {
|
||||
i4 = i6;
|
||||
} else {
|
||||
i3 = i6;
|
||||
}
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
public static void RGBToHSL(int i, int i2, int i3, float[] fArr) {
|
||||
float f;
|
||||
float abs;
|
||||
float f2 = i / 255.0f;
|
||||
float f3 = i2 / 255.0f;
|
||||
float f4 = i3 / 255.0f;
|
||||
float max = Math.max(f2, Math.max(f3, f4));
|
||||
float min = Math.min(f2, Math.min(f3, f4));
|
||||
float f5 = max - min;
|
||||
float f6 = (max + min) / 2.0f;
|
||||
if (max == min) {
|
||||
f = 0.0f;
|
||||
abs = 0.0f;
|
||||
} else {
|
||||
f = max == f2 ? ((f3 - f4) / f5) % 6.0f : max == f3 ? ((f4 - f2) / f5) + 2.0f : 4.0f + ((f2 - f3) / f5);
|
||||
abs = f5 / (1.0f - Math.abs((2.0f * f6) - 1.0f));
|
||||
}
|
||||
float f7 = (f * 60.0f) % 360.0f;
|
||||
if (f7 < 0.0f) {
|
||||
f7 += 360.0f;
|
||||
}
|
||||
fArr[0] = constrain(f7, 0.0f, 360.0f);
|
||||
fArr[1] = constrain(abs, 0.0f, 1.0f);
|
||||
fArr[2] = constrain(f6, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
public static void colorToHSL(int i, float[] fArr) {
|
||||
RGBToHSL(Color.red(i), Color.green(i), Color.blue(i), fArr);
|
||||
}
|
||||
|
||||
public static int HSLToColor(float[] fArr) {
|
||||
int round;
|
||||
int round2;
|
||||
int round3;
|
||||
float f = fArr[0];
|
||||
float f2 = fArr[1];
|
||||
float f3 = fArr[2];
|
||||
float abs = (1.0f - Math.abs((f3 * 2.0f) - 1.0f)) * f2;
|
||||
float f4 = f3 - (0.5f * abs);
|
||||
float abs2 = (1.0f - Math.abs(((f / 60.0f) % 2.0f) - 1.0f)) * abs;
|
||||
switch (((int) f) / 60) {
|
||||
case 0:
|
||||
round = Math.round((abs + f4) * 255.0f);
|
||||
round2 = Math.round((abs2 + f4) * 255.0f);
|
||||
round3 = Math.round(f4 * 255.0f);
|
||||
break;
|
||||
case 1:
|
||||
round = Math.round((abs2 + f4) * 255.0f);
|
||||
round2 = Math.round((abs + f4) * 255.0f);
|
||||
round3 = Math.round(f4 * 255.0f);
|
||||
break;
|
||||
case 2:
|
||||
round = Math.round(f4 * 255.0f);
|
||||
round2 = Math.round((abs + f4) * 255.0f);
|
||||
round3 = Math.round((abs2 + f4) * 255.0f);
|
||||
break;
|
||||
case 3:
|
||||
round = Math.round(f4 * 255.0f);
|
||||
round2 = Math.round((abs2 + f4) * 255.0f);
|
||||
round3 = Math.round((abs + f4) * 255.0f);
|
||||
break;
|
||||
case 4:
|
||||
round = Math.round((abs2 + f4) * 255.0f);
|
||||
round2 = Math.round(f4 * 255.0f);
|
||||
round3 = Math.round((abs + f4) * 255.0f);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
round = Math.round((abs + f4) * 255.0f);
|
||||
round2 = Math.round(f4 * 255.0f);
|
||||
round3 = Math.round((abs2 + f4) * 255.0f);
|
||||
break;
|
||||
default:
|
||||
round3 = 0;
|
||||
round = 0;
|
||||
round2 = 0;
|
||||
break;
|
||||
}
|
||||
return Color.rgb(constrain(round, 0, 255), constrain(round2, 0, 255), constrain(round3, 0, 255));
|
||||
}
|
||||
|
||||
public static int setAlphaComponent(int i, int i2) {
|
||||
if (i2 < 0 || i2 > 255) {
|
||||
throw new IllegalArgumentException("alpha must be between 0 and 255.");
|
||||
}
|
||||
return (i & ViewCompat.MEASURED_SIZE_MASK) | (i2 << 24);
|
||||
}
|
||||
|
||||
public static void colorToLAB(int i, double[] dArr) {
|
||||
RGBToLAB(Color.red(i), Color.green(i), Color.blue(i), dArr);
|
||||
}
|
||||
|
||||
public static void RGBToLAB(int i, int i2, int i3, double[] dArr) {
|
||||
RGBToXYZ(i, i2, i3, dArr);
|
||||
XYZToLAB(dArr[0], dArr[1], dArr[2], dArr);
|
||||
}
|
||||
|
||||
public static void colorToXYZ(int i, double[] dArr) {
|
||||
RGBToXYZ(Color.red(i), Color.green(i), Color.blue(i), dArr);
|
||||
}
|
||||
|
||||
public static void RGBToXYZ(int i, int i2, int i3, double[] dArr) {
|
||||
if (dArr.length != 3) {
|
||||
throw new IllegalArgumentException("outXyz must have a length of 3.");
|
||||
}
|
||||
double d = i / 255.0d;
|
||||
double pow = d < 0.04045d ? d / 12.92d : Math.pow((d + 0.055d) / 1.055d, 2.4d);
|
||||
double d2 = i2 / 255.0d;
|
||||
double pow2 = d2 < 0.04045d ? d2 / 12.92d : Math.pow((d2 + 0.055d) / 1.055d, 2.4d);
|
||||
double d3 = i3 / 255.0d;
|
||||
double pow3 = d3 < 0.04045d ? d3 / 12.92d : Math.pow((d3 + 0.055d) / 1.055d, 2.4d);
|
||||
dArr[0] = ((0.4124d * pow) + (0.3576d * pow2) + (0.1805d * pow3)) * XYZ_WHITE_REFERENCE_Y;
|
||||
dArr[1] = ((0.2126d * pow) + (0.7152d * pow2) + (0.0722d * pow3)) * XYZ_WHITE_REFERENCE_Y;
|
||||
dArr[2] = ((pow * 0.0193d) + (pow2 * 0.1192d) + (pow3 * 0.9505d)) * XYZ_WHITE_REFERENCE_Y;
|
||||
}
|
||||
|
||||
public static void XYZToLAB(double d, double d2, double d3, double[] dArr) {
|
||||
if (dArr.length != 3) {
|
||||
throw new IllegalArgumentException("outLab must have a length of 3.");
|
||||
}
|
||||
double pivotXyzComponent = pivotXyzComponent(d / XYZ_WHITE_REFERENCE_X);
|
||||
double pivotXyzComponent2 = pivotXyzComponent(d2 / XYZ_WHITE_REFERENCE_Y);
|
||||
double pivotXyzComponent3 = pivotXyzComponent(d3 / XYZ_WHITE_REFERENCE_Z);
|
||||
dArr[0] = Math.max(0.0d, (116.0d * pivotXyzComponent2) - 16.0d);
|
||||
dArr[1] = (pivotXyzComponent - pivotXyzComponent2) * 500.0d;
|
||||
dArr[2] = (pivotXyzComponent2 - pivotXyzComponent3) * 200.0d;
|
||||
}
|
||||
|
||||
public static void LABToXYZ(double d, double d2, double d3, double[] dArr) {
|
||||
double d4 = (d + 16.0d) / 116.0d;
|
||||
double d5 = (d2 / 500.0d) + d4;
|
||||
double d6 = d4 - (d3 / 200.0d);
|
||||
double pow = Math.pow(d5, 3.0d);
|
||||
if (pow <= XYZ_EPSILON) {
|
||||
pow = ((d5 * 116.0d) - 16.0d) / XYZ_KAPPA;
|
||||
}
|
||||
double pow2 = d > 7.9996247999999985d ? Math.pow(d4, 3.0d) : d / XYZ_KAPPA;
|
||||
double pow3 = Math.pow(d6, 3.0d);
|
||||
if (pow3 <= XYZ_EPSILON) {
|
||||
pow3 = ((d6 * 116.0d) - 16.0d) / XYZ_KAPPA;
|
||||
}
|
||||
dArr[0] = pow * XYZ_WHITE_REFERENCE_X;
|
||||
dArr[1] = pow2 * XYZ_WHITE_REFERENCE_Y;
|
||||
dArr[2] = pow3 * XYZ_WHITE_REFERENCE_Z;
|
||||
}
|
||||
|
||||
public static int XYZToColor(double d, double d2, double d3) {
|
||||
double d4 = (((3.2406d * d) + ((-1.5372d) * d2)) + ((-0.4986d) * d3)) / XYZ_WHITE_REFERENCE_Y;
|
||||
double d5 = ((((-0.9689d) * d) + (1.8758d * d2)) + (0.0415d * d3)) / XYZ_WHITE_REFERENCE_Y;
|
||||
double d6 = (((0.0557d * d) + ((-0.204d) * d2)) + (1.057d * d3)) / XYZ_WHITE_REFERENCE_Y;
|
||||
return Color.rgb(constrain((int) Math.round((d4 > 0.0031308d ? (Math.pow(d4, 0.4166666666666667d) * 1.055d) - 0.055d : d4 * 12.92d) * 255.0d), 0, 255), constrain((int) Math.round((d5 > 0.0031308d ? (Math.pow(d5, 0.4166666666666667d) * 1.055d) - 0.055d : d5 * 12.92d) * 255.0d), 0, 255), constrain((int) Math.round((d6 > 0.0031308d ? (Math.pow(d6, 0.4166666666666667d) * 1.055d) - 0.055d : d6 * 12.92d) * 255.0d), 0, 255));
|
||||
}
|
||||
|
||||
public static int LABToColor(double d, double d2, double d3) {
|
||||
double[] tempDouble3Array = getTempDouble3Array();
|
||||
LABToXYZ(d, d2, d3, tempDouble3Array);
|
||||
return XYZToColor(tempDouble3Array[0], tempDouble3Array[1], tempDouble3Array[2]);
|
||||
}
|
||||
|
||||
public static double distanceEuclidean(double[] dArr, double[] dArr2) {
|
||||
return Math.sqrt(Math.pow(dArr[0] - dArr2[0], 2.0d) + Math.pow(dArr[1] - dArr2[1], 2.0d) + Math.pow(dArr[2] - dArr2[2], 2.0d));
|
||||
}
|
||||
|
||||
private static float constrain(float f, float f2, float f3) {
|
||||
return f < f2 ? f2 : Math.min(f, f3);
|
||||
}
|
||||
|
||||
private static int constrain(int i, int i2, int i3) {
|
||||
return i < i2 ? i2 : Math.min(i, i3);
|
||||
}
|
||||
|
||||
private static double pivotXyzComponent(double d) {
|
||||
return d > XYZ_EPSILON ? Math.pow(d, 0.3333333333333333d) : ((d * XYZ_KAPPA) + 16.0d) / 116.0d;
|
||||
}
|
||||
|
||||
public static int blendARGB(int i, int i2, float f) {
|
||||
float f2 = 1.0f - f;
|
||||
return Color.argb((int) ((Color.alpha(i) * f2) + (Color.alpha(i2) * f)), (int) ((Color.red(i) * f2) + (Color.red(i2) * f)), (int) ((Color.green(i) * f2) + (Color.green(i2) * f)), (int) ((Color.blue(i) * f2) + (Color.blue(i2) * f)));
|
||||
}
|
||||
|
||||
public static void blendHSL(float[] fArr, float[] fArr2, float f, float[] fArr3) {
|
||||
if (fArr3.length != 3) {
|
||||
throw new IllegalArgumentException("result must have a length of 3.");
|
||||
}
|
||||
float f2 = 1.0f - f;
|
||||
fArr3[0] = circularInterpolate(fArr[0], fArr2[0], f);
|
||||
fArr3[1] = (fArr[1] * f2) + (fArr2[1] * f);
|
||||
fArr3[2] = (fArr[2] * f2) + (fArr2[2] * f);
|
||||
}
|
||||
|
||||
public static void blendLAB(double[] dArr, double[] dArr2, double d, double[] dArr3) {
|
||||
if (dArr3.length != 3) {
|
||||
throw new IllegalArgumentException("outResult must have a length of 3.");
|
||||
}
|
||||
double d2 = 1.0d - d;
|
||||
dArr3[0] = (dArr[0] * d2) + (dArr2[0] * d);
|
||||
dArr3[1] = (dArr[1] * d2) + (dArr2[1] * d);
|
||||
dArr3[2] = (dArr[2] * d2) + (dArr2[2] * d);
|
||||
}
|
||||
|
||||
static float circularInterpolate(float f, float f2, float f3) {
|
||||
if (Math.abs(f2 - f) > 180.0f) {
|
||||
if (f2 > f) {
|
||||
f += 360.0f;
|
||||
} else {
|
||||
f2 += 360.0f;
|
||||
}
|
||||
}
|
||||
return (f + ((f2 - f) * f3)) % 360.0f;
|
||||
}
|
||||
|
||||
private static double[] getTempDouble3Array() {
|
||||
ThreadLocal<double[]> threadLocal = TEMP_ARRAY;
|
||||
double[] dArr = threadLocal.get();
|
||||
if (dArr != null) {
|
||||
return dArr;
|
||||
}
|
||||
double[] dArr2 = new double[3];
|
||||
threadLocal.set(dArr2);
|
||||
return dArr2;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function3;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: ImageDecoder.kt */
|
||||
@Metadata(d1 = {"\u00000\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u001aU\u0010\u0000\u001a\u00020\u0001*\u00020\u00022C\b\u0004\u0010\u0003\u001a=\u0012\u0004\u0012\u00020\u0005\u0012\u0013\u0012\u00110\u0006¢\u0006\f\b\u0007\u0012\b\b\b\u0012\u0004\b\b(\t\u0012\u0013\u0012\u00110\u0002¢\u0006\f\b\u0007\u0012\b\b\b\u0012\u0004\b\b(\n\u0012\u0004\u0012\u00020\u000b0\u0004¢\u0006\u0002\b\fH\u0087\bø\u0001\u0000\u001aU\u0010\r\u001a\u00020\u000e*\u00020\u00022C\b\u0004\u0010\u0003\u001a=\u0012\u0004\u0012\u00020\u0005\u0012\u0013\u0012\u00110\u0006¢\u0006\f\b\u0007\u0012\b\b\b\u0012\u0004\b\b(\t\u0012\u0013\u0012\u00110\u0002¢\u0006\f\b\u0007\u0012\b\b\b\u0012\u0004\b\b(\n\u0012\u0004\u0012\u00020\u000b0\u0004¢\u0006\u0002\b\fH\u0087\bø\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u000f"}, d2 = {"decodeBitmap", "Landroid/graphics/Bitmap;", "Landroid/graphics/ImageDecoder$Source;", "action", "Lkotlin/Function3;", "Landroid/graphics/ImageDecoder;", "Landroid/graphics/ImageDecoder$ImageInfo;", "Lkotlin/ParameterName;", "name", "info", "source", "", "Lkotlin/ExtensionFunctionType;", "decodeDrawable", "Landroid/graphics/drawable/Drawable;", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class ImageDecoderKt {
|
||||
public static final Bitmap decodeBitmap(ImageDecoder.Source source, final Function3<? super ImageDecoder, ? super ImageDecoder.ImageInfo, ? super ImageDecoder.Source, Unit> action) {
|
||||
Bitmap decodeBitmap;
|
||||
Intrinsics.checkNotNullParameter(source, "<this>");
|
||||
Intrinsics.checkNotNullParameter(action, "action");
|
||||
decodeBitmap = ImageDecoder.decodeBitmap(source, ColorKt$$ExternalSyntheticApiModelOutline0.m((Object) new ImageDecoder.OnHeaderDecodedListener() { // from class: androidx.core.graphics.ImageDecoderKt$decodeBitmap$1
|
||||
@Override // android.graphics.ImageDecoder.OnHeaderDecodedListener
|
||||
public final void onHeaderDecoded(ImageDecoder decoder, ImageDecoder.ImageInfo info, ImageDecoder.Source source2) {
|
||||
Intrinsics.checkNotNullParameter(decoder, "decoder");
|
||||
Intrinsics.checkNotNullParameter(info, "info");
|
||||
Intrinsics.checkNotNullParameter(source2, "source");
|
||||
action.invoke(decoder, info, source2);
|
||||
}
|
||||
}));
|
||||
Intrinsics.checkNotNullExpressionValue(decodeBitmap, "crossinline action: Imag…ction(info, source)\n }");
|
||||
return decodeBitmap;
|
||||
}
|
||||
|
||||
public static final Drawable decodeDrawable(ImageDecoder.Source source, final Function3<? super ImageDecoder, ? super ImageDecoder.ImageInfo, ? super ImageDecoder.Source, Unit> action) {
|
||||
Drawable decodeDrawable;
|
||||
Intrinsics.checkNotNullParameter(source, "<this>");
|
||||
Intrinsics.checkNotNullParameter(action, "action");
|
||||
decodeDrawable = ImageDecoder.decodeDrawable(source, ColorKt$$ExternalSyntheticApiModelOutline0.m((Object) new ImageDecoder.OnHeaderDecodedListener() { // from class: androidx.core.graphics.ImageDecoderKt$decodeDrawable$1
|
||||
@Override // android.graphics.ImageDecoder.OnHeaderDecodedListener
|
||||
public final void onHeaderDecoded(ImageDecoder decoder, ImageDecoder.ImageInfo info, ImageDecoder.Source source2) {
|
||||
Intrinsics.checkNotNullParameter(decoder, "decoder");
|
||||
Intrinsics.checkNotNullParameter(info, "info");
|
||||
Intrinsics.checkNotNullParameter(source2, "source");
|
||||
action.invoke(decoder, info, source2);
|
||||
}
|
||||
}));
|
||||
Intrinsics.checkNotNullExpressionValue(decodeDrawable, "crossinline action: Imag…ction(info, source)\n }");
|
||||
return decodeDrawable;
|
||||
}
|
||||
}
|
92
02-Easy5/E5/sources/androidx/core/graphics/Insets.java
Normal file
92
02-Easy5/E5/sources/androidx/core/graphics/Insets.java
Normal file
@ -0,0 +1,92 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Insets {
|
||||
public static final Insets NONE = new Insets(0, 0, 0, 0);
|
||||
public final int bottom;
|
||||
public final int left;
|
||||
public final int right;
|
||||
public final int top;
|
||||
|
||||
public int hashCode() {
|
||||
return (((((this.left * 31) + this.top) * 31) + this.right) * 31) + this.bottom;
|
||||
}
|
||||
|
||||
private Insets(int i, int i2, int i3, int i4) {
|
||||
this.left = i;
|
||||
this.top = i2;
|
||||
this.right = i3;
|
||||
this.bottom = i4;
|
||||
}
|
||||
|
||||
public static Insets of(int i, int i2, int i3, int i4) {
|
||||
return (i == 0 && i2 == 0 && i3 == 0 && i4 == 0) ? NONE : new Insets(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
public static Insets of(Rect rect) {
|
||||
return of(rect.left, rect.top, rect.right, rect.bottom);
|
||||
}
|
||||
|
||||
public static Insets add(Insets insets, Insets insets2) {
|
||||
return of(insets.left + insets2.left, insets.top + insets2.top, insets.right + insets2.right, insets.bottom + insets2.bottom);
|
||||
}
|
||||
|
||||
public static Insets subtract(Insets insets, Insets insets2) {
|
||||
return of(insets.left - insets2.left, insets.top - insets2.top, insets.right - insets2.right, insets.bottom - insets2.bottom);
|
||||
}
|
||||
|
||||
public static Insets max(Insets insets, Insets insets2) {
|
||||
return of(Math.max(insets.left, insets2.left), Math.max(insets.top, insets2.top), Math.max(insets.right, insets2.right), Math.max(insets.bottom, insets2.bottom));
|
||||
}
|
||||
|
||||
public static Insets min(Insets insets, Insets insets2) {
|
||||
return of(Math.min(insets.left, insets2.left), Math.min(insets.top, insets2.top), Math.min(insets.right, insets2.right), Math.min(insets.bottom, insets2.bottom));
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Insets insets = (Insets) obj;
|
||||
return this.bottom == insets.bottom && this.left == insets.left && this.right == insets.right && this.top == insets.top;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Insets{left=" + this.left + ", top=" + this.top + ", right=" + this.right + ", bottom=" + this.bottom + '}';
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Insets wrap(android.graphics.Insets insets) {
|
||||
return toCompatInsets(insets);
|
||||
}
|
||||
|
||||
public static Insets toCompatInsets(android.graphics.Insets insets) {
|
||||
int i;
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
i = insets.left;
|
||||
i2 = insets.top;
|
||||
i3 = insets.right;
|
||||
i4 = insets.bottom;
|
||||
return of(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
public android.graphics.Insets toPlatformInsets() {
|
||||
return Api29Impl.of(this.left, this.top, this.right, this.bottom);
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static android.graphics.Insets of(int i, int i2, int i3, int i4) {
|
||||
return android.graphics.Insets.of(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
}
|
73
02-Easy5/E5/sources/androidx/core/graphics/MatrixKt.java
Normal file
73
02-Easy5/E5/sources/androidx/core/graphics/MatrixKt.java
Normal file
@ -0,0 +1,73 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Matrix.kt */
|
||||
@Metadata(d1 = {"\u0000\u0016\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u000b\n\u0002\u0010\u0014\n\u0000\u001a\"\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u00032\b\b\u0002\u0010\u0005\u001a\u00020\u0003\u001a\u001a\u0010\u0006\u001a\u00020\u00012\b\b\u0002\u0010\u0007\u001a\u00020\u00032\b\b\u0002\u0010\b\u001a\u00020\u0003\u001a\u001a\u0010\t\u001a\u00020\u00012\b\b\u0002\u0010\n\u001a\u00020\u00032\b\b\u0002\u0010\u000b\u001a\u00020\u0003\u001a\u0015\u0010\f\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\r\u001a\u00020\u0001H\u0086\n\u001a\r\u0010\u000e\u001a\u00020\u000f*\u00020\u0001H\u0086\b¨\u0006\u0010"}, d2 = {"rotationMatrix", "Landroid/graphics/Matrix;", "degrees", "", "px", "py", "scaleMatrix", "sx", "sy", "translationMatrix", "tx", "ty", "times", "m", "values", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class MatrixKt {
|
||||
public static final Matrix times(Matrix matrix, Matrix m) {
|
||||
Intrinsics.checkNotNullParameter(matrix, "<this>");
|
||||
Intrinsics.checkNotNullParameter(m, "m");
|
||||
Matrix matrix2 = new Matrix(matrix);
|
||||
matrix2.preConcat(m);
|
||||
return matrix2;
|
||||
}
|
||||
|
||||
public static final float[] values(Matrix matrix) {
|
||||
Intrinsics.checkNotNullParameter(matrix, "<this>");
|
||||
float[] fArr = new float[9];
|
||||
matrix.getValues(fArr);
|
||||
return fArr;
|
||||
}
|
||||
|
||||
public static /* synthetic */ Matrix translationMatrix$default(float f, float f2, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if ((i & 2) != 0) {
|
||||
f2 = 0.0f;
|
||||
}
|
||||
return translationMatrix(f, f2);
|
||||
}
|
||||
|
||||
public static final Matrix translationMatrix(float f, float f2) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate(f, f2);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
public static /* synthetic */ Matrix scaleMatrix$default(float f, float f2, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
f = 1.0f;
|
||||
}
|
||||
if ((i & 2) != 0) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
return scaleMatrix(f, f2);
|
||||
}
|
||||
|
||||
public static final Matrix scaleMatrix(float f, float f2) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setScale(f, f2);
|
||||
return matrix;
|
||||
}
|
||||
|
||||
public static /* synthetic */ Matrix rotationMatrix$default(float f, float f2, float f3, int i, Object obj) {
|
||||
if ((i & 2) != 0) {
|
||||
f2 = 0.0f;
|
||||
}
|
||||
if ((i & 4) != 0) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
return rotationMatrix(f, f2, f3);
|
||||
}
|
||||
|
||||
public static final Matrix rotationMatrix(float f, float f2, float f3) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setRotate(f, f2, f3);
|
||||
return matrix;
|
||||
}
|
||||
}
|
103
02-Easy5/E5/sources/androidx/core/graphics/PaintCompat.java
Normal file
103
02-Easy5/E5/sources/androidx/core/graphics/PaintCompat.java
Normal file
@ -0,0 +1,103 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.BlendMode;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import androidx.core.graphics.BlendModeUtils;
|
||||
import androidx.core.util.Pair;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class PaintCompat {
|
||||
private static final String EM_STRING = "m";
|
||||
private static final String TOFU_STRING = "\udfffd";
|
||||
private static final ThreadLocal<Pair<Rect, Rect>> sRectThreadLocal = new ThreadLocal<>();
|
||||
|
||||
public static boolean hasGlyph(Paint paint, String str) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.hasGlyph(paint, str);
|
||||
}
|
||||
int length = str.length();
|
||||
if (length == 1 && Character.isWhitespace(str.charAt(0))) {
|
||||
return true;
|
||||
}
|
||||
float measureText = paint.measureText(TOFU_STRING);
|
||||
float measureText2 = paint.measureText(EM_STRING);
|
||||
float measureText3 = paint.measureText(str);
|
||||
float f = 0.0f;
|
||||
if (measureText3 == 0.0f) {
|
||||
return false;
|
||||
}
|
||||
if (str.codePointCount(0, str.length()) > 1) {
|
||||
if (measureText3 > measureText2 * 2.0f) {
|
||||
return false;
|
||||
}
|
||||
int i = 0;
|
||||
while (i < length) {
|
||||
int charCount = Character.charCount(str.codePointAt(i)) + i;
|
||||
f += paint.measureText(str, i, charCount);
|
||||
i = charCount;
|
||||
}
|
||||
if (measureText3 >= f) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (measureText3 != measureText) {
|
||||
return true;
|
||||
}
|
||||
Pair<Rect, Rect> obtainEmptyRects = obtainEmptyRects();
|
||||
paint.getTextBounds(TOFU_STRING, 0, 2, obtainEmptyRects.first);
|
||||
paint.getTextBounds(str, 0, length, obtainEmptyRects.second);
|
||||
return !obtainEmptyRects.first.equals(obtainEmptyRects.second);
|
||||
}
|
||||
|
||||
public static boolean setBlendMode(Paint paint, BlendModeCompat blendModeCompat) {
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
Api29Impl.setBlendMode(paint, blendModeCompat != null ? BlendModeUtils.Api29Impl.obtainBlendModeFromCompat(blendModeCompat) : null);
|
||||
return true;
|
||||
}
|
||||
if (blendModeCompat != null) {
|
||||
PorterDuff.Mode obtainPorterDuffFromCompat = BlendModeUtils.obtainPorterDuffFromCompat(blendModeCompat);
|
||||
paint.setXfermode(obtainPorterDuffFromCompat != null ? new PorterDuffXfermode(obtainPorterDuffFromCompat) : null);
|
||||
return obtainPorterDuffFromCompat != null;
|
||||
}
|
||||
paint.setXfermode(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Pair<Rect, Rect> obtainEmptyRects() {
|
||||
ThreadLocal<Pair<Rect, Rect>> threadLocal = sRectThreadLocal;
|
||||
Pair<Rect, Rect> pair = threadLocal.get();
|
||||
if (pair == null) {
|
||||
Pair<Rect, Rect> pair2 = new Pair<>(new Rect(), new Rect());
|
||||
threadLocal.set(pair2);
|
||||
return pair2;
|
||||
}
|
||||
pair.first.setEmpty();
|
||||
pair.second.setEmpty();
|
||||
return pair;
|
||||
}
|
||||
|
||||
private PaintCompat() {
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static void setBlendMode(Paint paint, Object obj) {
|
||||
paint.setBlendMode((BlendMode) obj);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static boolean hasGlyph(Paint paint, String str) {
|
||||
return paint.hasGlyph(str);
|
||||
}
|
||||
}
|
||||
}
|
15
02-Easy5/E5/sources/androidx/core/graphics/PaintKt.java
Normal file
15
02-Easy5/E5/sources/androidx/core/graphics/PaintKt.java
Normal file
@ -0,0 +1,15 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Paint.kt */
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u0017\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\b\u0010\u0003\u001a\u0004\u0018\u00010\u0004H\u0086\b¨\u0006\u0005"}, d2 = {"setBlendMode", "", "Landroid/graphics/Paint;", "blendModeCompat", "Landroidx/core/graphics/BlendModeCompat;", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class PaintKt {
|
||||
public static final boolean setBlendMode(Paint paint, BlendModeCompat blendModeCompat) {
|
||||
Intrinsics.checkNotNullParameter(paint, "<this>");
|
||||
return PaintCompat.setBlendMode(paint, blendModeCompat);
|
||||
}
|
||||
}
|
65
02-Easy5/E5/sources/androidx/core/graphics/PathKt.java
Normal file
65
02-Easy5/E5/sources/androidx/core/graphics/PathKt.java
Normal file
@ -0,0 +1,65 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Path;
|
||||
import java.util.Collection;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Path.kt */
|
||||
@Metadata(d1 = {"\u0000\u001c\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u001c\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0005\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0087\f\u001a\u001c\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004*\u00020\u00012\b\b\u0002\u0010\u0006\u001a\u00020\u0007H\u0007\u001a\u0015\u0010\b\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0087\n\u001a\u0015\u0010\t\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0087\f\u001a\u0015\u0010\n\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0087\n\u001a\u0015\u0010\u000b\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0087\f¨\u0006\f"}, d2 = {"and", "Landroid/graphics/Path;", "p", "flatten", "", "Landroidx/core/graphics/PathSegment;", "error", "", "minus", "or", "plus", "xor", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class PathKt {
|
||||
public static /* synthetic */ Iterable flatten$default(Path path, float f, int i, Object obj) {
|
||||
if ((i & 1) != 0) {
|
||||
f = 0.5f;
|
||||
}
|
||||
return flatten(path, f);
|
||||
}
|
||||
|
||||
public static final Iterable<PathSegment> flatten(Path path, float f) {
|
||||
Intrinsics.checkNotNullParameter(path, "<this>");
|
||||
Collection<PathSegment> flatten = PathUtils.flatten(path, f);
|
||||
Intrinsics.checkNotNullExpressionValue(flatten, "flatten(this, error)");
|
||||
return flatten;
|
||||
}
|
||||
|
||||
public static final Path plus(Path path, Path p) {
|
||||
Intrinsics.checkNotNullParameter(path, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
Path path2 = new Path(path);
|
||||
path2.op(p, Path.Op.UNION);
|
||||
return path2;
|
||||
}
|
||||
|
||||
public static final Path minus(Path path, Path p) {
|
||||
Intrinsics.checkNotNullParameter(path, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
Path path2 = new Path(path);
|
||||
path2.op(p, Path.Op.DIFFERENCE);
|
||||
return path2;
|
||||
}
|
||||
|
||||
public static final Path and(Path path, Path p) {
|
||||
Intrinsics.checkNotNullParameter(path, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
Path path2 = new Path();
|
||||
path2.op(path, p, Path.Op.INTERSECT);
|
||||
return path2;
|
||||
}
|
||||
|
||||
public static final Path xor(Path path, Path p) {
|
||||
Intrinsics.checkNotNullParameter(path, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
Path path2 = new Path(path);
|
||||
path2.op(p, Path.Op.XOR);
|
||||
return path2;
|
||||
}
|
||||
|
||||
public static final Path or(Path path, Path p) {
|
||||
Intrinsics.checkNotNullParameter(path, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
Path path2 = new Path(path);
|
||||
path2.op(p, Path.Op.UNION);
|
||||
return path2;
|
||||
}
|
||||
}
|
638
02-Easy5/E5/sources/androidx/core/graphics/PathParser.java
Normal file
638
02-Easy5/E5/sources/androidx/core/graphics/PathParser.java
Normal file
@ -0,0 +1,638 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Path;
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PathParser {
|
||||
private static final String LOGTAG = "PathParser";
|
||||
|
||||
static float[] copyOfRange(float[] fArr, int i, int i2) {
|
||||
if (i > i2) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
int length = fArr.length;
|
||||
if (i < 0 || i > length) {
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
int i3 = i2 - i;
|
||||
int min = Math.min(i3, length - i);
|
||||
float[] fArr2 = new float[i3];
|
||||
System.arraycopy(fArr, i, fArr2, 0, min);
|
||||
return fArr2;
|
||||
}
|
||||
|
||||
public static Path createPathFromPathData(String str) {
|
||||
Path path = new Path();
|
||||
PathDataNode[] createNodesFromPathData = createNodesFromPathData(str);
|
||||
if (createNodesFromPathData == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
PathDataNode.nodesToPath(createNodesFromPathData, path);
|
||||
return path;
|
||||
} catch (RuntimeException e) {
|
||||
throw new RuntimeException("Error in parsing " + str, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static PathDataNode[] createNodesFromPathData(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
int i = 1;
|
||||
int i2 = 0;
|
||||
while (i < str.length()) {
|
||||
int nextStart = nextStart(str, i);
|
||||
String trim = str.substring(i2, nextStart).trim();
|
||||
if (trim.length() > 0) {
|
||||
addNode(arrayList, trim.charAt(0), getFloats(trim));
|
||||
}
|
||||
i2 = nextStart;
|
||||
i = nextStart + 1;
|
||||
}
|
||||
if (i - i2 == 1 && i2 < str.length()) {
|
||||
addNode(arrayList, str.charAt(i2), new float[0]);
|
||||
}
|
||||
return (PathDataNode[]) arrayList.toArray(new PathDataNode[arrayList.size()]);
|
||||
}
|
||||
|
||||
public static PathDataNode[] deepCopyNodes(PathDataNode[] pathDataNodeArr) {
|
||||
if (pathDataNodeArr == null) {
|
||||
return null;
|
||||
}
|
||||
PathDataNode[] pathDataNodeArr2 = new PathDataNode[pathDataNodeArr.length];
|
||||
for (int i = 0; i < pathDataNodeArr.length; i++) {
|
||||
pathDataNodeArr2[i] = new PathDataNode(pathDataNodeArr[i]);
|
||||
}
|
||||
return pathDataNodeArr2;
|
||||
}
|
||||
|
||||
public static boolean canMorph(PathDataNode[] pathDataNodeArr, PathDataNode[] pathDataNodeArr2) {
|
||||
if (pathDataNodeArr == null || pathDataNodeArr2 == null || pathDataNodeArr.length != pathDataNodeArr2.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < pathDataNodeArr.length; i++) {
|
||||
if (pathDataNodeArr[i].mType != pathDataNodeArr2[i].mType || pathDataNodeArr[i].mParams.length != pathDataNodeArr2[i].mParams.length) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void updateNodes(PathDataNode[] pathDataNodeArr, PathDataNode[] pathDataNodeArr2) {
|
||||
for (int i = 0; i < pathDataNodeArr2.length; i++) {
|
||||
pathDataNodeArr[i].mType = pathDataNodeArr2[i].mType;
|
||||
for (int i2 = 0; i2 < pathDataNodeArr2[i].mParams.length; i2++) {
|
||||
pathDataNodeArr[i].mParams[i2] = pathDataNodeArr2[i].mParams[i2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int nextStart(String str, int i) {
|
||||
while (i < str.length()) {
|
||||
char charAt = str.charAt(i);
|
||||
if (((charAt - 'A') * (charAt - 'Z') <= 0 || (charAt - 'a') * (charAt - 'z') <= 0) && charAt != 'e' && charAt != 'E') {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
private static void addNode(ArrayList<PathDataNode> arrayList, char c, float[] fArr) {
|
||||
arrayList.add(new PathDataNode(c, fArr));
|
||||
}
|
||||
|
||||
private static class ExtractFloatResult {
|
||||
int mEndPosition;
|
||||
boolean mEndWithNegOrDot;
|
||||
|
||||
ExtractFloatResult() {
|
||||
}
|
||||
}
|
||||
|
||||
private static float[] getFloats(String str) {
|
||||
if (str.charAt(0) == 'z' || str.charAt(0) == 'Z') {
|
||||
return new float[0];
|
||||
}
|
||||
try {
|
||||
float[] fArr = new float[str.length()];
|
||||
ExtractFloatResult extractFloatResult = new ExtractFloatResult();
|
||||
int length = str.length();
|
||||
int i = 1;
|
||||
int i2 = 0;
|
||||
while (i < length) {
|
||||
extract(str, i, extractFloatResult);
|
||||
int i3 = extractFloatResult.mEndPosition;
|
||||
if (i < i3) {
|
||||
fArr[i2] = Float.parseFloat(str.substring(i, i3));
|
||||
i2++;
|
||||
}
|
||||
i = extractFloatResult.mEndWithNegOrDot ? i3 : i3 + 1;
|
||||
}
|
||||
return copyOfRange(fArr, 0, i2);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RuntimeException("error in parsing \"" + str + "\"", e);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x003a A[LOOP:0: B:2:0x0007->B:14:0x003a, LOOP_END] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x003d A[SYNTHETIC] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
private static void extract(java.lang.String r8, int r9, androidx.core.graphics.PathParser.ExtractFloatResult r10) {
|
||||
/*
|
||||
r0 = 0
|
||||
r10.mEndWithNegOrDot = r0
|
||||
r1 = r9
|
||||
r2 = 0
|
||||
r3 = 0
|
||||
r4 = 0
|
||||
L7:
|
||||
int r5 = r8.length()
|
||||
if (r1 >= r5) goto L3d
|
||||
char r5 = r8.charAt(r1)
|
||||
r6 = 32
|
||||
r7 = 1
|
||||
if (r5 == r6) goto L35
|
||||
r6 = 69
|
||||
if (r5 == r6) goto L33
|
||||
r6 = 101(0x65, float:1.42E-43)
|
||||
if (r5 == r6) goto L33
|
||||
switch(r5) {
|
||||
case 44: goto L35;
|
||||
case 45: goto L2a;
|
||||
case 46: goto L22;
|
||||
default: goto L21;
|
||||
}
|
||||
L21:
|
||||
goto L31
|
||||
L22:
|
||||
if (r3 != 0) goto L27
|
||||
r2 = 0
|
||||
r3 = 1
|
||||
goto L37
|
||||
L27:
|
||||
r10.mEndWithNegOrDot = r7
|
||||
goto L35
|
||||
L2a:
|
||||
if (r1 == r9) goto L31
|
||||
if (r2 != 0) goto L31
|
||||
r10.mEndWithNegOrDot = r7
|
||||
goto L35
|
||||
L31:
|
||||
r2 = 0
|
||||
goto L37
|
||||
L33:
|
||||
r2 = 1
|
||||
goto L37
|
||||
L35:
|
||||
r2 = 0
|
||||
r4 = 1
|
||||
L37:
|
||||
if (r4 == 0) goto L3a
|
||||
goto L3d
|
||||
L3a:
|
||||
int r1 = r1 + 1
|
||||
goto L7
|
||||
L3d:
|
||||
r10.mEndPosition = r1
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.core.graphics.PathParser.extract(java.lang.String, int, androidx.core.graphics.PathParser$ExtractFloatResult):void");
|
||||
}
|
||||
|
||||
public static boolean interpolatePathDataNodes(PathDataNode[] pathDataNodeArr, PathDataNode[] pathDataNodeArr2, PathDataNode[] pathDataNodeArr3, float f) {
|
||||
if (pathDataNodeArr == null || pathDataNodeArr2 == null || pathDataNodeArr3 == null) {
|
||||
throw new IllegalArgumentException("The nodes to be interpolated and resulting nodes cannot be null");
|
||||
}
|
||||
if (pathDataNodeArr.length != pathDataNodeArr2.length || pathDataNodeArr2.length != pathDataNodeArr3.length) {
|
||||
throw new IllegalArgumentException("The nodes to be interpolated and resulting nodes must have the same length");
|
||||
}
|
||||
if (!canMorph(pathDataNodeArr2, pathDataNodeArr3)) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < pathDataNodeArr.length; i++) {
|
||||
pathDataNodeArr[i].interpolatePathDataNode(pathDataNodeArr2[i], pathDataNodeArr3[i], f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class PathDataNode {
|
||||
public float[] mParams;
|
||||
public char mType;
|
||||
|
||||
PathDataNode(char c, float[] fArr) {
|
||||
this.mType = c;
|
||||
this.mParams = fArr;
|
||||
}
|
||||
|
||||
PathDataNode(PathDataNode pathDataNode) {
|
||||
this.mType = pathDataNode.mType;
|
||||
float[] fArr = pathDataNode.mParams;
|
||||
this.mParams = PathParser.copyOfRange(fArr, 0, fArr.length);
|
||||
}
|
||||
|
||||
public static void nodesToPath(PathDataNode[] pathDataNodeArr, Path path) {
|
||||
float[] fArr = new float[6];
|
||||
char c = 'm';
|
||||
for (int i = 0; i < pathDataNodeArr.length; i++) {
|
||||
PathDataNode pathDataNode = pathDataNodeArr[i];
|
||||
addCommand(path, fArr, c, pathDataNode.mType, pathDataNode.mParams);
|
||||
c = pathDataNodeArr[i].mType;
|
||||
}
|
||||
}
|
||||
|
||||
public void interpolatePathDataNode(PathDataNode pathDataNode, PathDataNode pathDataNode2, float f) {
|
||||
this.mType = pathDataNode.mType;
|
||||
int i = 0;
|
||||
while (true) {
|
||||
float[] fArr = pathDataNode.mParams;
|
||||
if (i >= fArr.length) {
|
||||
return;
|
||||
}
|
||||
this.mParams[i] = (fArr[i] * (1.0f - f)) + (pathDataNode2.mParams[i] * f);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
private static void addCommand(Path path, float[] fArr, char c, char c2, float[] fArr2) {
|
||||
int i;
|
||||
int i2;
|
||||
float f;
|
||||
float f2;
|
||||
float f3;
|
||||
float f4;
|
||||
float f5;
|
||||
float f6;
|
||||
float f7;
|
||||
float f8;
|
||||
char c3 = c2;
|
||||
float f9 = fArr[0];
|
||||
float f10 = fArr[1];
|
||||
float f11 = fArr[2];
|
||||
float f12 = fArr[3];
|
||||
float f13 = fArr[4];
|
||||
float f14 = fArr[5];
|
||||
switch (c3) {
|
||||
case 'A':
|
||||
case 'a':
|
||||
i = 7;
|
||||
break;
|
||||
case 'C':
|
||||
case 'c':
|
||||
i = 6;
|
||||
break;
|
||||
case 'H':
|
||||
case 'V':
|
||||
case 'h':
|
||||
case 'v':
|
||||
i = 1;
|
||||
break;
|
||||
case 'L':
|
||||
case 'M':
|
||||
case 'T':
|
||||
case 'l':
|
||||
case 'm':
|
||||
case 't':
|
||||
default:
|
||||
i = 2;
|
||||
break;
|
||||
case 'Q':
|
||||
case 'S':
|
||||
case 'q':
|
||||
case 's':
|
||||
i = 4;
|
||||
break;
|
||||
case 'Z':
|
||||
case 'z':
|
||||
path.close();
|
||||
path.moveTo(f13, f14);
|
||||
f9 = f13;
|
||||
f11 = f9;
|
||||
f10 = f14;
|
||||
f12 = f10;
|
||||
i = 2;
|
||||
break;
|
||||
}
|
||||
float f15 = f9;
|
||||
float f16 = f10;
|
||||
float f17 = f13;
|
||||
float f18 = f14;
|
||||
int i3 = 0;
|
||||
char c4 = c;
|
||||
while (i3 < fArr2.length) {
|
||||
if (c3 != 'A') {
|
||||
if (c3 == 'C') {
|
||||
i2 = i3;
|
||||
int i4 = i2 + 2;
|
||||
int i5 = i2 + 3;
|
||||
int i6 = i2 + 4;
|
||||
int i7 = i2 + 5;
|
||||
path.cubicTo(fArr2[i2], fArr2[i2 + 1], fArr2[i4], fArr2[i5], fArr2[i6], fArr2[i7]);
|
||||
f15 = fArr2[i6];
|
||||
float f19 = fArr2[i7];
|
||||
float f20 = fArr2[i4];
|
||||
float f21 = fArr2[i5];
|
||||
f16 = f19;
|
||||
f12 = f21;
|
||||
f11 = f20;
|
||||
} else if (c3 == 'H') {
|
||||
i2 = i3;
|
||||
path.lineTo(fArr2[i2], f16);
|
||||
f15 = fArr2[i2];
|
||||
} else if (c3 == 'Q') {
|
||||
i2 = i3;
|
||||
int i8 = i2 + 1;
|
||||
int i9 = i2 + 2;
|
||||
int i10 = i2 + 3;
|
||||
path.quadTo(fArr2[i2], fArr2[i8], fArr2[i9], fArr2[i10]);
|
||||
float f22 = fArr2[i2];
|
||||
float f23 = fArr2[i8];
|
||||
f15 = fArr2[i9];
|
||||
f16 = fArr2[i10];
|
||||
f11 = f22;
|
||||
f12 = f23;
|
||||
} else if (c3 == 'V') {
|
||||
i2 = i3;
|
||||
path.lineTo(f15, fArr2[i2]);
|
||||
f16 = fArr2[i2];
|
||||
} else if (c3 != 'a') {
|
||||
if (c3 != 'c') {
|
||||
if (c3 == 'h') {
|
||||
path.rLineTo(fArr2[i3], 0.0f);
|
||||
f15 += fArr2[i3];
|
||||
} else if (c3 != 'q') {
|
||||
if (c3 == 'v') {
|
||||
path.rLineTo(0.0f, fArr2[i3]);
|
||||
f4 = fArr2[i3];
|
||||
} else if (c3 == 'L') {
|
||||
int i11 = i3 + 1;
|
||||
path.lineTo(fArr2[i3], fArr2[i11]);
|
||||
f15 = fArr2[i3];
|
||||
f16 = fArr2[i11];
|
||||
} else if (c3 == 'M') {
|
||||
f15 = fArr2[i3];
|
||||
f16 = fArr2[i3 + 1];
|
||||
if (i3 > 0) {
|
||||
path.lineTo(f15, f16);
|
||||
} else {
|
||||
path.moveTo(f15, f16);
|
||||
i2 = i3;
|
||||
f18 = f16;
|
||||
f17 = f15;
|
||||
}
|
||||
} else if (c3 == 'S') {
|
||||
if (c4 == 'c' || c4 == 's' || c4 == 'C' || c4 == 'S') {
|
||||
f15 = (f15 * 2.0f) - f11;
|
||||
f16 = (f16 * 2.0f) - f12;
|
||||
}
|
||||
float f24 = f15;
|
||||
int i12 = i3 + 1;
|
||||
int i13 = i3 + 2;
|
||||
int i14 = i3 + 3;
|
||||
path.cubicTo(f24, f16, fArr2[i3], fArr2[i12], fArr2[i13], fArr2[i14]);
|
||||
f = fArr2[i3];
|
||||
f2 = fArr2[i12];
|
||||
f15 = fArr2[i13];
|
||||
f16 = fArr2[i14];
|
||||
f11 = f;
|
||||
f12 = f2;
|
||||
} else if (c3 == 'T') {
|
||||
if (c4 == 'q' || c4 == 't' || c4 == 'Q' || c4 == 'T') {
|
||||
f15 = (f15 * 2.0f) - f11;
|
||||
f16 = (f16 * 2.0f) - f12;
|
||||
}
|
||||
int i15 = i3 + 1;
|
||||
path.quadTo(f15, f16, fArr2[i3], fArr2[i15]);
|
||||
i2 = i3;
|
||||
f12 = f16;
|
||||
f11 = f15;
|
||||
f15 = fArr2[i3];
|
||||
f16 = fArr2[i15];
|
||||
} else if (c3 == 'l') {
|
||||
int i16 = i3 + 1;
|
||||
path.rLineTo(fArr2[i3], fArr2[i16]);
|
||||
f15 += fArr2[i3];
|
||||
f4 = fArr2[i16];
|
||||
} else if (c3 == 'm') {
|
||||
float f25 = fArr2[i3];
|
||||
f15 += f25;
|
||||
float f26 = fArr2[i3 + 1];
|
||||
f16 += f26;
|
||||
if (i3 > 0) {
|
||||
path.rLineTo(f25, f26);
|
||||
} else {
|
||||
path.rMoveTo(f25, f26);
|
||||
i2 = i3;
|
||||
f18 = f16;
|
||||
f17 = f15;
|
||||
}
|
||||
} else if (c3 == 's') {
|
||||
if (c4 == 'c' || c4 == 's' || c4 == 'C' || c4 == 'S') {
|
||||
float f27 = f15 - f11;
|
||||
f5 = f16 - f12;
|
||||
f6 = f27;
|
||||
} else {
|
||||
f6 = 0.0f;
|
||||
f5 = 0.0f;
|
||||
}
|
||||
int i17 = i3 + 1;
|
||||
int i18 = i3 + 2;
|
||||
int i19 = i3 + 3;
|
||||
path.rCubicTo(f6, f5, fArr2[i3], fArr2[i17], fArr2[i18], fArr2[i19]);
|
||||
f = fArr2[i3] + f15;
|
||||
f2 = fArr2[i17] + f16;
|
||||
f15 += fArr2[i18];
|
||||
f3 = fArr2[i19];
|
||||
} else if (c3 == 't') {
|
||||
if (c4 == 'q' || c4 == 't' || c4 == 'Q' || c4 == 'T') {
|
||||
f7 = f15 - f11;
|
||||
f8 = f16 - f12;
|
||||
} else {
|
||||
f8 = 0.0f;
|
||||
f7 = 0.0f;
|
||||
}
|
||||
int i20 = i3 + 1;
|
||||
path.rQuadTo(f7, f8, fArr2[i3], fArr2[i20]);
|
||||
float f28 = f7 + f15;
|
||||
float f29 = f8 + f16;
|
||||
f15 += fArr2[i3];
|
||||
f16 += fArr2[i20];
|
||||
f12 = f29;
|
||||
f11 = f28;
|
||||
}
|
||||
f16 += f4;
|
||||
} else {
|
||||
int i21 = i3 + 1;
|
||||
int i22 = i3 + 2;
|
||||
int i23 = i3 + 3;
|
||||
path.rQuadTo(fArr2[i3], fArr2[i21], fArr2[i22], fArr2[i23]);
|
||||
f = fArr2[i3] + f15;
|
||||
f2 = fArr2[i21] + f16;
|
||||
f15 += fArr2[i22];
|
||||
f3 = fArr2[i23];
|
||||
}
|
||||
i2 = i3;
|
||||
} else {
|
||||
int i24 = i3 + 2;
|
||||
int i25 = i3 + 3;
|
||||
int i26 = i3 + 4;
|
||||
int i27 = i3 + 5;
|
||||
path.rCubicTo(fArr2[i3], fArr2[i3 + 1], fArr2[i24], fArr2[i25], fArr2[i26], fArr2[i27]);
|
||||
f = fArr2[i24] + f15;
|
||||
f2 = fArr2[i25] + f16;
|
||||
f15 += fArr2[i26];
|
||||
f3 = fArr2[i27];
|
||||
}
|
||||
f16 += f3;
|
||||
f11 = f;
|
||||
f12 = f2;
|
||||
i2 = i3;
|
||||
} else {
|
||||
int i28 = i3 + 5;
|
||||
int i29 = i3 + 6;
|
||||
i2 = i3;
|
||||
drawArc(path, f15, f16, fArr2[i28] + f15, fArr2[i29] + f16, fArr2[i3], fArr2[i3 + 1], fArr2[i3 + 2], fArr2[i3 + 3] != 0.0f, fArr2[i3 + 4] != 0.0f);
|
||||
f15 += fArr2[i28];
|
||||
f16 += fArr2[i29];
|
||||
}
|
||||
i3 = i2 + i;
|
||||
c4 = c2;
|
||||
c3 = c4;
|
||||
} else {
|
||||
i2 = i3;
|
||||
int i30 = i2 + 5;
|
||||
int i31 = i2 + 6;
|
||||
drawArc(path, f15, f16, fArr2[i30], fArr2[i31], fArr2[i2], fArr2[i2 + 1], fArr2[i2 + 2], fArr2[i2 + 3] != 0.0f, fArr2[i2 + 4] != 0.0f);
|
||||
f15 = fArr2[i30];
|
||||
f16 = fArr2[i31];
|
||||
}
|
||||
f12 = f16;
|
||||
f11 = f15;
|
||||
i3 = i2 + i;
|
||||
c4 = c2;
|
||||
c3 = c4;
|
||||
}
|
||||
fArr[0] = f15;
|
||||
fArr[1] = f16;
|
||||
fArr[2] = f11;
|
||||
fArr[3] = f12;
|
||||
fArr[4] = f17;
|
||||
fArr[5] = f18;
|
||||
}
|
||||
|
||||
private static void drawArc(Path path, float f, float f2, float f3, float f4, float f5, float f6, float f7, boolean z, boolean z2) {
|
||||
double d;
|
||||
double d2;
|
||||
double radians = Math.toRadians(f7);
|
||||
double cos = Math.cos(radians);
|
||||
double sin = Math.sin(radians);
|
||||
double d3 = f;
|
||||
double d4 = d3 * cos;
|
||||
double d5 = f2;
|
||||
double d6 = f5;
|
||||
double d7 = (d4 + (d5 * sin)) / d6;
|
||||
double d8 = ((-f) * sin) + (d5 * cos);
|
||||
double d9 = f6;
|
||||
double d10 = d8 / d9;
|
||||
double d11 = f4;
|
||||
double d12 = ((f3 * cos) + (d11 * sin)) / d6;
|
||||
double d13 = (((-f3) * sin) + (d11 * cos)) / d9;
|
||||
double d14 = d7 - d12;
|
||||
double d15 = d10 - d13;
|
||||
double d16 = (d7 + d12) / 2.0d;
|
||||
double d17 = (d10 + d13) / 2.0d;
|
||||
double d18 = (d14 * d14) + (d15 * d15);
|
||||
if (d18 == 0.0d) {
|
||||
Log.w(PathParser.LOGTAG, " Points are coincident");
|
||||
return;
|
||||
}
|
||||
double d19 = (1.0d / d18) - 0.25d;
|
||||
if (d19 < 0.0d) {
|
||||
Log.w(PathParser.LOGTAG, "Points are too far apart " + d18);
|
||||
float sqrt = (float) (Math.sqrt(d18) / 1.99999d);
|
||||
drawArc(path, f, f2, f3, f4, f5 * sqrt, f6 * sqrt, f7, z, z2);
|
||||
return;
|
||||
}
|
||||
double sqrt2 = Math.sqrt(d19);
|
||||
double d20 = d14 * sqrt2;
|
||||
double d21 = sqrt2 * d15;
|
||||
if (z == z2) {
|
||||
d = d16 - d21;
|
||||
d2 = d17 + d20;
|
||||
} else {
|
||||
d = d16 + d21;
|
||||
d2 = d17 - d20;
|
||||
}
|
||||
double atan2 = Math.atan2(d10 - d2, d7 - d);
|
||||
double atan22 = Math.atan2(d13 - d2, d12 - d) - atan2;
|
||||
if (z2 != (atan22 >= 0.0d)) {
|
||||
atan22 = atan22 > 0.0d ? atan22 - 6.283185307179586d : atan22 + 6.283185307179586d;
|
||||
}
|
||||
double d22 = d * d6;
|
||||
double d23 = d2 * d9;
|
||||
arcToBezier(path, (d22 * cos) - (d23 * sin), (d22 * sin) + (d23 * cos), d6, d9, d3, d5, radians, atan2, atan22);
|
||||
}
|
||||
|
||||
private static void arcToBezier(Path path, double d, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9) {
|
||||
double d10 = d3;
|
||||
int ceil = (int) Math.ceil(Math.abs((d9 * 4.0d) / 3.141592653589793d));
|
||||
double cos = Math.cos(d7);
|
||||
double sin = Math.sin(d7);
|
||||
double cos2 = Math.cos(d8);
|
||||
double sin2 = Math.sin(d8);
|
||||
double d11 = -d10;
|
||||
double d12 = d11 * cos;
|
||||
double d13 = d4 * sin;
|
||||
double d14 = (d12 * sin2) - (d13 * cos2);
|
||||
double d15 = d11 * sin;
|
||||
double d16 = d4 * cos;
|
||||
double d17 = (sin2 * d15) + (cos2 * d16);
|
||||
double d18 = d9 / ceil;
|
||||
double d19 = d8;
|
||||
double d20 = d17;
|
||||
double d21 = d14;
|
||||
int i = 0;
|
||||
double d22 = d5;
|
||||
double d23 = d6;
|
||||
while (i < ceil) {
|
||||
double d24 = d19 + d18;
|
||||
double sin3 = Math.sin(d24);
|
||||
double cos3 = Math.cos(d24);
|
||||
double d25 = (d + ((d10 * cos) * cos3)) - (d13 * sin3);
|
||||
double d26 = d2 + (d10 * sin * cos3) + (d16 * sin3);
|
||||
double d27 = (d12 * sin3) - (d13 * cos3);
|
||||
double d28 = (sin3 * d15) + (cos3 * d16);
|
||||
double d29 = d24 - d19;
|
||||
double tan = Math.tan(d29 / 2.0d);
|
||||
double sin4 = (Math.sin(d29) * (Math.sqrt(((tan * 3.0d) * tan) + 4.0d) - 1.0d)) / 3.0d;
|
||||
double d30 = d22 + (d21 * sin4);
|
||||
path.rLineTo(0.0f, 0.0f);
|
||||
path.cubicTo((float) d30, (float) (d23 + (d20 * sin4)), (float) (d25 - (sin4 * d27)), (float) (d26 - (sin4 * d28)), (float) d25, (float) d26);
|
||||
i++;
|
||||
d18 = d18;
|
||||
sin = sin;
|
||||
d22 = d25;
|
||||
d15 = d15;
|
||||
cos = cos;
|
||||
d19 = d24;
|
||||
d20 = d28;
|
||||
d21 = d27;
|
||||
ceil = ceil;
|
||||
d23 = d26;
|
||||
d10 = d3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PathParser() {
|
||||
}
|
||||
}
|
58
02-Easy5/E5/sources/androidx/core/graphics/PathSegment.java
Normal file
58
02-Easy5/E5/sources/androidx/core/graphics/PathSegment.java
Normal file
@ -0,0 +1,58 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.PointF;
|
||||
import androidx.core.util.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class PathSegment {
|
||||
private final PointF mEnd;
|
||||
private final float mEndFraction;
|
||||
private final PointF mStart;
|
||||
private final float mStartFraction;
|
||||
|
||||
public PointF getEnd() {
|
||||
return this.mEnd;
|
||||
}
|
||||
|
||||
public float getEndFraction() {
|
||||
return this.mEndFraction;
|
||||
}
|
||||
|
||||
public PointF getStart() {
|
||||
return this.mStart;
|
||||
}
|
||||
|
||||
public float getStartFraction() {
|
||||
return this.mStartFraction;
|
||||
}
|
||||
|
||||
public PathSegment(PointF pointF, float f, PointF pointF2, float f2) {
|
||||
this.mStart = (PointF) Preconditions.checkNotNull(pointF, "start == null");
|
||||
this.mStartFraction = f;
|
||||
this.mEnd = (PointF) Preconditions.checkNotNull(pointF2, "end == null");
|
||||
this.mEndFraction = f2;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof PathSegment)) {
|
||||
return false;
|
||||
}
|
||||
PathSegment pathSegment = (PathSegment) obj;
|
||||
return Float.compare(this.mStartFraction, pathSegment.mStartFraction) == 0 && Float.compare(this.mEndFraction, pathSegment.mEndFraction) == 0 && this.mStart.equals(pathSegment.mStart) && this.mEnd.equals(pathSegment.mEnd);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hashCode = this.mStart.hashCode() * 31;
|
||||
float f = this.mStartFraction;
|
||||
int floatToIntBits = (((hashCode + (f != 0.0f ? Float.floatToIntBits(f) : 0)) * 31) + this.mEnd.hashCode()) * 31;
|
||||
float f2 = this.mEndFraction;
|
||||
return floatToIntBits + (f2 != 0.0f ? Float.floatToIntBits(f2) : 0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "PathSegment{start=" + this.mStart + ", startFraction=" + this.mStartFraction + ", end=" + this.mEnd + ", endFraction=" + this.mEndFraction + '}';
|
||||
}
|
||||
}
|
45
02-Easy5/E5/sources/androidx/core/graphics/PathUtils.java
Normal file
45
02-Easy5/E5/sources/androidx/core/graphics/PathUtils.java
Normal file
@ -0,0 +1,45 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PointF;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class PathUtils {
|
||||
public static Collection<PathSegment> flatten(Path path) {
|
||||
return flatten(path, 0.5f);
|
||||
}
|
||||
|
||||
public static Collection<PathSegment> flatten(Path path, float f) {
|
||||
float[] approximate = Api26Impl.approximate(path, f);
|
||||
int length = approximate.length / 3;
|
||||
ArrayList arrayList = new ArrayList(length);
|
||||
for (int i = 1; i < length; i++) {
|
||||
int i2 = i * 3;
|
||||
int i3 = (i - 1) * 3;
|
||||
float f2 = approximate[i2];
|
||||
float f3 = approximate[i2 + 1];
|
||||
float f4 = approximate[i2 + 2];
|
||||
float f5 = approximate[i3];
|
||||
float f6 = approximate[i3 + 1];
|
||||
float f7 = approximate[i3 + 2];
|
||||
if (f2 != f5 && (f3 != f6 || f4 != f7)) {
|
||||
arrayList.add(new PathSegment(new PointF(f6, f7), f5, new PointF(f3, f4), f2));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private PathUtils() {
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static float[] approximate(Path path, float f) {
|
||||
return path.approximate(f);
|
||||
}
|
||||
}
|
||||
}
|
29
02-Easy5/E5/sources/androidx/core/graphics/PictureKt.java
Normal file
29
02-Easy5/E5/sources/androidx/core/graphics/PictureKt.java
Normal file
@ -0,0 +1,29 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Picture;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.internal.InlineMarker;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Picture.kt */
|
||||
@Metadata(d1 = {"\u0000\"\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\u001a9\u0010\u0000\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00032\u0017\u0010\u0005\u001a\u0013\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\b0\u0006¢\u0006\u0002\b\tH\u0086\bø\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\n"}, d2 = {"record", "Landroid/graphics/Picture;", "width", "", "height", "block", "Lkotlin/Function1;", "Landroid/graphics/Canvas;", "", "Lkotlin/ExtensionFunctionType;", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class PictureKt {
|
||||
public static final Picture record(Picture picture, int i, int i2, Function1<? super Canvas, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(picture, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
Canvas beginRecording = picture.beginRecording(i, i2);
|
||||
Intrinsics.checkNotNullExpressionValue(beginRecording, "beginRecording(width, height)");
|
||||
try {
|
||||
block.invoke(beginRecording);
|
||||
return picture;
|
||||
} finally {
|
||||
InlineMarker.finallyStart(1);
|
||||
picture.endRecording();
|
||||
InlineMarker.finallyEnd(1);
|
||||
}
|
||||
}
|
||||
}
|
113
02-Easy5/E5/sources/androidx/core/graphics/PointKt.java
Normal file
113
02-Easy5/E5/sources/androidx/core/graphics/PointKt.java
Normal file
@ -0,0 +1,113 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Point.kt */
|
||||
@Metadata(d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\u0010\u0007\n\u0002\u0018\u0002\n\u0002\b\t\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0086\n\u001a\r\u0010\u0000\u001a\u00020\u0003*\u00020\u0004H\u0086\n\u001a\r\u0010\u0005\u001a\u00020\u0001*\u00020\u0002H\u0086\n\u001a\r\u0010\u0005\u001a\u00020\u0003*\u00020\u0004H\u0086\n\u001a\u0015\u0010\u0006\u001a\u00020\u0002*\u00020\u00022\u0006\u0010\u0007\u001a\u00020\u0002H\u0086\n\u001a\u0015\u0010\u0006\u001a\u00020\u0002*\u00020\u00022\u0006\u0010\b\u001a\u00020\u0001H\u0086\n\u001a\u0015\u0010\u0006\u001a\u00020\u0004*\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0004H\u0086\n\u001a\u0015\u0010\u0006\u001a\u00020\u0004*\u00020\u00042\u0006\u0010\b\u001a\u00020\u0003H\u0086\n\u001a\u0015\u0010\t\u001a\u00020\u0002*\u00020\u00022\u0006\u0010\u0007\u001a\u00020\u0002H\u0086\n\u001a\u0015\u0010\t\u001a\u00020\u0002*\u00020\u00022\u0006\u0010\b\u001a\u00020\u0001H\u0086\n\u001a\u0015\u0010\t\u001a\u00020\u0004*\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0004H\u0086\n\u001a\u0015\u0010\t\u001a\u00020\u0004*\u00020\u00042\u0006\u0010\b\u001a\u00020\u0003H\u0086\n\u001a\r\u0010\n\u001a\u00020\u0002*\u00020\u0004H\u0086\b\u001a\r\u0010\u000b\u001a\u00020\u0004*\u00020\u0002H\u0086\b\u001a\r\u0010\f\u001a\u00020\u0002*\u00020\u0002H\u0086\n\u001a\r\u0010\f\u001a\u00020\u0004*\u00020\u0004H\u0086\n¨\u0006\r"}, d2 = {"component1", "", "Landroid/graphics/Point;", "", "Landroid/graphics/PointF;", "component2", "minus", "p", "xy", "plus", "toPoint", "toPointF", "unaryMinus", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class PointKt {
|
||||
public static final int component1(Point point) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
return point.x;
|
||||
}
|
||||
|
||||
public static final int component2(Point point) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
return point.y;
|
||||
}
|
||||
|
||||
public static final float component1(PointF pointF) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
return pointF.x;
|
||||
}
|
||||
|
||||
public static final float component2(PointF pointF) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
return pointF.y;
|
||||
}
|
||||
|
||||
public static final Point plus(Point point, Point p) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
Point point2 = new Point(point.x, point.y);
|
||||
point2.offset(p.x, p.y);
|
||||
return point2;
|
||||
}
|
||||
|
||||
public static final PointF plus(PointF pointF, PointF p) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
PointF pointF2 = new PointF(pointF.x, pointF.y);
|
||||
pointF2.offset(p.x, p.y);
|
||||
return pointF2;
|
||||
}
|
||||
|
||||
public static final Point plus(Point point, int i) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
Point point2 = new Point(point.x, point.y);
|
||||
point2.offset(i, i);
|
||||
return point2;
|
||||
}
|
||||
|
||||
public static final PointF plus(PointF pointF, float f) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
PointF pointF2 = new PointF(pointF.x, pointF.y);
|
||||
pointF2.offset(f, f);
|
||||
return pointF2;
|
||||
}
|
||||
|
||||
public static final Point minus(Point point, Point p) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
Point point2 = new Point(point.x, point.y);
|
||||
point2.offset(-p.x, -p.y);
|
||||
return point2;
|
||||
}
|
||||
|
||||
public static final PointF minus(PointF pointF, PointF p) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
PointF pointF2 = new PointF(pointF.x, pointF.y);
|
||||
pointF2.offset(-p.x, -p.y);
|
||||
return pointF2;
|
||||
}
|
||||
|
||||
public static final Point minus(Point point, int i) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
Point point2 = new Point(point.x, point.y);
|
||||
int i2 = -i;
|
||||
point2.offset(i2, i2);
|
||||
return point2;
|
||||
}
|
||||
|
||||
public static final PointF minus(PointF pointF, float f) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
PointF pointF2 = new PointF(pointF.x, pointF.y);
|
||||
float f2 = -f;
|
||||
pointF2.offset(f2, f2);
|
||||
return pointF2;
|
||||
}
|
||||
|
||||
public static final Point unaryMinus(Point point) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
return new Point(-point.x, -point.y);
|
||||
}
|
||||
|
||||
public static final PointF unaryMinus(PointF pointF) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
return new PointF(-pointF.x, -pointF.y);
|
||||
}
|
||||
|
||||
public static final PointF toPointF(Point point) {
|
||||
Intrinsics.checkNotNullParameter(point, "<this>");
|
||||
return new PointF(point);
|
||||
}
|
||||
|
||||
public static final Point toPoint(PointF pointF) {
|
||||
Intrinsics.checkNotNullParameter(pointF, "<this>");
|
||||
return new Point((int) pointF.x, (int) pointF.y);
|
||||
}
|
||||
}
|
23
02-Easy5/E5/sources/androidx/core/graphics/PorterDuffKt.java
Normal file
23
02-Easy5/E5/sources/androidx/core/graphics/PorterDuffKt.java
Normal file
@ -0,0 +1,23 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: PorterDuff.kt */
|
||||
@Metadata(d1 = {"\u0000\u0018\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b\u001a\r\u0010\u0005\u001a\u00020\u0006*\u00020\u0002H\u0086\b¨\u0006\u0007"}, d2 = {"toColorFilter", "Landroid/graphics/PorterDuffColorFilter;", "Landroid/graphics/PorterDuff$Mode;", TypedValues.Custom.S_COLOR, "", "toXfermode", "Landroid/graphics/PorterDuffXfermode;", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class PorterDuffKt {
|
||||
public static final PorterDuffXfermode toXfermode(PorterDuff.Mode mode) {
|
||||
Intrinsics.checkNotNullParameter(mode, "<this>");
|
||||
return new PorterDuffXfermode(mode);
|
||||
}
|
||||
|
||||
public static final PorterDuffColorFilter toColorFilter(PorterDuff.Mode mode, int i) {
|
||||
Intrinsics.checkNotNullParameter(mode, "<this>");
|
||||
return new PorterDuffColorFilter(i, mode);
|
||||
}
|
||||
}
|
279
02-Easy5/E5/sources/androidx/core/graphics/RectKt.java
Normal file
279
02-Easy5/E5/sources/androidx/core/graphics/RectKt.java
Normal file
@ -0,0 +1,279 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Rect.kt */
|
||||
@Metadata(d1 = {"\u0000<\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\u0010\u0007\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0087\f\u001a\u0015\u0010\u0000\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0002\u001a\u00020\u0003H\u0087\f\u001a\r\u0010\u0004\u001a\u00020\u0005*\u00020\u0001H\u0086\n\u001a\r\u0010\u0004\u001a\u00020\u0006*\u00020\u0003H\u0086\n\u001a\r\u0010\u0007\u001a\u00020\u0005*\u00020\u0001H\u0086\n\u001a\r\u0010\u0007\u001a\u00020\u0006*\u00020\u0003H\u0086\n\u001a\r\u0010\b\u001a\u00020\u0005*\u00020\u0001H\u0086\n\u001a\r\u0010\b\u001a\u00020\u0006*\u00020\u0003H\u0086\n\u001a\r\u0010\t\u001a\u00020\u0005*\u00020\u0001H\u0086\n\u001a\r\u0010\t\u001a\u00020\u0006*\u00020\u0003H\u0086\n\u001a\u0015\u0010\n\u001a\u00020\u000b*\u00020\u00012\u0006\u0010\f\u001a\u00020\rH\u0086\n\u001a\u0015\u0010\n\u001a\u00020\u000b*\u00020\u00032\u0006\u0010\f\u001a\u00020\u000eH\u0086\n\u001a\u0015\u0010\u000f\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0010\u001a\u00020\rH\u0086\n\u001a\u0015\u0010\u000f\u001a\u00020\u0011*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\n\u001a\u0015\u0010\u000f\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0010\u001a\u00020\u0005H\u0086\n\u001a\u0015\u0010\u000f\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0010\u001a\u00020\u000eH\u0086\n\u001a\u0015\u0010\u000f\u001a\u00020\u0011*\u00020\u00032\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\n\u001a\u0015\u0010\u000f\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0010\u001a\u00020\u0006H\u0086\n\u001a\u0015\u0010\u0012\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\f\u001a\u0015\u0010\u0012\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\f\u001a\u0015\u0010\u0013\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0010\u001a\u00020\rH\u0086\n\u001a\u0015\u0010\u0013\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\n\u001a\u0015\u0010\u0013\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0010\u001a\u00020\u0005H\u0086\n\u001a\u0015\u0010\u0013\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0010\u001a\u00020\u000eH\u0086\n\u001a\u0015\u0010\u0013\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\n\u001a\u0015\u0010\u0013\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0010\u001a\u00020\u0006H\u0086\n\u001a\u0015\u0010\u0014\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0015\u001a\u00020\u0005H\u0086\n\u001a\u0015\u0010\u0014\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0015\u001a\u00020\u0006H\u0086\n\u001a\u0015\u0010\u0014\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u0015\u001a\u00020\u0005H\u0086\n\u001a\r\u0010\u0016\u001a\u00020\u0001*\u00020\u0003H\u0086\b\u001a\r\u0010\u0017\u001a\u00020\u0003*\u00020\u0001H\u0086\b\u001a\r\u0010\u0018\u001a\u00020\u0011*\u00020\u0001H\u0086\b\u001a\r\u0010\u0018\u001a\u00020\u0011*\u00020\u0003H\u0086\b\u001a\u0015\u0010\u0019\u001a\u00020\u0003*\u00020\u00032\u0006\u0010\u001a\u001a\u00020\u001bH\u0086\b\u001a\u0015\u0010\u001c\u001a\u00020\u0011*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\f\u001a\u0015\u0010\u001c\u001a\u00020\u0011*\u00020\u00032\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\f¨\u0006\u001d"}, d2 = {"and", "Landroid/graphics/Rect;", "r", "Landroid/graphics/RectF;", "component1", "", "", "component2", "component3", "component4", "contains", "", "p", "Landroid/graphics/Point;", "Landroid/graphics/PointF;", "minus", "xy", "Landroid/graphics/Region;", "or", "plus", "times", "factor", "toRect", "toRectF", "toRegion", "transform", "m", "Landroid/graphics/Matrix;", "xor", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class RectKt {
|
||||
public static final int component1(Rect rect) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
return rect.left;
|
||||
}
|
||||
|
||||
public static final int component2(Rect rect) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
return rect.top;
|
||||
}
|
||||
|
||||
public static final int component3(Rect rect) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
return rect.right;
|
||||
}
|
||||
|
||||
public static final int component4(Rect rect) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
return rect.bottom;
|
||||
}
|
||||
|
||||
public static final float component1(RectF rectF) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
return rectF.left;
|
||||
}
|
||||
|
||||
public static final float component2(RectF rectF) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
return rectF.top;
|
||||
}
|
||||
|
||||
public static final float component3(RectF rectF) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
return rectF.right;
|
||||
}
|
||||
|
||||
public static final float component4(RectF rectF) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
return rectF.bottom;
|
||||
}
|
||||
|
||||
public static final Rect plus(Rect rect, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Rect rect2 = new Rect(rect);
|
||||
rect2.union(r);
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF plus(RectF rectF, RectF r) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.union(r);
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Rect plus(Rect rect, int i) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Rect rect2 = new Rect(rect);
|
||||
rect2.offset(i, i);
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF plus(RectF rectF, float f) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.offset(f, f);
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Rect plus(Rect rect, Point xy) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(xy, "xy");
|
||||
Rect rect2 = new Rect(rect);
|
||||
rect2.offset(xy.x, xy.y);
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF plus(RectF rectF, PointF xy) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(xy, "xy");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.offset(xy.x, xy.y);
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Region minus(Rect rect, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region = new Region(rect);
|
||||
region.op(r, Region.Op.DIFFERENCE);
|
||||
return region;
|
||||
}
|
||||
|
||||
public static final Region minus(RectF rectF, RectF r) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Rect rect = new Rect();
|
||||
rectF.roundOut(rect);
|
||||
Region region = new Region(rect);
|
||||
Rect rect2 = new Rect();
|
||||
r.roundOut(rect2);
|
||||
region.op(rect2, Region.Op.DIFFERENCE);
|
||||
return region;
|
||||
}
|
||||
|
||||
public static final Rect minus(Rect rect, int i) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Rect rect2 = new Rect(rect);
|
||||
int i2 = -i;
|
||||
rect2.offset(i2, i2);
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF minus(RectF rectF, float f) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
float f2 = -f;
|
||||
rectF2.offset(f2, f2);
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Rect minus(Rect rect, Point xy) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(xy, "xy");
|
||||
Rect rect2 = new Rect(rect);
|
||||
rect2.offset(-xy.x, -xy.y);
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF minus(RectF rectF, PointF xy) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(xy, "xy");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.offset(-xy.x, -xy.y);
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Rect times(Rect rect, int i) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Rect rect2 = new Rect(rect);
|
||||
rect2.top *= i;
|
||||
rect2.left *= i;
|
||||
rect2.right *= i;
|
||||
rect2.bottom *= i;
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF times(RectF rectF, float f) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.top *= f;
|
||||
rectF2.left *= f;
|
||||
rectF2.right *= f;
|
||||
rectF2.bottom *= f;
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Rect and(Rect rect, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Rect rect2 = new Rect(rect);
|
||||
rect2.intersect(r);
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF and(RectF rectF, RectF r) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.intersect(r);
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Region xor(Rect rect, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region = new Region(rect);
|
||||
region.op(r, Region.Op.XOR);
|
||||
return region;
|
||||
}
|
||||
|
||||
public static final Region xor(RectF rectF, RectF r) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Rect rect = new Rect();
|
||||
rectF.roundOut(rect);
|
||||
Region region = new Region(rect);
|
||||
Rect rect2 = new Rect();
|
||||
r.roundOut(rect2);
|
||||
region.op(rect2, Region.Op.XOR);
|
||||
return region;
|
||||
}
|
||||
|
||||
public static final boolean contains(Rect rect, Point p) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
return rect.contains(p.x, p.y);
|
||||
}
|
||||
|
||||
public static final boolean contains(RectF rectF, PointF p) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
return rectF.contains(p.x, p.y);
|
||||
}
|
||||
|
||||
public static final RectF toRectF(Rect rect) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
return new RectF(rect);
|
||||
}
|
||||
|
||||
public static final Rect toRect(RectF rectF) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Rect rect = new Rect();
|
||||
rectF.roundOut(rect);
|
||||
return rect;
|
||||
}
|
||||
|
||||
public static final Region toRegion(Rect rect) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
return new Region(rect);
|
||||
}
|
||||
|
||||
public static final Region toRegion(RectF rectF) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Rect rect = new Rect();
|
||||
rectF.roundOut(rect);
|
||||
return new Region(rect);
|
||||
}
|
||||
|
||||
public static final RectF transform(RectF rectF, Matrix m) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(m, "m");
|
||||
m.mapRect(rectF);
|
||||
return rectF;
|
||||
}
|
||||
|
||||
public static final RectF times(RectF rectF, int i) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
float f = i;
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.top *= f;
|
||||
rectF2.left *= f;
|
||||
rectF2.right *= f;
|
||||
rectF2.bottom *= f;
|
||||
return rectF2;
|
||||
}
|
||||
|
||||
public static final Rect or(Rect rect, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(rect, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Rect rect2 = new Rect(rect);
|
||||
rect2.union(r);
|
||||
return rect2;
|
||||
}
|
||||
|
||||
public static final RectF or(RectF rectF, RectF r) {
|
||||
Intrinsics.checkNotNullParameter(rectF, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
RectF rectF2 = new RectF(rectF);
|
||||
rectF2.union(r);
|
||||
return rectF2;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.RegionIterator;
|
||||
import java.util.Iterator;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.markers.KMappedMarker;
|
||||
|
||||
/* compiled from: Region.kt */
|
||||
@Metadata(d1 = {"\u0000\u001d\n\u0000\n\u0002\u0010(\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001J\t\u0010\b\u001a\u00020\u0004H\u0096\u0002J\t\u0010\t\u001a\u00020\u0002H\u0096\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0002X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\n"}, d2 = {"androidx/core/graphics/RegionKt$iterator$1", "", "Landroid/graphics/Rect;", "hasMore", "", "iterator", "Landroid/graphics/RegionIterator;", "rect", "hasNext", "next", "core-ktx_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class RegionKt$iterator$1 implements Iterator<Rect>, KMappedMarker {
|
||||
private boolean hasMore;
|
||||
private final RegionIterator iterator;
|
||||
private final Rect rect;
|
||||
|
||||
@Override // java.util.Iterator
|
||||
public boolean hasNext() {
|
||||
return this.hasMore;
|
||||
}
|
||||
|
||||
@Override // java.util.Iterator
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
|
||||
}
|
||||
|
||||
RegionKt$iterator$1(Region region) {
|
||||
RegionIterator regionIterator = new RegionIterator(region);
|
||||
this.iterator = regionIterator;
|
||||
Rect rect = new Rect();
|
||||
this.rect = rect;
|
||||
this.hasMore = regionIterator.next(rect);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // java.util.Iterator
|
||||
public Rect next() {
|
||||
if (this.hasMore) {
|
||||
Rect rect = new Rect(this.rect);
|
||||
this.hasMore = this.iterator.next(this.rect);
|
||||
return rect;
|
||||
}
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
}
|
135
02-Easy5/E5/sources/androidx/core/graphics/RegionKt.java
Normal file
135
02-Easy5/E5/sources/androidx/core/graphics/RegionKt.java
Normal file
@ -0,0 +1,135 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.RegionIterator;
|
||||
import java.util.Iterator;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Region.kt */
|
||||
@Metadata(d1 = {"\u00004\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010(\n\u0002\b\u0007\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\f\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\f\u001a\u0015\u0010\u0004\u001a\u00020\u0005*\u00020\u00012\u0006\u0010\u0006\u001a\u00020\u0007H\u0086\n\u001a3\u0010\b\u001a\u00020\t*\u00020\u00012!\u0010\n\u001a\u001d\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\f\u0012\b\b\r\u0012\u0004\b\b(\u000e\u0012\u0004\u0012\u00020\t0\u000bH\u0086\bø\u0001\u0000\u001a\u0013\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00030\u0010*\u00020\u0001H\u0086\u0002\u001a\u0015\u0010\u0011\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\n\u001a\u0015\u0010\u0011\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\n\u001a\r\u0010\u0012\u001a\u00020\u0001*\u00020\u0001H\u0086\n\u001a\u0015\u0010\u0013\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\f\u001a\u0015\u0010\u0013\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\f\u001a\u0015\u0010\u0014\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\n\u001a\u0015\u0010\u0014\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\n\u001a\r\u0010\u0015\u001a\u00020\u0001*\u00020\u0001H\u0086\n\u001a\u0015\u0010\u0016\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0086\f\u001a\u0015\u0010\u0016\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0001H\u0086\f\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0017"}, d2 = {"and", "Landroid/graphics/Region;", "r", "Landroid/graphics/Rect;", "contains", "", "p", "Landroid/graphics/Point;", "forEach", "", "action", "Lkotlin/Function1;", "Lkotlin/ParameterName;", "name", "rect", "iterator", "", "minus", "not", "or", "plus", "unaryMinus", "xor", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class RegionKt {
|
||||
public static final boolean contains(Region region, Point p) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(p, "p");
|
||||
return region.contains(p.x, p.y);
|
||||
}
|
||||
|
||||
public static final Region plus(Region region, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.union(r);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region plus(Region region, Region r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.UNION);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region minus(Region region, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.DIFFERENCE);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region minus(Region region, Region r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.DIFFERENCE);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region unaryMinus(Region region) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Region region2 = new Region(region.getBounds());
|
||||
region2.op(region, Region.Op.DIFFERENCE);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region and(Region region, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.INTERSECT);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region and(Region region, Region r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.INTERSECT);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region xor(Region region, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.XOR);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region xor(Region region, Region r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.XOR);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final void forEach(Region region, Function1<? super Rect, Unit> action) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(action, "action");
|
||||
RegionIterator regionIterator = new RegionIterator(region);
|
||||
while (true) {
|
||||
Rect rect = new Rect();
|
||||
if (!regionIterator.next(rect)) {
|
||||
return;
|
||||
} else {
|
||||
action.invoke(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Iterator<Rect> iterator(Region region) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
return new RegionKt$iterator$1(region);
|
||||
}
|
||||
|
||||
public static final Region not(Region region) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Region region2 = new Region(region.getBounds());
|
||||
region2.op(region, Region.Op.DIFFERENCE);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region or(Region region, Rect r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.union(r);
|
||||
return region2;
|
||||
}
|
||||
|
||||
public static final Region or(Region region, Region r) {
|
||||
Intrinsics.checkNotNullParameter(region, "<this>");
|
||||
Intrinsics.checkNotNullParameter(r, "r");
|
||||
Region region2 = new Region(region);
|
||||
region2.op(r, Region.Op.UNION);
|
||||
return region2;
|
||||
}
|
||||
}
|
22
02-Easy5/E5/sources/androidx/core/graphics/ShaderKt.java
Normal file
22
02-Easy5/E5/sources/androidx/core/graphics/ShaderKt.java
Normal file
@ -0,0 +1,22 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Shader;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Shader.kt */
|
||||
@Metadata(d1 = {"\u0000\u001a\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u001a)\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0017\u0010\u0003\u001a\u0013\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00010\u0004¢\u0006\u0002\b\u0006H\u0086\bø\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0007"}, d2 = {"transform", "", "Landroid/graphics/Shader;", "block", "Lkotlin/Function1;", "Landroid/graphics/Matrix;", "Lkotlin/ExtensionFunctionType;", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class ShaderKt {
|
||||
public static final void transform(Shader shader, Function1<? super Matrix, Unit> block) {
|
||||
Intrinsics.checkNotNullParameter(shader, "<this>");
|
||||
Intrinsics.checkNotNullParameter(block, "block");
|
||||
Matrix matrix = new Matrix();
|
||||
shader.getLocalMatrix(matrix);
|
||||
block.invoke(matrix);
|
||||
shader.setLocalMatrix(matrix);
|
||||
}
|
||||
}
|
167
02-Easy5/E5/sources/androidx/core/graphics/TypefaceCompat.java
Normal file
167
02-Easy5/E5/sources/androidx/core/graphics/TypefaceCompat.java
Normal file
@ -0,0 +1,167 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.Handler;
|
||||
import androidx.collection.LruCache;
|
||||
import androidx.core.content.res.FontResourcesParserCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.provider.FontsContractCompat;
|
||||
import androidx.core.util.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TypefaceCompat {
|
||||
private static final LruCache<String, Typeface> sTypefaceCache;
|
||||
private static final TypefaceCompatBaseImpl sTypefaceCompatImpl;
|
||||
|
||||
static {
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
sTypefaceCompatImpl = new TypefaceCompatApi29Impl();
|
||||
} else if (Build.VERSION.SDK_INT >= 28) {
|
||||
sTypefaceCompatImpl = new TypefaceCompatApi28Impl();
|
||||
} else if (Build.VERSION.SDK_INT >= 26) {
|
||||
sTypefaceCompatImpl = new TypefaceCompatApi26Impl();
|
||||
} else if (Build.VERSION.SDK_INT >= 24 && TypefaceCompatApi24Impl.isUsable()) {
|
||||
sTypefaceCompatImpl = new TypefaceCompatApi24Impl();
|
||||
} else {
|
||||
sTypefaceCompatImpl = new TypefaceCompatApi21Impl();
|
||||
}
|
||||
sTypefaceCache = new LruCache<>(16);
|
||||
}
|
||||
|
||||
private TypefaceCompat() {
|
||||
}
|
||||
|
||||
public static Typeface findFromCache(Resources resources, int i, String str, int i2, int i3) {
|
||||
return sTypefaceCache.get(createResourceUid(resources, i, str, i2, i3));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Typeface findFromCache(Resources resources, int i, int i2) {
|
||||
return findFromCache(resources, i, null, 0, i2);
|
||||
}
|
||||
|
||||
private static String createResourceUid(Resources resources, int i, String str, int i2, int i3) {
|
||||
return resources.getResourcePackageName(i) + '-' + str + '-' + i2 + '-' + i + '-' + i3;
|
||||
}
|
||||
|
||||
private static Typeface getSystemFontFamily(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Typeface create = Typeface.create(str, 0);
|
||||
Typeface create2 = Typeface.create(Typeface.DEFAULT, 0);
|
||||
if (create == null || create.equals(create2)) {
|
||||
return null;
|
||||
}
|
||||
return create;
|
||||
}
|
||||
|
||||
public static Typeface createFromResourcesFamilyXml(Context context, FontResourcesParserCompat.FamilyResourceEntry familyResourceEntry, Resources resources, int i, String str, int i2, int i3, ResourcesCompat.FontCallback fontCallback, Handler handler, boolean z) {
|
||||
Typeface createFromFontFamilyFilesResourceEntry;
|
||||
if (familyResourceEntry instanceof FontResourcesParserCompat.ProviderResourceEntry) {
|
||||
FontResourcesParserCompat.ProviderResourceEntry providerResourceEntry = (FontResourcesParserCompat.ProviderResourceEntry) familyResourceEntry;
|
||||
Typeface systemFontFamily = getSystemFontFamily(providerResourceEntry.getSystemFontFamilyName());
|
||||
if (systemFontFamily != null) {
|
||||
if (fontCallback != null) {
|
||||
fontCallback.callbackSuccessAsync(systemFontFamily, handler);
|
||||
}
|
||||
return systemFontFamily;
|
||||
}
|
||||
createFromFontFamilyFilesResourceEntry = FontsContractCompat.requestFont(context, providerResourceEntry.getRequest(), i3, !z ? fontCallback != null : providerResourceEntry.getFetchStrategy() != 0, z ? providerResourceEntry.getTimeout() : -1, ResourcesCompat.FontCallback.getHandler(handler), new ResourcesCallbackAdapter(fontCallback));
|
||||
} else {
|
||||
createFromFontFamilyFilesResourceEntry = sTypefaceCompatImpl.createFromFontFamilyFilesResourceEntry(context, (FontResourcesParserCompat.FontFamilyFilesResourceEntry) familyResourceEntry, resources, i3);
|
||||
if (fontCallback != null) {
|
||||
if (createFromFontFamilyFilesResourceEntry != null) {
|
||||
fontCallback.callbackSuccessAsync(createFromFontFamilyFilesResourceEntry, handler);
|
||||
} else {
|
||||
fontCallback.callbackFailAsync(-3, handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (createFromFontFamilyFilesResourceEntry != null) {
|
||||
sTypefaceCache.put(createResourceUid(resources, i, str, i2, i3), createFromFontFamilyFilesResourceEntry);
|
||||
}
|
||||
return createFromFontFamilyFilesResourceEntry;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Typeface createFromResourcesFamilyXml(Context context, FontResourcesParserCompat.FamilyResourceEntry familyResourceEntry, Resources resources, int i, int i2, ResourcesCompat.FontCallback fontCallback, Handler handler, boolean z) {
|
||||
return createFromResourcesFamilyXml(context, familyResourceEntry, resources, i, null, 0, i2, fontCallback, handler, z);
|
||||
}
|
||||
|
||||
public static Typeface createFromResourcesFontFile(Context context, Resources resources, int i, String str, int i2, int i3) {
|
||||
Typeface createFromResourcesFontFile = sTypefaceCompatImpl.createFromResourcesFontFile(context, resources, i, str, i3);
|
||||
if (createFromResourcesFontFile != null) {
|
||||
sTypefaceCache.put(createResourceUid(resources, i, str, i2, i3), createFromResourcesFontFile);
|
||||
}
|
||||
return createFromResourcesFontFile;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Typeface createFromResourcesFontFile(Context context, Resources resources, int i, String str, int i2) {
|
||||
return createFromResourcesFontFile(context, resources, i, str, 0, i2);
|
||||
}
|
||||
|
||||
public static Typeface createFromFontInfo(Context context, CancellationSignal cancellationSignal, FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
return sTypefaceCompatImpl.createFromFontInfo(context, cancellationSignal, fontInfoArr, i);
|
||||
}
|
||||
|
||||
private static Typeface getBestFontFromFamily(Context context, Typeface typeface, int i) {
|
||||
TypefaceCompatBaseImpl typefaceCompatBaseImpl = sTypefaceCompatImpl;
|
||||
FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamily = typefaceCompatBaseImpl.getFontFamily(typeface);
|
||||
if (fontFamily == null) {
|
||||
return null;
|
||||
}
|
||||
return typefaceCompatBaseImpl.createFromFontFamilyFilesResourceEntry(context, fontFamily, context.getResources(), i);
|
||||
}
|
||||
|
||||
public static Typeface create(Context context, Typeface typeface, int i) {
|
||||
if (context == null) {
|
||||
throw new IllegalArgumentException("Context cannot be null");
|
||||
}
|
||||
return Typeface.create(typeface, i);
|
||||
}
|
||||
|
||||
public static Typeface create(Context context, Typeface typeface, int i, boolean z) {
|
||||
if (context == null) {
|
||||
throw new IllegalArgumentException("Context cannot be null");
|
||||
}
|
||||
Preconditions.checkArgumentInRange(i, 1, 1000, "weight");
|
||||
if (typeface == null) {
|
||||
typeface = Typeface.DEFAULT;
|
||||
}
|
||||
return sTypefaceCompatImpl.createWeightStyle(context, typeface, i, z);
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
sTypefaceCache.evictAll();
|
||||
}
|
||||
|
||||
public static class ResourcesCallbackAdapter extends FontsContractCompat.FontRequestCallback {
|
||||
private ResourcesCompat.FontCallback mFontCallback;
|
||||
|
||||
public ResourcesCallbackAdapter(ResourcesCompat.FontCallback fontCallback) {
|
||||
this.mFontCallback = fontCallback;
|
||||
}
|
||||
|
||||
@Override // androidx.core.provider.FontsContractCompat.FontRequestCallback
|
||||
public void onTypefaceRetrieved(Typeface typeface) {
|
||||
ResourcesCompat.FontCallback fontCallback = this.mFontCallback;
|
||||
if (fontCallback != null) {
|
||||
fontCallback.m81x46c88379(typeface);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.provider.FontsContractCompat.FontRequestCallback
|
||||
public void onTypefaceRequestFailed(int i) {
|
||||
ResourcesCompat.FontCallback fontCallback = this.mFontCallback;
|
||||
if (fontCallback != null) {
|
||||
fontCallback.m80xb24343b7(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.OsConstants;
|
||||
import android.util.Log;
|
||||
import androidx.core.content.res.FontResourcesParserCompat;
|
||||
import androidx.core.provider.FontsContractCompat;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TypefaceCompatApi21Impl extends TypefaceCompatBaseImpl {
|
||||
private static final String ADD_FONT_WEIGHT_STYLE_METHOD = "addFontWeightStyle";
|
||||
private static final String CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD = "createFromFamiliesWithDefault";
|
||||
private static final String FONT_FAMILY_CLASS = "android.graphics.FontFamily";
|
||||
private static final String TAG = "TypefaceCompatApi21Impl";
|
||||
private static Method sAddFontWeightStyle = null;
|
||||
private static Method sCreateFromFamiliesWithDefault = null;
|
||||
private static Class<?> sFontFamily = null;
|
||||
private static Constructor<?> sFontFamilyCtor = null;
|
||||
private static boolean sHasInitBeenCalled = false;
|
||||
|
||||
TypefaceCompatApi21Impl() {
|
||||
}
|
||||
|
||||
private static void init() {
|
||||
Class<?> cls;
|
||||
Method method;
|
||||
Constructor<?> constructor;
|
||||
Method method2;
|
||||
if (sHasInitBeenCalled) {
|
||||
return;
|
||||
}
|
||||
sHasInitBeenCalled = true;
|
||||
try {
|
||||
cls = Class.forName(FONT_FAMILY_CLASS);
|
||||
constructor = cls.getConstructor(new Class[0]);
|
||||
method2 = cls.getMethod(ADD_FONT_WEIGHT_STYLE_METHOD, String.class, Integer.TYPE, Boolean.TYPE);
|
||||
method = Typeface.class.getMethod(CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD, Array.newInstance(cls, 1).getClass());
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
Log.e(TAG, e.getClass().getName(), e);
|
||||
cls = null;
|
||||
method = null;
|
||||
constructor = null;
|
||||
method2 = null;
|
||||
}
|
||||
sFontFamilyCtor = constructor;
|
||||
sFontFamily = cls;
|
||||
sAddFontWeightStyle = method2;
|
||||
sCreateFromFamiliesWithDefault = method;
|
||||
}
|
||||
|
||||
private File getFile(ParcelFileDescriptor parcelFileDescriptor) {
|
||||
try {
|
||||
String readlink = Os.readlink("/proc/self/fd/" + parcelFileDescriptor.getFd());
|
||||
if (OsConstants.S_ISREG(Os.stat(readlink).st_mode)) {
|
||||
return new File(readlink);
|
||||
}
|
||||
} catch (ErrnoException unused) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Object newFamily() {
|
||||
init();
|
||||
try {
|
||||
return sFontFamilyCtor.newInstance(new Object[0]);
|
||||
} catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Typeface createFromFamiliesWithDefault(Object obj) {
|
||||
init();
|
||||
try {
|
||||
Object newInstance = Array.newInstance(sFontFamily, 1);
|
||||
Array.set(newInstance, 0, obj);
|
||||
return (Typeface) sCreateFromFamiliesWithDefault.invoke(null, newInstance);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean addFontWeightStyle(Object obj, String str, int i, boolean z) {
|
||||
init();
|
||||
try {
|
||||
return ((Boolean) sAddFontWeightStyle.invoke(obj, str, Integer.valueOf(i), Boolean.valueOf(z))).booleanValue();
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontInfo(Context context, CancellationSignal cancellationSignal, FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
if (fontInfoArr.length < 1) {
|
||||
return null;
|
||||
}
|
||||
FontsContractCompat.FontInfo findBestInfo = findBestInfo(fontInfoArr, i);
|
||||
try {
|
||||
ParcelFileDescriptor openFileDescriptor = context.getContentResolver().openFileDescriptor(findBestInfo.getUri(), "r", cancellationSignal);
|
||||
if (openFileDescriptor == null) {
|
||||
if (openFileDescriptor != null) {
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
File file = getFile(openFileDescriptor);
|
||||
if (file != null && file.canRead()) {
|
||||
Typeface createFromFile = Typeface.createFromFile(file);
|
||||
if (openFileDescriptor != null) {
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
return createFromFile;
|
||||
}
|
||||
FileInputStream fileInputStream = new FileInputStream(openFileDescriptor.getFileDescriptor());
|
||||
try {
|
||||
Typeface createFromInputStream = super.createFromInputStream(context, fileInputStream);
|
||||
fileInputStream.close();
|
||||
if (openFileDescriptor != null) {
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
return createFromInputStream;
|
||||
} finally {
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontFamilyFilesResourceEntry(Context context, FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, Resources resources, int i) {
|
||||
Object newFamily = newFamily();
|
||||
for (FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry : fontFamilyFilesResourceEntry.getEntries()) {
|
||||
File tempFile = TypefaceCompatUtil.getTempFile(context);
|
||||
if (tempFile == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (!TypefaceCompatUtil.copyToFile(tempFile, resources, fontFileResourceEntry.getResourceId())) {
|
||||
return null;
|
||||
}
|
||||
if (!addFontWeightStyle(newFamily, tempFile.getPath(), fontFileResourceEntry.getWeight(), fontFileResourceEntry.isItalic())) {
|
||||
return null;
|
||||
}
|
||||
tempFile.delete();
|
||||
} catch (RuntimeException unused) {
|
||||
return null;
|
||||
} finally {
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
return createFromFamiliesWithDefault(newFamily);
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
Typeface createWeightStyle(Context context, Typeface typeface, int i, boolean z) {
|
||||
Typeface typeface2;
|
||||
try {
|
||||
typeface2 = WeightTypefaceApi21.createWeightStyle(typeface, i, z);
|
||||
} catch (RuntimeException unused) {
|
||||
typeface2 = null;
|
||||
}
|
||||
return typeface2 == null ? super.createWeightStyle(context, typeface, i, z) : typeface2;
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.CancellationSignal;
|
||||
import android.util.Log;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.core.content.res.FontResourcesParserCompat;
|
||||
import androidx.core.provider.FontsContractCompat;
|
||||
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.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TypefaceCompatApi24Impl extends TypefaceCompatBaseImpl {
|
||||
private static final String ADD_FONT_WEIGHT_STYLE_METHOD = "addFontWeightStyle";
|
||||
private static final String CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD = "createFromFamiliesWithDefault";
|
||||
private static final String FONT_FAMILY_CLASS = "android.graphics.FontFamily";
|
||||
private static final String TAG = "TypefaceCompatApi24Impl";
|
||||
private static final Method sAddFontWeightStyle;
|
||||
private static final Method sCreateFromFamiliesWithDefault;
|
||||
private static final Class<?> sFontFamily;
|
||||
private static final Constructor<?> sFontFamilyCtor;
|
||||
|
||||
TypefaceCompatApi24Impl() {
|
||||
}
|
||||
|
||||
static {
|
||||
Class<?> cls;
|
||||
Method method;
|
||||
Constructor<?> constructor;
|
||||
Method method2;
|
||||
try {
|
||||
cls = Class.forName(FONT_FAMILY_CLASS);
|
||||
constructor = cls.getConstructor(new Class[0]);
|
||||
method2 = cls.getMethod(ADD_FONT_WEIGHT_STYLE_METHOD, ByteBuffer.class, Integer.TYPE, List.class, Integer.TYPE, Boolean.TYPE);
|
||||
method = Typeface.class.getMethod(CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD, Array.newInstance(cls, 1).getClass());
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
Log.e(TAG, e.getClass().getName(), e);
|
||||
cls = null;
|
||||
method = null;
|
||||
constructor = null;
|
||||
method2 = null;
|
||||
}
|
||||
sFontFamilyCtor = constructor;
|
||||
sFontFamily = cls;
|
||||
sAddFontWeightStyle = method2;
|
||||
sCreateFromFamiliesWithDefault = method;
|
||||
}
|
||||
|
||||
public static boolean isUsable() {
|
||||
Method method = sAddFontWeightStyle;
|
||||
if (method == null) {
|
||||
Log.w(TAG, "Unable to collect necessary private methods.Fallback to legacy implementation.");
|
||||
}
|
||||
return method != null;
|
||||
}
|
||||
|
||||
private static Object newFamily() {
|
||||
try {
|
||||
return sFontFamilyCtor.newInstance(new Object[0]);
|
||||
} catch (IllegalAccessException | InstantiationException | InvocationTargetException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean addFontWeightStyle(Object obj, ByteBuffer byteBuffer, int i, int i2, boolean z) {
|
||||
try {
|
||||
return ((Boolean) sAddFontWeightStyle.invoke(obj, byteBuffer, Integer.valueOf(i), null, Integer.valueOf(i2), Boolean.valueOf(z))).booleanValue();
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static Typeface createFromFamiliesWithDefault(Object obj) {
|
||||
try {
|
||||
Object newInstance = Array.newInstance(sFontFamily, 1);
|
||||
Array.set(newInstance, 0, obj);
|
||||
return (Typeface) sCreateFromFamiliesWithDefault.invoke(null, newInstance);
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontInfo(Context context, CancellationSignal cancellationSignal, FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
Object newFamily = newFamily();
|
||||
if (newFamily == null) {
|
||||
return null;
|
||||
}
|
||||
SimpleArrayMap simpleArrayMap = new SimpleArrayMap();
|
||||
for (FontsContractCompat.FontInfo fontInfo : fontInfoArr) {
|
||||
Uri uri = fontInfo.getUri();
|
||||
ByteBuffer byteBuffer = (ByteBuffer) simpleArrayMap.get(uri);
|
||||
if (byteBuffer == null) {
|
||||
byteBuffer = TypefaceCompatUtil.mmap(context, cancellationSignal, uri);
|
||||
simpleArrayMap.put(uri, byteBuffer);
|
||||
}
|
||||
if (byteBuffer == null || !addFontWeightStyle(newFamily, byteBuffer, fontInfo.getTtcIndex(), fontInfo.getWeight(), fontInfo.isItalic())) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Typeface createFromFamiliesWithDefault = createFromFamiliesWithDefault(newFamily);
|
||||
if (createFromFamiliesWithDefault == null) {
|
||||
return null;
|
||||
}
|
||||
return Typeface.create(createFromFamiliesWithDefault, i);
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontFamilyFilesResourceEntry(Context context, FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, Resources resources, int i) {
|
||||
Object newFamily = newFamily();
|
||||
if (newFamily == null) {
|
||||
return null;
|
||||
}
|
||||
for (FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry : fontFamilyFilesResourceEntry.getEntries()) {
|
||||
ByteBuffer copyToDirectBuffer = TypefaceCompatUtil.copyToDirectBuffer(context, resources, fontFileResourceEntry.getResourceId());
|
||||
if (copyToDirectBuffer == null || !addFontWeightStyle(newFamily, copyToDirectBuffer, fontFileResourceEntry.getTtcIndex(), fontFileResourceEntry.getWeight(), fontFileResourceEntry.isItalic())) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return createFromFamiliesWithDefault(newFamily);
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
Typeface createWeightStyle(Context context, Typeface typeface, int i, boolean z) {
|
||||
Typeface typeface2;
|
||||
try {
|
||||
typeface2 = WeightTypefaceApi21.createWeightStyle(typeface, i, z);
|
||||
} catch (RuntimeException unused) {
|
||||
typeface2 = null;
|
||||
}
|
||||
return typeface2 == null ? super.createWeightStyle(context, typeface, i, z) : typeface2;
|
||||
}
|
||||
}
|
@ -0,0 +1,265 @@
|
||||
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.net.Uri;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.util.Log;
|
||||
import androidx.core.content.res.FontResourcesParserCompat;
|
||||
import androidx.core.provider.FontsContractCompat;
|
||||
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;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TypefaceCompatApi26Impl extends TypefaceCompatApi21Impl {
|
||||
private static final String ABORT_CREATION_METHOD = "abortCreation";
|
||||
private static final String ADD_FONT_FROM_ASSET_MANAGER_METHOD = "addFontFromAssetManager";
|
||||
private static final String ADD_FONT_FROM_BUFFER_METHOD = "addFontFromBuffer";
|
||||
private static final String CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD = "createFromFamiliesWithDefault";
|
||||
private static final String FONT_FAMILY_CLASS = "android.graphics.FontFamily";
|
||||
private static final String FREEZE_METHOD = "freeze";
|
||||
private static final int RESOLVE_BY_FONT_TABLE = -1;
|
||||
private static final String TAG = "TypefaceCompatApi26Impl";
|
||||
protected final Method mAbortCreation;
|
||||
protected final Method mAddFontFromAssetManager;
|
||||
protected final Method mAddFontFromBuffer;
|
||||
protected final Method mCreateFromFamiliesWithDefault;
|
||||
protected final Class<?> mFontFamily;
|
||||
protected final Constructor<?> mFontFamilyCtor;
|
||||
protected final Method mFreeze;
|
||||
|
||||
public TypefaceCompatApi26Impl() {
|
||||
Class<?> cls;
|
||||
Constructor<?> constructor;
|
||||
Method method;
|
||||
Method method2;
|
||||
Method method3;
|
||||
Method method4;
|
||||
Method method5;
|
||||
try {
|
||||
cls = obtainFontFamily();
|
||||
constructor = obtainFontFamilyCtor(cls);
|
||||
method = obtainAddFontFromAssetManagerMethod(cls);
|
||||
method2 = obtainAddFontFromBufferMethod(cls);
|
||||
method3 = obtainFreezeMethod(cls);
|
||||
method4 = obtainAbortCreationMethod(cls);
|
||||
method5 = obtainCreateFromFamiliesWithDefaultMethod(cls);
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
Log.e(TAG, "Unable to collect necessary methods for class " + e.getClass().getName(), e);
|
||||
cls = null;
|
||||
constructor = null;
|
||||
method = null;
|
||||
method2 = null;
|
||||
method3 = null;
|
||||
method4 = null;
|
||||
method5 = null;
|
||||
}
|
||||
this.mFontFamily = cls;
|
||||
this.mFontFamilyCtor = constructor;
|
||||
this.mAddFontFromAssetManager = method;
|
||||
this.mAddFontFromBuffer = method2;
|
||||
this.mFreeze = method3;
|
||||
this.mAbortCreation = method4;
|
||||
this.mCreateFromFamiliesWithDefault = method5;
|
||||
}
|
||||
|
||||
private boolean isFontFamilyPrivateAPIAvailable() {
|
||||
if (this.mAddFontFromAssetManager == null) {
|
||||
Log.w(TAG, "Unable to collect necessary private methods. Fallback to legacy implementation.");
|
||||
}
|
||||
return this.mAddFontFromAssetManager != null;
|
||||
}
|
||||
|
||||
private Object newFamily() {
|
||||
try {
|
||||
return this.mFontFamilyCtor.newInstance(new Object[0]);
|
||||
} catch (IllegalAccessException | InstantiationException | InvocationTargetException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean addFontFromAssetManager(Context context, Object obj, String str, int i, int i2, int i3, FontVariationAxis[] fontVariationAxisArr) {
|
||||
try {
|
||||
return ((Boolean) this.mAddFontFromAssetManager.invoke(obj, context.getAssets(), str, 0, false, Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), fontVariationAxisArr)).booleanValue();
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean addFontFromBuffer(Object obj, ByteBuffer byteBuffer, int i, int i2, int i3) {
|
||||
try {
|
||||
return ((Boolean) this.mAddFontFromBuffer.invoke(obj, byteBuffer, Integer.valueOf(i), null, Integer.valueOf(i2), Integer.valueOf(i3))).booleanValue();
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected Typeface createFromFamiliesWithDefault(Object obj) {
|
||||
try {
|
||||
Object newInstance = Array.newInstance(this.mFontFamily, 1);
|
||||
Array.set(newInstance, 0, obj);
|
||||
return (Typeface) this.mCreateFromFamiliesWithDefault.invoke(null, newInstance, -1, -1);
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean freeze(Object obj) {
|
||||
try {
|
||||
return ((Boolean) this.mFreeze.invoke(obj, new Object[0])).booleanValue();
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void abortCreation(Object obj) {
|
||||
try {
|
||||
this.mAbortCreation.invoke(obj, new Object[0]);
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatApi21Impl, androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontFamilyFilesResourceEntry(Context context, FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, Resources resources, int i) {
|
||||
if (!isFontFamilyPrivateAPIAvailable()) {
|
||||
return super.createFromFontFamilyFilesResourceEntry(context, fontFamilyFilesResourceEntry, resources, i);
|
||||
}
|
||||
Object newFamily = newFamily();
|
||||
if (newFamily == null) {
|
||||
return null;
|
||||
}
|
||||
for (FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry : fontFamilyFilesResourceEntry.getEntries()) {
|
||||
if (!addFontFromAssetManager(context, newFamily, fontFileResourceEntry.getFileName(), fontFileResourceEntry.getTtcIndex(), fontFileResourceEntry.getWeight(), fontFileResourceEntry.isItalic() ? 1 : 0, FontVariationAxis.fromFontVariationSettings(fontFileResourceEntry.getVariationSettings()))) {
|
||||
abortCreation(newFamily);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (freeze(newFamily)) {
|
||||
return createFromFamiliesWithDefault(newFamily);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatApi21Impl, androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontInfo(Context context, CancellationSignal cancellationSignal, FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
Typeface createFromFamiliesWithDefault;
|
||||
if (fontInfoArr.length < 1) {
|
||||
return null;
|
||||
}
|
||||
if (!isFontFamilyPrivateAPIAvailable()) {
|
||||
FontsContractCompat.FontInfo findBestInfo = findBestInfo(fontInfoArr, i);
|
||||
try {
|
||||
ParcelFileDescriptor openFileDescriptor = context.getContentResolver().openFileDescriptor(findBestInfo.getUri(), "r", cancellationSignal);
|
||||
if (openFileDescriptor == null) {
|
||||
if (openFileDescriptor != null) {
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
Typeface build = new Typeface.Builder(openFileDescriptor.getFileDescriptor()).setWeight(findBestInfo.getWeight()).setItalic(findBestInfo.isItalic()).build();
|
||||
if (openFileDescriptor != null) {
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
return build;
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Map<Uri, ByteBuffer> readFontInfoIntoByteBuffer = TypefaceCompatUtil.readFontInfoIntoByteBuffer(context, fontInfoArr, cancellationSignal);
|
||||
Object newFamily = newFamily();
|
||||
if (newFamily == null) {
|
||||
return null;
|
||||
}
|
||||
boolean z = false;
|
||||
for (FontsContractCompat.FontInfo fontInfo : fontInfoArr) {
|
||||
ByteBuffer byteBuffer = readFontInfoIntoByteBuffer.get(fontInfo.getUri());
|
||||
if (byteBuffer != null) {
|
||||
if (!addFontFromBuffer(newFamily, byteBuffer, fontInfo.getTtcIndex(), fontInfo.getWeight(), fontInfo.isItalic() ? 1 : 0)) {
|
||||
abortCreation(newFamily);
|
||||
return null;
|
||||
}
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (!z) {
|
||||
abortCreation(newFamily);
|
||||
return null;
|
||||
}
|
||||
if (freeze(newFamily) && (createFromFamiliesWithDefault = createFromFamiliesWithDefault(newFamily)) != null) {
|
||||
return Typeface.create(createFromFamiliesWithDefault, i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromResourcesFontFile(Context context, Resources resources, int i, String str, int i2) {
|
||||
if (!isFontFamilyPrivateAPIAvailable()) {
|
||||
return super.createFromResourcesFontFile(context, resources, i, str, i2);
|
||||
}
|
||||
Object newFamily = newFamily();
|
||||
if (newFamily == null) {
|
||||
return null;
|
||||
}
|
||||
if (!addFontFromAssetManager(context, newFamily, str, 0, -1, -1, null)) {
|
||||
abortCreation(newFamily);
|
||||
return null;
|
||||
}
|
||||
if (freeze(newFamily)) {
|
||||
return createFromFamiliesWithDefault(newFamily);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Class<?> obtainFontFamily() throws ClassNotFoundException {
|
||||
return Class.forName(FONT_FAMILY_CLASS);
|
||||
}
|
||||
|
||||
protected Constructor<?> obtainFontFamilyCtor(Class<?> cls) throws NoSuchMethodException {
|
||||
return cls.getConstructor(new Class[0]);
|
||||
}
|
||||
|
||||
protected Method obtainAddFontFromAssetManagerMethod(Class<?> cls) throws NoSuchMethodException {
|
||||
return cls.getMethod(ADD_FONT_FROM_ASSET_MANAGER_METHOD, AssetManager.class, String.class, Integer.TYPE, Boolean.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE, FontVariationAxis[].class);
|
||||
}
|
||||
|
||||
protected Method obtainAddFontFromBufferMethod(Class<?> cls) throws NoSuchMethodException {
|
||||
return cls.getMethod(ADD_FONT_FROM_BUFFER_METHOD, ByteBuffer.class, Integer.TYPE, FontVariationAxis[].class, Integer.TYPE, Integer.TYPE);
|
||||
}
|
||||
|
||||
protected Method obtainFreezeMethod(Class<?> cls) throws NoSuchMethodException {
|
||||
return cls.getMethod(FREEZE_METHOD, new Class[0]);
|
||||
}
|
||||
|
||||
protected Method obtainAbortCreationMethod(Class<?> cls) throws NoSuchMethodException {
|
||||
return cls.getMethod(ABORT_CREATION_METHOD, new Class[0]);
|
||||
}
|
||||
|
||||
protected Method obtainCreateFromFamiliesWithDefaultMethod(Class<?> cls) throws NoSuchMethodException {
|
||||
Method declaredMethod = Typeface.class.getDeclaredMethod(CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD, Array.newInstance(cls, 1).getClass(), Integer.TYPE, Integer.TYPE);
|
||||
declaredMethod.setAccessible(true);
|
||||
return declaredMethod;
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatApi21Impl, androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
Typeface createWeightStyle(Context context, Typeface typeface, int i, boolean z) {
|
||||
Typeface typeface2;
|
||||
try {
|
||||
typeface2 = WeightTypefaceApi26.createWeightStyle(typeface, i, z);
|
||||
} catch (RuntimeException unused) {
|
||||
typeface2 = null;
|
||||
}
|
||||
return typeface2 == null ? super.createWeightStyle(context, typeface, i, z) : typeface2;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TypefaceCompatApi28Impl extends TypefaceCompatApi26Impl {
|
||||
private static final String CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD = "createFromFamiliesWithDefault";
|
||||
private static final String DEFAULT_FAMILY = "sans-serif";
|
||||
private static final int RESOLVE_BY_FONT_TABLE = -1;
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatApi26Impl
|
||||
protected Typeface createFromFamiliesWithDefault(Object obj) {
|
||||
try {
|
||||
Object newInstance = Array.newInstance(this.mFontFamily, 1);
|
||||
Array.set(newInstance, 0, obj);
|
||||
return (Typeface) this.mCreateFromFamiliesWithDefault.invoke(null, newInstance, DEFAULT_FAMILY, -1, -1);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatApi26Impl
|
||||
protected Method obtainCreateFromFamiliesWithDefaultMethod(Class<?> cls) throws NoSuchMethodException {
|
||||
Method declaredMethod = Typeface.class.getDeclaredMethod(CREATE_FROM_FAMILIES_WITH_DEFAULT_METHOD, Array.newInstance(cls, 1).getClass(), String.class, Integer.TYPE, Integer.TYPE);
|
||||
declaredMethod.setAccessible(true);
|
||||
return declaredMethod;
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatApi26Impl, androidx.core.graphics.TypefaceCompatApi21Impl, androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
Typeface createWeightStyle(Context context, Typeface typeface, int i, boolean z) {
|
||||
return Typeface.create(typeface, i, z);
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.fonts.Font;
|
||||
import android.graphics.fonts.FontFamily;
|
||||
import android.graphics.fonts.FontStyle;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import androidx.core.content.res.FontResourcesParserCompat;
|
||||
import androidx.core.provider.FontsContractCompat;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TypefaceCompatApi29Impl extends TypefaceCompatBaseImpl {
|
||||
private static int getMatchScore(FontStyle fontStyle, FontStyle fontStyle2) {
|
||||
return (Math.abs(fontStyle.getWeight() - fontStyle2.getWeight()) / 100) + (fontStyle.getSlant() == fontStyle2.getSlant() ? 0 : 2);
|
||||
}
|
||||
|
||||
private Font findBaseFont(FontFamily fontFamily, int i) {
|
||||
FontStyle fontStyle = new FontStyle((i & 1) != 0 ? TypedValues.TransitionType.TYPE_DURATION : 400, (i & 2) != 0 ? 1 : 0);
|
||||
Font font = fontFamily.getFont(0);
|
||||
int matchScore = getMatchScore(fontStyle, font.getStyle());
|
||||
for (int i2 = 1; i2 < fontFamily.getSize(); i2++) {
|
||||
Font font2 = fontFamily.getFont(i2);
|
||||
int matchScore2 = getMatchScore(fontStyle, font2.getStyle());
|
||||
if (matchScore2 < matchScore) {
|
||||
font = font2;
|
||||
matchScore = matchScore2;
|
||||
}
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
protected FontsContractCompat.FontInfo findBestInfo(FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
throw new RuntimeException("Do not use this function in API 29 or later.");
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
protected Typeface createFromInputStream(Context context, InputStream inputStream) {
|
||||
throw new RuntimeException("Do not use this function in API 29 or later.");
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontInfo(Context context, CancellationSignal cancellationSignal, FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
int i2;
|
||||
ParcelFileDescriptor openFileDescriptor;
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
try {
|
||||
int length = fontInfoArr.length;
|
||||
FontFamily.Builder builder = null;
|
||||
while (i2 < length) {
|
||||
FontsContractCompat.FontInfo fontInfo = fontInfoArr[i2];
|
||||
try {
|
||||
openFileDescriptor = contentResolver.openFileDescriptor(fontInfo.getUri(), "r", cancellationSignal);
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
if (openFileDescriptor == null) {
|
||||
i2 = openFileDescriptor == null ? i2 + 1 : 0;
|
||||
} else {
|
||||
try {
|
||||
Font build = new Font.Builder(openFileDescriptor).setWeight(fontInfo.getWeight()).setSlant(fontInfo.isItalic() ? 1 : 0).setTtcIndex(fontInfo.getTtcIndex()).build();
|
||||
if (builder == null) {
|
||||
builder = new FontFamily.Builder(build);
|
||||
} else {
|
||||
builder.addFont(build);
|
||||
}
|
||||
if (openFileDescriptor == null) {
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (openFileDescriptor != null) {
|
||||
try {
|
||||
openFileDescriptor.close();
|
||||
} catch (Throwable th2) {
|
||||
th.addSuppressed(th2);
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
if (builder == null) {
|
||||
return null;
|
||||
}
|
||||
FontFamily build2 = builder.build();
|
||||
return new Typeface.CustomFallbackBuilder(build2).setStyle(findBaseFont(build2, i).getStyle()).build();
|
||||
} catch (Exception unused2) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromFontFamilyFilesResourceEntry(Context context, FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, Resources resources, int i) {
|
||||
try {
|
||||
FontFamily.Builder builder = null;
|
||||
for (FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry : fontFamilyFilesResourceEntry.getEntries()) {
|
||||
try {
|
||||
Font build = new Font.Builder(resources, fontFileResourceEntry.getResourceId()).setWeight(fontFileResourceEntry.getWeight()).setSlant(fontFileResourceEntry.isItalic() ? 1 : 0).setTtcIndex(fontFileResourceEntry.getTtcIndex()).setFontVariationSettings(fontFileResourceEntry.getVariationSettings()).build();
|
||||
if (builder == null) {
|
||||
builder = new FontFamily.Builder(build);
|
||||
} else {
|
||||
builder.addFont(build);
|
||||
}
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
if (builder == null) {
|
||||
return null;
|
||||
}
|
||||
FontFamily build2 = builder.build();
|
||||
return new Typeface.CustomFallbackBuilder(build2).setStyle(findBaseFont(build2, i).getStyle()).build();
|
||||
} catch (Exception unused2) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
public Typeface createFromResourcesFontFile(Context context, Resources resources, int i, String str, int i2) {
|
||||
try {
|
||||
Font build = new Font.Builder(resources, i).build();
|
||||
return new Typeface.CustomFallbackBuilder(new FontFamily.Builder(build).build()).setStyle(build.getStyle()).build();
|
||||
} catch (Exception unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl
|
||||
Typeface createWeightStyle(Context context, Typeface typeface, int i, boolean z) {
|
||||
return Typeface.create(typeface, i, z);
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.CancellationSignal;
|
||||
import android.util.Log;
|
||||
import androidx.constraintlayout.core.motion.utils.TypedValues;
|
||||
import androidx.core.content.res.FontResourcesParserCompat;
|
||||
import androidx.core.provider.FontsContractCompat;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TypefaceCompatBaseImpl {
|
||||
private static final int INVALID_KEY = 0;
|
||||
private static final String TAG = "TypefaceCompatBaseImpl";
|
||||
private ConcurrentHashMap<Long, FontResourcesParserCompat.FontFamilyFilesResourceEntry> mFontFamilies = new ConcurrentHashMap<>();
|
||||
|
||||
private interface StyleExtractor<T> {
|
||||
int getWeight(T t);
|
||||
|
||||
boolean isItalic(T t);
|
||||
}
|
||||
|
||||
TypefaceCompatBaseImpl() {
|
||||
}
|
||||
|
||||
private static <T> T findBestFont(T[] tArr, int i, StyleExtractor<T> styleExtractor) {
|
||||
return (T) findBestFont(tArr, (i & 1) == 0 ? 400 : TypedValues.TransitionType.TYPE_DURATION, (i & 2) != 0, styleExtractor);
|
||||
}
|
||||
|
||||
private static <T> T findBestFont(T[] tArr, int i, boolean z, StyleExtractor<T> styleExtractor) {
|
||||
T t = null;
|
||||
int i2 = Integer.MAX_VALUE;
|
||||
for (T t2 : tArr) {
|
||||
int abs = (Math.abs(styleExtractor.getWeight(t2) - i) * 2) + (styleExtractor.isItalic(t2) == z ? 0 : 1);
|
||||
if (t == null || i2 > abs) {
|
||||
t = t2;
|
||||
i2 = abs;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
private static long getUniqueKey(Typeface typeface) {
|
||||
if (typeface == null) {
|
||||
return 0L;
|
||||
}
|
||||
try {
|
||||
Field declaredField = Typeface.class.getDeclaredField("native_instance");
|
||||
declaredField.setAccessible(true);
|
||||
return ((Number) declaredField.get(typeface)).longValue();
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(TAG, "Could not retrieve font from family.", e);
|
||||
return 0L;
|
||||
} catch (NoSuchFieldException e2) {
|
||||
Log.e(TAG, "Could not retrieve font from family.", e2);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
protected FontsContractCompat.FontInfo findBestInfo(FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
return (FontsContractCompat.FontInfo) findBestFont(fontInfoArr, i, new StyleExtractor<FontsContractCompat.FontInfo>() { // from class: androidx.core.graphics.TypefaceCompatBaseImpl.1
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl.StyleExtractor
|
||||
public int getWeight(FontsContractCompat.FontInfo fontInfo) {
|
||||
return fontInfo.getWeight();
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl.StyleExtractor
|
||||
public boolean isItalic(FontsContractCompat.FontInfo fontInfo) {
|
||||
return fontInfo.isItalic();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected Typeface createFromInputStream(Context context, InputStream inputStream) {
|
||||
File tempFile = TypefaceCompatUtil.getTempFile(context);
|
||||
if (tempFile == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (TypefaceCompatUtil.copyToFile(tempFile, inputStream)) {
|
||||
return Typeface.createFromFile(tempFile.getPath());
|
||||
}
|
||||
return null;
|
||||
} catch (RuntimeException unused) {
|
||||
return null;
|
||||
} finally {
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public Typeface createFromFontInfo(Context context, CancellationSignal cancellationSignal, FontsContractCompat.FontInfo[] fontInfoArr, int i) {
|
||||
InputStream inputStream;
|
||||
InputStream inputStream2 = null;
|
||||
if (fontInfoArr.length < 1) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
inputStream = context.getContentResolver().openInputStream(findBestInfo(fontInfoArr, i).getUri());
|
||||
} catch (IOException unused) {
|
||||
inputStream = null;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
}
|
||||
try {
|
||||
Typeface createFromInputStream = createFromInputStream(context, inputStream);
|
||||
TypefaceCompatUtil.closeQuietly(inputStream);
|
||||
return createFromInputStream;
|
||||
} catch (IOException unused2) {
|
||||
TypefaceCompatUtil.closeQuietly(inputStream);
|
||||
return null;
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
inputStream2 = inputStream;
|
||||
TypefaceCompatUtil.closeQuietly(inputStream2);
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
private FontResourcesParserCompat.FontFileResourceEntry findBestEntry(FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, int i) {
|
||||
return (FontResourcesParserCompat.FontFileResourceEntry) findBestFont(fontFamilyFilesResourceEntry.getEntries(), i, new StyleExtractor<FontResourcesParserCompat.FontFileResourceEntry>() { // from class: androidx.core.graphics.TypefaceCompatBaseImpl.2
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl.StyleExtractor
|
||||
public int getWeight(FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry) {
|
||||
return fontFileResourceEntry.getWeight();
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl.StyleExtractor
|
||||
public boolean isItalic(FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry) {
|
||||
return fontFileResourceEntry.isItalic();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private FontResourcesParserCompat.FontFileResourceEntry findBestEntry(FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, int i, boolean z) {
|
||||
return (FontResourcesParserCompat.FontFileResourceEntry) findBestFont(fontFamilyFilesResourceEntry.getEntries(), i, z, new StyleExtractor<FontResourcesParserCompat.FontFileResourceEntry>() { // from class: androidx.core.graphics.TypefaceCompatBaseImpl.3
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl.StyleExtractor
|
||||
public int getWeight(FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry) {
|
||||
return fontFileResourceEntry.getWeight();
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.TypefaceCompatBaseImpl.StyleExtractor
|
||||
public boolean isItalic(FontResourcesParserCompat.FontFileResourceEntry fontFileResourceEntry) {
|
||||
return fontFileResourceEntry.isItalic();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Typeface createFromFontFamilyFilesResourceEntry(Context context, FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, Resources resources, int i) {
|
||||
FontResourcesParserCompat.FontFileResourceEntry findBestEntry = findBestEntry(fontFamilyFilesResourceEntry, i);
|
||||
if (findBestEntry == null) {
|
||||
return null;
|
||||
}
|
||||
Typeface createFromResourcesFontFile = TypefaceCompat.createFromResourcesFontFile(context, resources, findBestEntry.getResourceId(), findBestEntry.getFileName(), 0, i);
|
||||
addFontFamily(createFromResourcesFontFile, fontFamilyFilesResourceEntry);
|
||||
return createFromResourcesFontFile;
|
||||
}
|
||||
|
||||
Typeface createFromFontFamilyFilesResourceEntry(Context context, FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry, Resources resources, int i, boolean z) {
|
||||
FontResourcesParserCompat.FontFileResourceEntry findBestEntry = findBestEntry(fontFamilyFilesResourceEntry, i, z);
|
||||
if (findBestEntry == null) {
|
||||
return null;
|
||||
}
|
||||
Typeface createFromResourcesFontFile = TypefaceCompat.createFromResourcesFontFile(context, resources, findBestEntry.getResourceId(), findBestEntry.getFileName(), 0, 0);
|
||||
addFontFamily(createFromResourcesFontFile, fontFamilyFilesResourceEntry);
|
||||
return createFromResourcesFontFile;
|
||||
}
|
||||
|
||||
public Typeface createFromResourcesFontFile(Context context, Resources resources, int i, String str, int i2) {
|
||||
File tempFile = TypefaceCompatUtil.getTempFile(context);
|
||||
if (tempFile == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (TypefaceCompatUtil.copyToFile(tempFile, resources, i)) {
|
||||
return Typeface.createFromFile(tempFile.getPath());
|
||||
}
|
||||
return null;
|
||||
} catch (RuntimeException unused) {
|
||||
return null;
|
||||
} finally {
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
Typeface createWeightStyle(Context context, Typeface typeface, int i, boolean z) {
|
||||
Typeface typeface2;
|
||||
try {
|
||||
typeface2 = WeightTypefaceApi14.createWeightStyle(this, context, typeface, i, z);
|
||||
} catch (RuntimeException unused) {
|
||||
typeface2 = null;
|
||||
}
|
||||
return typeface2 == null ? typeface : typeface2;
|
||||
}
|
||||
|
||||
FontResourcesParserCompat.FontFamilyFilesResourceEntry getFontFamily(Typeface typeface) {
|
||||
long uniqueKey = getUniqueKey(typeface);
|
||||
if (uniqueKey == 0) {
|
||||
return null;
|
||||
}
|
||||
return this.mFontFamilies.get(Long.valueOf(uniqueKey));
|
||||
}
|
||||
|
||||
private void addFontFamily(Typeface typeface, FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamilyFilesResourceEntry) {
|
||||
long uniqueKey = getUniqueKey(typeface);
|
||||
if (uniqueKey != 0) {
|
||||
this.mFontFamilies.put(Long.valueOf(uniqueKey), fontFamilyFilesResourceEntry);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.Process;
|
||||
import android.os.StrictMode;
|
||||
import android.util.Log;
|
||||
import androidx.core.provider.FontsContractCompat;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TypefaceCompatUtil {
|
||||
private static final String CACHE_FILE_PREFIX = ".font";
|
||||
private static final String TAG = "TypefaceCompatUtil";
|
||||
|
||||
private TypefaceCompatUtil() {
|
||||
}
|
||||
|
||||
public static File getTempFile(Context context) {
|
||||
File cacheDir = context.getCacheDir();
|
||||
if (cacheDir == null) {
|
||||
return null;
|
||||
}
|
||||
String str = CACHE_FILE_PREFIX + Process.myPid() + "-" + Process.myTid() + "-";
|
||||
for (int i = 0; i < 100; i++) {
|
||||
File file = new File(cacheDir, str + i);
|
||||
if (file.createNewFile()) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ByteBuffer mmap(File file) {
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
try {
|
||||
FileChannel channel = fileInputStream.getChannel();
|
||||
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0L, channel.size());
|
||||
fileInputStream.close();
|
||||
return map;
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ByteBuffer mmap(Context context, CancellationSignal cancellationSignal, Uri uri) {
|
||||
try {
|
||||
ParcelFileDescriptor openFileDescriptor = Api19Impl.openFileDescriptor(context.getContentResolver(), uri, "r", cancellationSignal);
|
||||
if (openFileDescriptor == null) {
|
||||
if (openFileDescriptor != null) {
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(openFileDescriptor.getFileDescriptor());
|
||||
try {
|
||||
FileChannel channel = fileInputStream.getChannel();
|
||||
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0L, channel.size());
|
||||
fileInputStream.close();
|
||||
if (openFileDescriptor != null) {
|
||||
openFileDescriptor.close();
|
||||
}
|
||||
return map;
|
||||
} finally {
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ByteBuffer copyToDirectBuffer(Context context, Resources resources, int i) {
|
||||
File tempFile = getTempFile(context);
|
||||
if (tempFile == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (copyToFile(tempFile, resources, i)) {
|
||||
return mmap(tempFile);
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean copyToFile(File file, InputStream inputStream) {
|
||||
FileOutputStream fileOutputStream;
|
||||
StrictMode.ThreadPolicy allowThreadDiskWrites = StrictMode.allowThreadDiskWrites();
|
||||
FileOutputStream fileOutputStream2 = null;
|
||||
try {
|
||||
try {
|
||||
fileOutputStream = new FileOutputStream(file, false);
|
||||
} catch (IOException e) {
|
||||
e = e;
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
}
|
||||
try {
|
||||
byte[] bArr = new byte[1024];
|
||||
while (true) {
|
||||
int read = inputStream.read(bArr);
|
||||
if (read != -1) {
|
||||
fileOutputStream.write(bArr, 0, read);
|
||||
} else {
|
||||
closeQuietly(fileOutputStream);
|
||||
StrictMode.setThreadPolicy(allowThreadDiskWrites);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
e = e2;
|
||||
fileOutputStream2 = fileOutputStream;
|
||||
Log.e(TAG, "Error copying resource contents to temp file: " + e.getMessage());
|
||||
closeQuietly(fileOutputStream2);
|
||||
StrictMode.setThreadPolicy(allowThreadDiskWrites);
|
||||
return false;
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
fileOutputStream2 = fileOutputStream;
|
||||
closeQuietly(fileOutputStream2);
|
||||
StrictMode.setThreadPolicy(allowThreadDiskWrites);
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean copyToFile(File file, Resources resources, int i) {
|
||||
InputStream inputStream;
|
||||
try {
|
||||
inputStream = resources.openRawResource(i);
|
||||
try {
|
||||
boolean copyToFile = copyToFile(file, inputStream);
|
||||
closeQuietly(inputStream);
|
||||
return copyToFile;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
closeQuietly(inputStream);
|
||||
throw th;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
inputStream = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeQuietly(Closeable closeable) {
|
||||
if (closeable != null) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<Uri, ByteBuffer> readFontInfoIntoByteBuffer(Context context, FontsContractCompat.FontInfo[] fontInfoArr, CancellationSignal cancellationSignal) {
|
||||
HashMap hashMap = new HashMap();
|
||||
for (FontsContractCompat.FontInfo fontInfo : fontInfoArr) {
|
||||
if (fontInfo.getResultCode() == 0) {
|
||||
Uri uri = fontInfo.getUri();
|
||||
if (!hashMap.containsKey(uri)) {
|
||||
hashMap.put(uri, mmap(context, cancellationSignal, uri));
|
||||
}
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableMap(hashMap);
|
||||
}
|
||||
|
||||
static class Api19Impl {
|
||||
private Api19Impl() {
|
||||
}
|
||||
|
||||
static ParcelFileDescriptor openFileDescriptor(ContentResolver contentResolver, Uri uri, String str, CancellationSignal cancellationSignal) throws FileNotFoundException {
|
||||
return contentResolver.openFileDescriptor(uri, str, cancellationSignal);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.core.content.res.FontResourcesParserCompat;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class WeightTypefaceApi14 {
|
||||
private static final String NATIVE_INSTANCE_FIELD = "native_instance";
|
||||
private static final String TAG = "WeightTypeface";
|
||||
private static final Field sNativeInstance;
|
||||
private static final Object sWeightCacheLock;
|
||||
private static final LongSparseArray<SparseArray<Typeface>> sWeightTypefaceCache;
|
||||
|
||||
private static boolean isPrivateApiAvailable() {
|
||||
return sNativeInstance != null;
|
||||
}
|
||||
|
||||
static {
|
||||
Field field;
|
||||
try {
|
||||
field = Typeface.class.getDeclaredField(NATIVE_INSTANCE_FIELD);
|
||||
field.setAccessible(true);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, e.getClass().getName(), e);
|
||||
field = null;
|
||||
}
|
||||
sNativeInstance = field;
|
||||
sWeightTypefaceCache = new LongSparseArray<>(3);
|
||||
sWeightCacheLock = new Object();
|
||||
}
|
||||
|
||||
static Typeface createWeightStyle(TypefaceCompatBaseImpl typefaceCompatBaseImpl, Context context, Typeface typeface, int i, boolean z) {
|
||||
if (!isPrivateApiAvailable()) {
|
||||
return null;
|
||||
}
|
||||
int i2 = (i << 1) | (z ? 1 : 0);
|
||||
synchronized (sWeightCacheLock) {
|
||||
long nativeInstance = getNativeInstance(typeface);
|
||||
LongSparseArray<SparseArray<Typeface>> longSparseArray = sWeightTypefaceCache;
|
||||
SparseArray<Typeface> sparseArray = longSparseArray.get(nativeInstance);
|
||||
if (sparseArray == null) {
|
||||
sparseArray = new SparseArray<>(4);
|
||||
longSparseArray.put(nativeInstance, sparseArray);
|
||||
} else {
|
||||
Typeface typeface2 = sparseArray.get(i2);
|
||||
if (typeface2 != null) {
|
||||
return typeface2;
|
||||
}
|
||||
}
|
||||
Typeface bestFontFromFamily = getBestFontFromFamily(typefaceCompatBaseImpl, context, typeface, i, z);
|
||||
if (bestFontFromFamily == null) {
|
||||
bestFontFromFamily = platformTypefaceCreate(typeface, i, z);
|
||||
}
|
||||
sparseArray.put(i2, bestFontFromFamily);
|
||||
return bestFontFromFamily;
|
||||
}
|
||||
}
|
||||
|
||||
private static Typeface platformTypefaceCreate(Typeface typeface, int i, boolean z) {
|
||||
int i2 = 1;
|
||||
boolean z2 = i >= 600;
|
||||
if (!z2 && !z) {
|
||||
i2 = 0;
|
||||
} else if (!z2) {
|
||||
i2 = 2;
|
||||
} else if (z) {
|
||||
i2 = 3;
|
||||
}
|
||||
return Typeface.create(typeface, i2);
|
||||
}
|
||||
|
||||
private static Typeface getBestFontFromFamily(TypefaceCompatBaseImpl typefaceCompatBaseImpl, Context context, Typeface typeface, int i, boolean z) {
|
||||
FontResourcesParserCompat.FontFamilyFilesResourceEntry fontFamily = typefaceCompatBaseImpl.getFontFamily(typeface);
|
||||
if (fontFamily == null) {
|
||||
return null;
|
||||
}
|
||||
return typefaceCompatBaseImpl.createFromFontFamilyFilesResourceEntry(context, fontFamily, context.getResources(), i, z);
|
||||
}
|
||||
|
||||
private static long getNativeInstance(Typeface typeface) {
|
||||
try {
|
||||
return ((Number) sNativeInstance.get(typeface)).longValue();
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private WeightTypefaceApi14() {
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class WeightTypefaceApi21 {
|
||||
private static final String NATIVE_CREATE_FROM_TYPEFACE_METHOD = "nativeCreateFromTypeface";
|
||||
private static final String NATIVE_CREATE_WEIGHT_ALIAS_METHOD = "nativeCreateWeightAlias";
|
||||
private static final String NATIVE_INSTANCE_FIELD = "native_instance";
|
||||
private static final String TAG = "WeightTypeface";
|
||||
private static final Constructor<Typeface> sConstructor;
|
||||
private static final Method sNativeCreateFromTypeface;
|
||||
private static final Method sNativeCreateWeightAlias;
|
||||
private static final Field sNativeInstance;
|
||||
private static final Object sWeightCacheLock;
|
||||
private static final LongSparseArray<SparseArray<Typeface>> sWeightTypefaceCache;
|
||||
|
||||
private static boolean isPrivateApiAvailable() {
|
||||
return sNativeInstance != null;
|
||||
}
|
||||
|
||||
static {
|
||||
Field field;
|
||||
Method method;
|
||||
Method method2;
|
||||
Constructor<Typeface> constructor;
|
||||
try {
|
||||
field = Typeface.class.getDeclaredField(NATIVE_INSTANCE_FIELD);
|
||||
method = Typeface.class.getDeclaredMethod(NATIVE_CREATE_FROM_TYPEFACE_METHOD, Long.TYPE, Integer.TYPE);
|
||||
method.setAccessible(true);
|
||||
method2 = Typeface.class.getDeclaredMethod(NATIVE_CREATE_WEIGHT_ALIAS_METHOD, Long.TYPE, Integer.TYPE);
|
||||
method2.setAccessible(true);
|
||||
constructor = Typeface.class.getDeclaredConstructor(Long.TYPE);
|
||||
constructor.setAccessible(true);
|
||||
} catch (NoSuchFieldException | NoSuchMethodException e) {
|
||||
Log.e(TAG, e.getClass().getName(), e);
|
||||
field = null;
|
||||
method = null;
|
||||
method2 = null;
|
||||
constructor = null;
|
||||
}
|
||||
sNativeInstance = field;
|
||||
sNativeCreateFromTypeface = method;
|
||||
sNativeCreateWeightAlias = method2;
|
||||
sConstructor = constructor;
|
||||
sWeightTypefaceCache = new LongSparseArray<>(3);
|
||||
sWeightCacheLock = new Object();
|
||||
}
|
||||
|
||||
static Typeface createWeightStyle(Typeface typeface, int i, boolean z) {
|
||||
Typeface create;
|
||||
if (!isPrivateApiAvailable()) {
|
||||
return null;
|
||||
}
|
||||
int i2 = (i << 1) | (z ? 1 : 0);
|
||||
synchronized (sWeightCacheLock) {
|
||||
long nativeInstance = getNativeInstance(typeface);
|
||||
LongSparseArray<SparseArray<Typeface>> longSparseArray = sWeightTypefaceCache;
|
||||
SparseArray<Typeface> sparseArray = longSparseArray.get(nativeInstance);
|
||||
if (sparseArray == null) {
|
||||
sparseArray = new SparseArray<>(4);
|
||||
longSparseArray.put(nativeInstance, sparseArray);
|
||||
} else {
|
||||
Typeface typeface2 = sparseArray.get(i2);
|
||||
if (typeface2 != null) {
|
||||
return typeface2;
|
||||
}
|
||||
}
|
||||
if (z == typeface.isItalic()) {
|
||||
create = create(nativeCreateWeightAlias(nativeInstance, i));
|
||||
} else {
|
||||
create = create(nativeCreateFromTypefaceWithExactStyle(nativeInstance, i, z));
|
||||
}
|
||||
sparseArray.put(i2, create);
|
||||
return create;
|
||||
}
|
||||
}
|
||||
|
||||
private static long getNativeInstance(Typeface typeface) {
|
||||
try {
|
||||
return sNativeInstance.getLong(typeface);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static long nativeCreateFromTypefaceWithExactStyle(long j, int i, boolean z) {
|
||||
try {
|
||||
return ((Long) sNativeCreateWeightAlias.invoke(null, Long.valueOf(((Long) sNativeCreateFromTypeface.invoke(null, Long.valueOf(j), Integer.valueOf(z ? 2 : 0))).longValue()), Integer.valueOf(i))).longValue();
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InvocationTargetException e2) {
|
||||
throw new RuntimeException(e2);
|
||||
}
|
||||
}
|
||||
|
||||
private static long nativeCreateWeightAlias(long j, int i) {
|
||||
try {
|
||||
return ((Long) sNativeCreateWeightAlias.invoke(null, Long.valueOf(j), Integer.valueOf(i))).longValue();
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InvocationTargetException e2) {
|
||||
throw new RuntimeException(e2);
|
||||
}
|
||||
}
|
||||
|
||||
private static Typeface create(long j) {
|
||||
try {
|
||||
return sConstructor.newInstance(Long.valueOf(j));
|
||||
} catch (IllegalAccessException | InstantiationException | InvocationTargetException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private WeightTypefaceApi21() {
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package androidx.core.graphics;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class WeightTypefaceApi26 {
|
||||
private static final String NATIVE_CREATE_FROM_TYPEFACE_WITH_EXACT_STYLE_METHOD = "nativeCreateFromTypefaceWithExactStyle";
|
||||
private static final String NATIVE_INSTANCE_FIELD = "native_instance";
|
||||
private static final String TAG = "WeightTypeface";
|
||||
private static final Constructor<Typeface> sConstructor;
|
||||
private static final Method sNativeCreateFromTypefaceWithExactStyle;
|
||||
private static final Field sNativeInstance;
|
||||
private static final Object sWeightCacheLock;
|
||||
private static final LongSparseArray<SparseArray<Typeface>> sWeightTypefaceCache;
|
||||
|
||||
private static boolean isPrivateApiAvailable() {
|
||||
return sNativeInstance != null;
|
||||
}
|
||||
|
||||
static {
|
||||
Field field;
|
||||
Method method;
|
||||
Constructor<Typeface> constructor;
|
||||
try {
|
||||
field = Typeface.class.getDeclaredField(NATIVE_INSTANCE_FIELD);
|
||||
method = Typeface.class.getDeclaredMethod(NATIVE_CREATE_FROM_TYPEFACE_WITH_EXACT_STYLE_METHOD, Long.TYPE, Integer.TYPE, Boolean.TYPE);
|
||||
method.setAccessible(true);
|
||||
constructor = Typeface.class.getDeclaredConstructor(Long.TYPE);
|
||||
constructor.setAccessible(true);
|
||||
} catch (NoSuchFieldException | NoSuchMethodException e) {
|
||||
Log.e(TAG, e.getClass().getName(), e);
|
||||
field = null;
|
||||
method = null;
|
||||
constructor = null;
|
||||
}
|
||||
sNativeInstance = field;
|
||||
sNativeCreateFromTypefaceWithExactStyle = method;
|
||||
sConstructor = constructor;
|
||||
sWeightTypefaceCache = new LongSparseArray<>(3);
|
||||
sWeightCacheLock = new Object();
|
||||
}
|
||||
|
||||
static Typeface createWeightStyle(Typeface typeface, int i, boolean z) {
|
||||
if (!isPrivateApiAvailable()) {
|
||||
return null;
|
||||
}
|
||||
int i2 = (i << 1) | (z ? 1 : 0);
|
||||
synchronized (sWeightCacheLock) {
|
||||
long nativeInstance = getNativeInstance(typeface);
|
||||
LongSparseArray<SparseArray<Typeface>> longSparseArray = sWeightTypefaceCache;
|
||||
SparseArray<Typeface> sparseArray = longSparseArray.get(nativeInstance);
|
||||
if (sparseArray == null) {
|
||||
sparseArray = new SparseArray<>(4);
|
||||
longSparseArray.put(nativeInstance, sparseArray);
|
||||
} else {
|
||||
Typeface typeface2 = sparseArray.get(i2);
|
||||
if (typeface2 != null) {
|
||||
return typeface2;
|
||||
}
|
||||
}
|
||||
Typeface create = create(nativeCreateFromTypefaceWithExactStyle(nativeInstance, i, z));
|
||||
sparseArray.put(i2, create);
|
||||
return create;
|
||||
}
|
||||
}
|
||||
|
||||
private static long getNativeInstance(Typeface typeface) {
|
||||
try {
|
||||
return sNativeInstance.getLong(typeface);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static long nativeCreateFromTypefaceWithExactStyle(long j, int i, boolean z) {
|
||||
try {
|
||||
return ((Long) sNativeCreateFromTypefaceWithExactStyle.invoke(null, Long.valueOf(j), Integer.valueOf(i), Boolean.valueOf(z))).longValue();
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InvocationTargetException e2) {
|
||||
throw new RuntimeException(e2);
|
||||
}
|
||||
}
|
||||
|
||||
private static Typeface create(long j) {
|
||||
try {
|
||||
return sConstructor.newInstance(Long.valueOf(j));
|
||||
} catch (IllegalAccessException | InstantiationException | InvocationTargetException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private WeightTypefaceApi26() {
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: BitmapDrawable.kt */
|
||||
@Metadata(d1 = {"\u0000\u0012\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u0004H\u0086\b¨\u0006\u0005"}, d2 = {"toDrawable", "Landroid/graphics/drawable/BitmapDrawable;", "Landroid/graphics/Bitmap;", "resources", "Landroid/content/res/Resources;", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class BitmapDrawableKt {
|
||||
public static final BitmapDrawable toDrawable(Bitmap bitmap, Resources resources) {
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
Intrinsics.checkNotNullParameter(resources, "resources");
|
||||
return new BitmapDrawable(resources, bitmap);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: ColorDrawable.kt */
|
||||
@Metadata(d1 = {"\u0000\u0010\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0087\b\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0003H\u0086\b¨\u0006\u0004"}, d2 = {"toDrawable", "Landroid/graphics/drawable/ColorDrawable;", "Landroid/graphics/Color;", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class ColorDrawableKt {
|
||||
public static final ColorDrawable toDrawable(int i) {
|
||||
return new ColorDrawable(i);
|
||||
}
|
||||
|
||||
public static final ColorDrawable toDrawable(Color color) {
|
||||
int argb;
|
||||
Intrinsics.checkNotNullParameter(color, "<this>");
|
||||
argb = color.toArgb();
|
||||
return new ColorDrawable(argb);
|
||||
}
|
||||
}
|
@ -0,0 +1,250 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class DrawableCompat {
|
||||
private static final String TAG = "DrawableCompat";
|
||||
private static Method sGetLayoutDirectionMethod;
|
||||
private static boolean sGetLayoutDirectionMethodFetched;
|
||||
private static Method sSetLayoutDirectionMethod;
|
||||
private static boolean sSetLayoutDirectionMethodFetched;
|
||||
|
||||
@Deprecated
|
||||
public static void jumpToCurrentState(Drawable drawable) {
|
||||
drawable.jumpToCurrentState();
|
||||
}
|
||||
|
||||
public static void setAutoMirrored(Drawable drawable, boolean z) {
|
||||
Api19Impl.setAutoMirrored(drawable, z);
|
||||
}
|
||||
|
||||
public static boolean isAutoMirrored(Drawable drawable) {
|
||||
return Api19Impl.isAutoMirrored(drawable);
|
||||
}
|
||||
|
||||
public static void setHotspot(Drawable drawable, float f, float f2) {
|
||||
Api21Impl.setHotspot(drawable, f, f2);
|
||||
}
|
||||
|
||||
public static void setHotspotBounds(Drawable drawable, int i, int i2, int i3, int i4) {
|
||||
Api21Impl.setHotspotBounds(drawable, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
public static void setTint(Drawable drawable, int i) {
|
||||
Api21Impl.setTint(drawable, i);
|
||||
}
|
||||
|
||||
public static void setTintList(Drawable drawable, ColorStateList colorStateList) {
|
||||
Api21Impl.setTintList(drawable, colorStateList);
|
||||
}
|
||||
|
||||
public static void setTintMode(Drawable drawable, PorterDuff.Mode mode) {
|
||||
Api21Impl.setTintMode(drawable, mode);
|
||||
}
|
||||
|
||||
public static int getAlpha(Drawable drawable) {
|
||||
return Api19Impl.getAlpha(drawable);
|
||||
}
|
||||
|
||||
public static void applyTheme(Drawable drawable, Resources.Theme theme) {
|
||||
Api21Impl.applyTheme(drawable, theme);
|
||||
}
|
||||
|
||||
public static boolean canApplyTheme(Drawable drawable) {
|
||||
return Api21Impl.canApplyTheme(drawable);
|
||||
}
|
||||
|
||||
public static ColorFilter getColorFilter(Drawable drawable) {
|
||||
return Api21Impl.getColorFilter(drawable);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public static void clearColorFilter(Drawable drawable) {
|
||||
DrawableContainer.DrawableContainerState drawableContainerState;
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
drawable.clearColorFilter();
|
||||
return;
|
||||
}
|
||||
drawable.clearColorFilter();
|
||||
if (drawable instanceof InsetDrawable) {
|
||||
clearColorFilter(Api19Impl.getDrawable((InsetDrawable) drawable));
|
||||
return;
|
||||
}
|
||||
if (drawable instanceof WrappedDrawable) {
|
||||
clearColorFilter(((WrappedDrawable) drawable).getWrappedDrawable());
|
||||
return;
|
||||
}
|
||||
if (!(drawable instanceof DrawableContainer) || (drawableContainerState = (DrawableContainer.DrawableContainerState) ((DrawableContainer) drawable).getConstantState()) == null) {
|
||||
return;
|
||||
}
|
||||
int childCount = drawableContainerState.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
Drawable child = Api19Impl.getChild(drawableContainerState, i);
|
||||
if (child != null) {
|
||||
clearColorFilter(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void inflate(Drawable drawable, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
Api21Impl.inflate(drawable, resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
|
||||
public static Drawable wrap(Drawable drawable) {
|
||||
return (Build.VERSION.SDK_INT < 23 && !(drawable instanceof TintAwareDrawable)) ? new WrappedDrawableApi21(drawable) : drawable;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public static <T extends Drawable> T unwrap(Drawable drawable) {
|
||||
return drawable instanceof WrappedDrawable ? (T) ((WrappedDrawable) drawable).getWrappedDrawable() : drawable;
|
||||
}
|
||||
|
||||
public static boolean setLayoutDirection(Drawable drawable, int i) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.setLayoutDirection(drawable, i);
|
||||
}
|
||||
if (!sSetLayoutDirectionMethodFetched) {
|
||||
try {
|
||||
Method declaredMethod = Drawable.class.getDeclaredMethod("setLayoutDirection", Integer.TYPE);
|
||||
sSetLayoutDirectionMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Log.i(TAG, "Failed to retrieve setLayoutDirection(int) method", e);
|
||||
}
|
||||
sSetLayoutDirectionMethodFetched = true;
|
||||
}
|
||||
Method method = sSetLayoutDirectionMethod;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(drawable, Integer.valueOf(i));
|
||||
return true;
|
||||
} catch (Exception e2) {
|
||||
Log.i(TAG, "Failed to invoke setLayoutDirection(int) via reflection", e2);
|
||||
sSetLayoutDirectionMethod = null;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getLayoutDirection(Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.getLayoutDirection(drawable);
|
||||
}
|
||||
if (!sGetLayoutDirectionMethodFetched) {
|
||||
try {
|
||||
Method declaredMethod = Drawable.class.getDeclaredMethod("getLayoutDirection", new Class[0]);
|
||||
sGetLayoutDirectionMethod = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Log.i(TAG, "Failed to retrieve getLayoutDirection() method", e);
|
||||
}
|
||||
sGetLayoutDirectionMethodFetched = true;
|
||||
}
|
||||
Method method = sGetLayoutDirectionMethod;
|
||||
if (method != null) {
|
||||
try {
|
||||
return ((Integer) method.invoke(drawable, new Object[0])).intValue();
|
||||
} catch (Exception e2) {
|
||||
Log.i(TAG, "Failed to invoke getLayoutDirection() via reflection", e2);
|
||||
sGetLayoutDirectionMethod = null;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private DrawableCompat() {
|
||||
}
|
||||
|
||||
static class Api19Impl {
|
||||
private Api19Impl() {
|
||||
}
|
||||
|
||||
static void setAutoMirrored(Drawable drawable, boolean z) {
|
||||
drawable.setAutoMirrored(z);
|
||||
}
|
||||
|
||||
static boolean isAutoMirrored(Drawable drawable) {
|
||||
return drawable.isAutoMirrored();
|
||||
}
|
||||
|
||||
static int getAlpha(Drawable drawable) {
|
||||
return drawable.getAlpha();
|
||||
}
|
||||
|
||||
static Drawable getChild(DrawableContainer.DrawableContainerState drawableContainerState, int i) {
|
||||
return drawableContainerState.getChild(i);
|
||||
}
|
||||
|
||||
static Drawable getDrawable(InsetDrawable insetDrawable) {
|
||||
return insetDrawable.getDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
static void setHotspot(Drawable drawable, float f, float f2) {
|
||||
drawable.setHotspot(f, f2);
|
||||
}
|
||||
|
||||
static void setTint(Drawable drawable, int i) {
|
||||
drawable.setTint(i);
|
||||
}
|
||||
|
||||
static void setTintList(Drawable drawable, ColorStateList colorStateList) {
|
||||
drawable.setTintList(colorStateList);
|
||||
}
|
||||
|
||||
static void setTintMode(Drawable drawable, PorterDuff.Mode mode) {
|
||||
drawable.setTintMode(mode);
|
||||
}
|
||||
|
||||
static void applyTheme(Drawable drawable, Resources.Theme theme) {
|
||||
drawable.applyTheme(theme);
|
||||
}
|
||||
|
||||
static boolean canApplyTheme(Drawable drawable) {
|
||||
return drawable.canApplyTheme();
|
||||
}
|
||||
|
||||
static ColorFilter getColorFilter(Drawable drawable) {
|
||||
return drawable.getColorFilter();
|
||||
}
|
||||
|
||||
static void inflate(Drawable drawable, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
||||
drawable.inflate(resources, xmlPullParser, attributeSet, theme);
|
||||
}
|
||||
|
||||
static void setHotspotBounds(Drawable drawable, int i, int i2, int i3, int i4) {
|
||||
drawable.setHotspotBounds(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static boolean setLayoutDirection(Drawable drawable, int i) {
|
||||
return drawable.setLayoutDirection(i);
|
||||
}
|
||||
|
||||
static int getLayoutDirection(Drawable drawable) {
|
||||
return drawable.getLayoutDirection();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Drawable.kt */
|
||||
@Metadata(d1 = {"\u0000$\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0005\u001a*\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\b\b\u0003\u0010\u0003\u001a\u00020\u00042\b\b\u0003\u0010\u0005\u001a\u00020\u00042\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u0007\u001a,\u0010\b\u001a\u0004\u0018\u00010\u0001*\u00020\u00022\b\b\u0003\u0010\u0003\u001a\u00020\u00042\b\b\u0003\u0010\u0005\u001a\u00020\u00042\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u0007\u001a2\u0010\t\u001a\u00020\n*\u00020\u00022\b\b\u0003\u0010\u000b\u001a\u00020\u00042\b\b\u0003\u0010\f\u001a\u00020\u00042\b\b\u0003\u0010\r\u001a\u00020\u00042\b\b\u0003\u0010\u000e\u001a\u00020\u0004¨\u0006\u000f"}, d2 = {"toBitmap", "Landroid/graphics/Bitmap;", "Landroid/graphics/drawable/Drawable;", "width", "", "height", "config", "Landroid/graphics/Bitmap$Config;", "toBitmapOrNull", "updateBounds", "", "left", "top", "right", "bottom", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class DrawableKt {
|
||||
public static /* synthetic */ Bitmap toBitmap$default(Drawable drawable, int i, int i2, Bitmap.Config config, int i3, Object obj) {
|
||||
if ((i3 & 1) != 0) {
|
||||
i = drawable.getIntrinsicWidth();
|
||||
}
|
||||
if ((i3 & 2) != 0) {
|
||||
i2 = drawable.getIntrinsicHeight();
|
||||
}
|
||||
if ((i3 & 4) != 0) {
|
||||
config = null;
|
||||
}
|
||||
return toBitmap(drawable, i, i2, config);
|
||||
}
|
||||
|
||||
public static final Bitmap toBitmap(Drawable drawable, int i, int i2, Bitmap.Config config) {
|
||||
Intrinsics.checkNotNullParameter(drawable, "<this>");
|
||||
if (drawable instanceof BitmapDrawable) {
|
||||
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
|
||||
if (bitmapDrawable.getBitmap() == null) {
|
||||
throw new IllegalArgumentException("bitmap is null");
|
||||
}
|
||||
if (config == null || bitmapDrawable.getBitmap().getConfig() == config) {
|
||||
if (i == bitmapDrawable.getBitmap().getWidth() && i2 == bitmapDrawable.getBitmap().getHeight()) {
|
||||
Bitmap bitmap = bitmapDrawable.getBitmap();
|
||||
Intrinsics.checkNotNullExpressionValue(bitmap, "bitmap");
|
||||
return bitmap;
|
||||
}
|
||||
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), i, i2, true);
|
||||
Intrinsics.checkNotNullExpressionValue(createScaledBitmap, "createScaledBitmap(bitmap, width, height, true)");
|
||||
return createScaledBitmap;
|
||||
}
|
||||
}
|
||||
Rect bounds = drawable.getBounds();
|
||||
Intrinsics.checkNotNullExpressionValue(bounds, "bounds");
|
||||
int i3 = bounds.left;
|
||||
int i4 = bounds.top;
|
||||
int i5 = bounds.right;
|
||||
int i6 = bounds.bottom;
|
||||
if (config == null) {
|
||||
config = Bitmap.Config.ARGB_8888;
|
||||
}
|
||||
Bitmap bitmap2 = Bitmap.createBitmap(i, i2, config);
|
||||
drawable.setBounds(0, 0, i, i2);
|
||||
drawable.draw(new Canvas(bitmap2));
|
||||
drawable.setBounds(i3, i4, i5, i6);
|
||||
Intrinsics.checkNotNullExpressionValue(bitmap2, "bitmap");
|
||||
return bitmap2;
|
||||
}
|
||||
|
||||
public static /* synthetic */ Bitmap toBitmapOrNull$default(Drawable drawable, int i, int i2, Bitmap.Config config, int i3, Object obj) {
|
||||
if ((i3 & 1) != 0) {
|
||||
i = drawable.getIntrinsicWidth();
|
||||
}
|
||||
if ((i3 & 2) != 0) {
|
||||
i2 = drawable.getIntrinsicHeight();
|
||||
}
|
||||
if ((i3 & 4) != 0) {
|
||||
config = null;
|
||||
}
|
||||
return toBitmapOrNull(drawable, i, i2, config);
|
||||
}
|
||||
|
||||
public static final Bitmap toBitmapOrNull(Drawable drawable, int i, int i2, Bitmap.Config config) {
|
||||
Intrinsics.checkNotNullParameter(drawable, "<this>");
|
||||
if ((drawable instanceof BitmapDrawable) && ((BitmapDrawable) drawable).getBitmap() == null) {
|
||||
return null;
|
||||
}
|
||||
return toBitmap(drawable, i, i2, config);
|
||||
}
|
||||
|
||||
public static /* synthetic */ void updateBounds$default(Drawable drawable, int i, int i2, int i3, int i4, int i5, Object obj) {
|
||||
if ((i5 & 1) != 0) {
|
||||
i = drawable.getBounds().left;
|
||||
}
|
||||
if ((i5 & 2) != 0) {
|
||||
i2 = drawable.getBounds().top;
|
||||
}
|
||||
if ((i5 & 4) != 0) {
|
||||
i3 = drawable.getBounds().right;
|
||||
}
|
||||
if ((i5 & 8) != 0) {
|
||||
i4 = drawable.getBounds().bottom;
|
||||
}
|
||||
updateBounds(drawable, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
public static final void updateBounds(Drawable drawable, int i, int i2, int i3, int i4) {
|
||||
Intrinsics.checkNotNullParameter(drawable, "<this>");
|
||||
drawable.setBounds(i, i2, i3, i4);
|
||||
}
|
||||
}
|
@ -0,0 +1,894 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.AdaptiveIconDrawable;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.util.ObjectsCompat;
|
||||
import androidx.core.util.Preconditions;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.versionedparcelable.CustomVersionedParcelable;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class IconCompat extends CustomVersionedParcelable {
|
||||
private static final float ADAPTIVE_ICON_INSET_FACTOR = 0.25f;
|
||||
private static final int AMBIENT_SHADOW_ALPHA = 30;
|
||||
private static final float BLUR_FACTOR = 0.010416667f;
|
||||
static final PorterDuff.Mode DEFAULT_TINT_MODE = PorterDuff.Mode.SRC_IN;
|
||||
private static final float DEFAULT_VIEW_PORT_SCALE = 0.6666667f;
|
||||
static final String EXTRA_INT1 = "int1";
|
||||
static final String EXTRA_INT2 = "int2";
|
||||
static final String EXTRA_OBJ = "obj";
|
||||
static final String EXTRA_STRING1 = "string1";
|
||||
static final String EXTRA_TINT_LIST = "tint_list";
|
||||
static final String EXTRA_TINT_MODE = "tint_mode";
|
||||
static final String EXTRA_TYPE = "type";
|
||||
private static final float ICON_DIAMETER_FACTOR = 0.9166667f;
|
||||
private static final int KEY_SHADOW_ALPHA = 61;
|
||||
private static final float KEY_SHADOW_OFFSET_FACTOR = 0.020833334f;
|
||||
private static final String TAG = "IconCompat";
|
||||
public static final int TYPE_ADAPTIVE_BITMAP = 5;
|
||||
public static final int TYPE_BITMAP = 1;
|
||||
public static final int TYPE_DATA = 3;
|
||||
public static final int TYPE_RESOURCE = 2;
|
||||
public static final int TYPE_UNKNOWN = -1;
|
||||
public static final int TYPE_URI = 4;
|
||||
public static final int TYPE_URI_ADAPTIVE_BITMAP = 6;
|
||||
public byte[] mData;
|
||||
public int mInt1;
|
||||
public int mInt2;
|
||||
Object mObj1;
|
||||
public Parcelable mParcelable;
|
||||
public String mString1;
|
||||
public ColorStateList mTintList;
|
||||
PorterDuff.Mode mTintMode;
|
||||
public String mTintModeStr;
|
||||
public int mType;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface IconType {
|
||||
}
|
||||
|
||||
private static String typeToString(int i) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
return "BITMAP";
|
||||
case 2:
|
||||
return "RESOURCE";
|
||||
case 3:
|
||||
return "DATA";
|
||||
case 4:
|
||||
return "URI";
|
||||
case 5:
|
||||
return "BITMAP_MASKABLE";
|
||||
case 6:
|
||||
return "URI_MASKABLE";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
public IconCompat setTintList(ColorStateList colorStateList) {
|
||||
this.mTintList = colorStateList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IconCompat setTintMode(PorterDuff.Mode mode) {
|
||||
this.mTintMode = mode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static IconCompat createWithResource(Context context, int i) {
|
||||
ObjectsCompat.requireNonNull(context);
|
||||
return createWithResource(context.getResources(), context.getPackageName(), i);
|
||||
}
|
||||
|
||||
public static IconCompat createWithResource(Resources resources, String str, int i) {
|
||||
ObjectsCompat.requireNonNull(str);
|
||||
if (i == 0) {
|
||||
throw new IllegalArgumentException("Drawable resource ID must not be 0");
|
||||
}
|
||||
IconCompat iconCompat = new IconCompat(2);
|
||||
iconCompat.mInt1 = i;
|
||||
if (resources != null) {
|
||||
try {
|
||||
iconCompat.mObj1 = resources.getResourceName(i);
|
||||
} catch (Resources.NotFoundException unused) {
|
||||
throw new IllegalArgumentException("Icon resource cannot be found");
|
||||
}
|
||||
} else {
|
||||
iconCompat.mObj1 = str;
|
||||
}
|
||||
iconCompat.mString1 = str;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
public static IconCompat createWithBitmap(Bitmap bitmap) {
|
||||
ObjectsCompat.requireNonNull(bitmap);
|
||||
IconCompat iconCompat = new IconCompat(1);
|
||||
iconCompat.mObj1 = bitmap;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
public static IconCompat createWithAdaptiveBitmap(Bitmap bitmap) {
|
||||
ObjectsCompat.requireNonNull(bitmap);
|
||||
IconCompat iconCompat = new IconCompat(5);
|
||||
iconCompat.mObj1 = bitmap;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
public static IconCompat createWithData(byte[] bArr, int i, int i2) {
|
||||
ObjectsCompat.requireNonNull(bArr);
|
||||
IconCompat iconCompat = new IconCompat(3);
|
||||
iconCompat.mObj1 = bArr;
|
||||
iconCompat.mInt1 = i;
|
||||
iconCompat.mInt2 = i2;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
public static IconCompat createWithContentUri(String str) {
|
||||
ObjectsCompat.requireNonNull(str);
|
||||
IconCompat iconCompat = new IconCompat(4);
|
||||
iconCompat.mObj1 = str;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
public static IconCompat createWithContentUri(Uri uri) {
|
||||
ObjectsCompat.requireNonNull(uri);
|
||||
return createWithContentUri(uri.toString());
|
||||
}
|
||||
|
||||
public static IconCompat createWithAdaptiveBitmapContentUri(String str) {
|
||||
ObjectsCompat.requireNonNull(str);
|
||||
IconCompat iconCompat = new IconCompat(6);
|
||||
iconCompat.mObj1 = str;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
public static IconCompat createWithAdaptiveBitmapContentUri(Uri uri) {
|
||||
ObjectsCompat.requireNonNull(uri);
|
||||
return createWithAdaptiveBitmapContentUri(uri.toString());
|
||||
}
|
||||
|
||||
public IconCompat() {
|
||||
this.mType = -1;
|
||||
this.mData = null;
|
||||
this.mParcelable = null;
|
||||
this.mInt1 = 0;
|
||||
this.mInt2 = 0;
|
||||
this.mTintList = null;
|
||||
this.mTintMode = DEFAULT_TINT_MODE;
|
||||
this.mTintModeStr = null;
|
||||
}
|
||||
|
||||
IconCompat(int i) {
|
||||
this.mData = null;
|
||||
this.mParcelable = null;
|
||||
this.mInt1 = 0;
|
||||
this.mInt2 = 0;
|
||||
this.mTintList = null;
|
||||
this.mTintMode = DEFAULT_TINT_MODE;
|
||||
this.mTintModeStr = null;
|
||||
this.mType = i;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return (this.mType != -1 || Build.VERSION.SDK_INT < 23) ? this.mType : Api23Impl.getType(this.mObj1);
|
||||
}
|
||||
|
||||
public String getResPackage() {
|
||||
if (this.mType == -1 && Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.getResPackage(this.mObj1);
|
||||
}
|
||||
if (this.mType == 2) {
|
||||
String str = this.mString1;
|
||||
return (str == null || TextUtils.isEmpty(str)) ? ((String) this.mObj1).split(":", -1)[0] : this.mString1;
|
||||
}
|
||||
throw new IllegalStateException("called getResPackage() on " + this);
|
||||
}
|
||||
|
||||
public int getResId() {
|
||||
if (this.mType == -1 && Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.getResId(this.mObj1);
|
||||
}
|
||||
if (this.mType == 2) {
|
||||
return this.mInt1;
|
||||
}
|
||||
throw new IllegalStateException("called getResId() on " + this);
|
||||
}
|
||||
|
||||
public Bitmap getBitmap() {
|
||||
if (this.mType == -1 && Build.VERSION.SDK_INT >= 23) {
|
||||
Object obj = this.mObj1;
|
||||
if (obj instanceof Bitmap) {
|
||||
return (Bitmap) obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
int i = this.mType;
|
||||
if (i == 1) {
|
||||
return (Bitmap) this.mObj1;
|
||||
}
|
||||
if (i == 5) {
|
||||
return createLegacyIconFromAdaptiveIcon((Bitmap) this.mObj1, true);
|
||||
}
|
||||
throw new IllegalStateException("called getBitmap() on " + this);
|
||||
}
|
||||
|
||||
public Uri getUri() {
|
||||
if (this.mType == -1 && Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.getUri(this.mObj1);
|
||||
}
|
||||
int i = this.mType;
|
||||
if (i != 4 && i != 6) {
|
||||
throw new IllegalStateException("called getUri() on " + this);
|
||||
}
|
||||
return Uri.parse((String) this.mObj1);
|
||||
}
|
||||
|
||||
public IconCompat setTint(int i) {
|
||||
return setTintList(ColorStateList.valueOf(i));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Icon toIcon() {
|
||||
return toIcon(null);
|
||||
}
|
||||
|
||||
public Icon toIcon(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.toIcon(this, context);
|
||||
}
|
||||
throw new UnsupportedOperationException("This method is only supported on API level 23+");
|
||||
}
|
||||
|
||||
public void checkResource(Context context) {
|
||||
Object obj;
|
||||
if (this.mType != 2 || (obj = this.mObj1) == null) {
|
||||
return;
|
||||
}
|
||||
String str = (String) obj;
|
||||
if (str.contains(":")) {
|
||||
String str2 = str.split(":", -1)[1];
|
||||
String str3 = str2.split("/", -1)[0];
|
||||
String str4 = str2.split("/", -1)[1];
|
||||
String str5 = str.split(":", -1)[0];
|
||||
if ("0_resource_name_obfuscated".equals(str4)) {
|
||||
Log.i(TAG, "Found obfuscated resource, not trying to update resource id for it");
|
||||
return;
|
||||
}
|
||||
String resPackage = getResPackage();
|
||||
int identifier = getResources(context, resPackage).getIdentifier(str4, str3, str5);
|
||||
if (this.mInt1 != identifier) {
|
||||
Log.i(TAG, "Id has changed for " + resPackage + " " + str);
|
||||
this.mInt1 = identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable loadDrawable(Context context) {
|
||||
checkResource(context);
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.loadDrawable(toIcon(context), context);
|
||||
}
|
||||
Drawable loadDrawableInner = loadDrawableInner(context);
|
||||
if (loadDrawableInner != null && (this.mTintList != null || this.mTintMode != DEFAULT_TINT_MODE)) {
|
||||
loadDrawableInner.mutate();
|
||||
DrawableCompat.setTintList(loadDrawableInner, this.mTintList);
|
||||
DrawableCompat.setTintMode(loadDrawableInner, this.mTintMode);
|
||||
}
|
||||
return loadDrawableInner;
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
private Drawable loadDrawableInner(Context context) {
|
||||
switch (this.mType) {
|
||||
case 1:
|
||||
return new BitmapDrawable(context.getResources(), (Bitmap) this.mObj1);
|
||||
case 2:
|
||||
String resPackage = getResPackage();
|
||||
if (TextUtils.isEmpty(resPackage)) {
|
||||
resPackage = context.getPackageName();
|
||||
}
|
||||
try {
|
||||
return ResourcesCompat.getDrawable(getResources(context, resPackage), this.mInt1, context.getTheme());
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, String.format("Unable to load resource 0x%08x from pkg=%s", Integer.valueOf(this.mInt1), this.mObj1), e);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
return new BitmapDrawable(context.getResources(), BitmapFactory.decodeByteArray((byte[]) this.mObj1, this.mInt1, this.mInt2));
|
||||
case 4:
|
||||
InputStream uriInputStream = getUriInputStream(context);
|
||||
if (uriInputStream != null) {
|
||||
return new BitmapDrawable(context.getResources(), BitmapFactory.decodeStream(uriInputStream));
|
||||
}
|
||||
return null;
|
||||
case 5:
|
||||
return new BitmapDrawable(context.getResources(), createLegacyIconFromAdaptiveIcon((Bitmap) this.mObj1, false));
|
||||
case 6:
|
||||
InputStream uriInputStream2 = getUriInputStream(context);
|
||||
if (uriInputStream2 != null) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return Api26Impl.createAdaptiveIconDrawable(null, new BitmapDrawable(context.getResources(), BitmapFactory.decodeStream(uriInputStream2)));
|
||||
}
|
||||
return new BitmapDrawable(context.getResources(), createLegacyIconFromAdaptiveIcon(BitmapFactory.decodeStream(uriInputStream2), false));
|
||||
}
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public InputStream getUriInputStream(Context context) {
|
||||
Uri uri = getUri();
|
||||
String scheme = uri.getScheme();
|
||||
if ("content".equals(scheme) || "file".equals(scheme)) {
|
||||
try {
|
||||
return context.getContentResolver().openInputStream(uri);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Unable to load image from URI: " + uri, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return new FileInputStream(new File((String) this.mObj1));
|
||||
} catch (FileNotFoundException e2) {
|
||||
Log.w(TAG, "Unable to load image from path: " + uri, e2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static Resources getResources(Context context, String str) {
|
||||
if ("android".equals(str)) {
|
||||
return Resources.getSystem();
|
||||
}
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
try {
|
||||
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(str, 8192);
|
||||
if (applicationInfo != null) {
|
||||
return packageManager.getResourcesForApplication(applicationInfo);
|
||||
}
|
||||
return null;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(TAG, String.format("Unable to find pkg=%s for icon", str), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addToShortcutIntent(Intent intent, Drawable drawable, Context context) {
|
||||
Bitmap bitmap;
|
||||
checkResource(context);
|
||||
int i = this.mType;
|
||||
if (i == 1) {
|
||||
bitmap = (Bitmap) this.mObj1;
|
||||
if (drawable != null) {
|
||||
bitmap = bitmap.copy(bitmap.getConfig(), true);
|
||||
}
|
||||
} else if (i == 2) {
|
||||
try {
|
||||
Context createPackageContext = context.createPackageContext(getResPackage(), 0);
|
||||
if (drawable == null) {
|
||||
intent.putExtra("android.intent.extra.shortcut.ICON_RESOURCE", Intent.ShortcutIconResource.fromContext(createPackageContext, this.mInt1));
|
||||
return;
|
||||
}
|
||||
Drawable drawable2 = ContextCompat.getDrawable(createPackageContext, this.mInt1);
|
||||
if (drawable2.getIntrinsicWidth() > 0 && drawable2.getIntrinsicHeight() > 0) {
|
||||
bitmap = Bitmap.createBitmap(drawable2.getIntrinsicWidth(), drawable2.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||
drawable2.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
drawable2.draw(new Canvas(bitmap));
|
||||
}
|
||||
int launcherLargeIconSize = ((ActivityManager) createPackageContext.getSystemService("activity")).getLauncherLargeIconSize();
|
||||
bitmap = Bitmap.createBitmap(launcherLargeIconSize, launcherLargeIconSize, Bitmap.Config.ARGB_8888);
|
||||
drawable2.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
drawable2.draw(new Canvas(bitmap));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
throw new IllegalArgumentException("Can't find package " + this.mObj1, e);
|
||||
}
|
||||
} else if (i == 5) {
|
||||
bitmap = createLegacyIconFromAdaptiveIcon((Bitmap) this.mObj1, true);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Icon type not supported for intent shortcuts");
|
||||
}
|
||||
if (drawable != null) {
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
drawable.setBounds(width / 2, height / 2, width, height);
|
||||
drawable.draw(new Canvas(bitmap));
|
||||
}
|
||||
intent.putExtra("android.intent.extra.shortcut.ICON", bitmap);
|
||||
}
|
||||
|
||||
public Bundle toBundle() {
|
||||
Bundle bundle = new Bundle();
|
||||
switch (this.mType) {
|
||||
case -1:
|
||||
bundle.putParcelable(EXTRA_OBJ, (Parcelable) this.mObj1);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid icon");
|
||||
case 1:
|
||||
case 5:
|
||||
bundle.putParcelable(EXTRA_OBJ, (Bitmap) this.mObj1);
|
||||
break;
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
bundle.putString(EXTRA_OBJ, (String) this.mObj1);
|
||||
break;
|
||||
case 3:
|
||||
bundle.putByteArray(EXTRA_OBJ, (byte[]) this.mObj1);
|
||||
break;
|
||||
}
|
||||
bundle.putInt(EXTRA_TYPE, this.mType);
|
||||
bundle.putInt(EXTRA_INT1, this.mInt1);
|
||||
bundle.putInt(EXTRA_INT2, this.mInt2);
|
||||
bundle.putString(EXTRA_STRING1, this.mString1);
|
||||
ColorStateList colorStateList = this.mTintList;
|
||||
if (colorStateList != null) {
|
||||
bundle.putParcelable(EXTRA_TINT_LIST, colorStateList);
|
||||
}
|
||||
PorterDuff.Mode mode = this.mTintMode;
|
||||
if (mode != DEFAULT_TINT_MODE) {
|
||||
bundle.putString(EXTRA_TINT_MODE, mode.name());
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (this.mType == -1) {
|
||||
return String.valueOf(this.mObj1);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("Icon(typ=");
|
||||
sb.append(typeToString(this.mType));
|
||||
switch (this.mType) {
|
||||
case 1:
|
||||
case 5:
|
||||
sb.append(" size=");
|
||||
sb.append(((Bitmap) this.mObj1).getWidth());
|
||||
sb.append("x");
|
||||
sb.append(((Bitmap) this.mObj1).getHeight());
|
||||
break;
|
||||
case 2:
|
||||
sb.append(" pkg=");
|
||||
sb.append(this.mString1);
|
||||
sb.append(" id=");
|
||||
sb.append(String.format("0x%08x", Integer.valueOf(getResId())));
|
||||
break;
|
||||
case 3:
|
||||
sb.append(" len=");
|
||||
sb.append(this.mInt1);
|
||||
if (this.mInt2 != 0) {
|
||||
sb.append(" off=");
|
||||
sb.append(this.mInt2);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 6:
|
||||
sb.append(" uri=");
|
||||
sb.append(this.mObj1);
|
||||
break;
|
||||
}
|
||||
if (this.mTintList != null) {
|
||||
sb.append(" tint=");
|
||||
sb.append(this.mTintList);
|
||||
}
|
||||
if (this.mTintMode != DEFAULT_TINT_MODE) {
|
||||
sb.append(" mode=");
|
||||
sb.append(this.mTintMode);
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // androidx.versionedparcelable.CustomVersionedParcelable
|
||||
public void onPreParceling(boolean z) {
|
||||
this.mTintModeStr = this.mTintMode.name();
|
||||
switch (this.mType) {
|
||||
case -1:
|
||||
if (z) {
|
||||
throw new IllegalArgumentException("Can't serialize Icon created with IconCompat#createFromIcon");
|
||||
}
|
||||
this.mParcelable = (Parcelable) this.mObj1;
|
||||
return;
|
||||
case 0:
|
||||
default:
|
||||
return;
|
||||
case 1:
|
||||
case 5:
|
||||
if (z) {
|
||||
Bitmap bitmap = (Bitmap) this.mObj1;
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 90, byteArrayOutputStream);
|
||||
this.mData = byteArrayOutputStream.toByteArray();
|
||||
return;
|
||||
}
|
||||
this.mParcelable = (Parcelable) this.mObj1;
|
||||
return;
|
||||
case 2:
|
||||
this.mData = ((String) this.mObj1).getBytes(Charset.forName("UTF-16"));
|
||||
return;
|
||||
case 3:
|
||||
this.mData = (byte[]) this.mObj1;
|
||||
return;
|
||||
case 4:
|
||||
case 6:
|
||||
this.mData = this.mObj1.toString().getBytes(Charset.forName("UTF-16"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.versionedparcelable.CustomVersionedParcelable
|
||||
public void onPostParceling() {
|
||||
this.mTintMode = PorterDuff.Mode.valueOf(this.mTintModeStr);
|
||||
switch (this.mType) {
|
||||
case -1:
|
||||
Parcelable parcelable = this.mParcelable;
|
||||
if (parcelable == null) {
|
||||
throw new IllegalArgumentException("Invalid icon");
|
||||
}
|
||||
this.mObj1 = parcelable;
|
||||
return;
|
||||
case 0:
|
||||
default:
|
||||
return;
|
||||
case 1:
|
||||
case 5:
|
||||
Parcelable parcelable2 = this.mParcelable;
|
||||
if (parcelable2 != null) {
|
||||
this.mObj1 = parcelable2;
|
||||
return;
|
||||
}
|
||||
byte[] bArr = this.mData;
|
||||
this.mObj1 = bArr;
|
||||
this.mType = 3;
|
||||
this.mInt1 = 0;
|
||||
this.mInt2 = bArr.length;
|
||||
return;
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
String str = new String(this.mData, Charset.forName("UTF-16"));
|
||||
this.mObj1 = str;
|
||||
if (this.mType == 2 && this.mString1 == null) {
|
||||
this.mString1 = str.split(":", -1)[0];
|
||||
return;
|
||||
}
|
||||
return;
|
||||
case 3:
|
||||
this.mObj1 = this.mData;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static IconCompat createFromBundle(Bundle bundle) {
|
||||
int i = bundle.getInt(EXTRA_TYPE);
|
||||
IconCompat iconCompat = new IconCompat(i);
|
||||
iconCompat.mInt1 = bundle.getInt(EXTRA_INT1);
|
||||
iconCompat.mInt2 = bundle.getInt(EXTRA_INT2);
|
||||
iconCompat.mString1 = bundle.getString(EXTRA_STRING1);
|
||||
if (bundle.containsKey(EXTRA_TINT_LIST)) {
|
||||
iconCompat.mTintList = (ColorStateList) bundle.getParcelable(EXTRA_TINT_LIST);
|
||||
}
|
||||
if (bundle.containsKey(EXTRA_TINT_MODE)) {
|
||||
iconCompat.mTintMode = PorterDuff.Mode.valueOf(bundle.getString(EXTRA_TINT_MODE));
|
||||
}
|
||||
switch (i) {
|
||||
case -1:
|
||||
case 1:
|
||||
case 5:
|
||||
iconCompat.mObj1 = bundle.getParcelable(EXTRA_OBJ);
|
||||
return iconCompat;
|
||||
case 0:
|
||||
default:
|
||||
Log.w(TAG, "Unknown type " + i);
|
||||
return null;
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
iconCompat.mObj1 = bundle.getString(EXTRA_OBJ);
|
||||
return iconCompat;
|
||||
case 3:
|
||||
iconCompat.mObj1 = bundle.getByteArray(EXTRA_OBJ);
|
||||
return iconCompat;
|
||||
}
|
||||
}
|
||||
|
||||
public static IconCompat createFromIcon(Context context, Icon icon) {
|
||||
Preconditions.checkNotNull(icon);
|
||||
return Api23Impl.createFromIcon(context, icon);
|
||||
}
|
||||
|
||||
public static IconCompat createFromIcon(Icon icon) {
|
||||
return Api23Impl.createFromIconInner(icon);
|
||||
}
|
||||
|
||||
public static IconCompat createFromIconOrNullIfZeroResId(Icon icon) {
|
||||
if (Api23Impl.getType(icon) == 2 && Api23Impl.getResId(icon) == 0) {
|
||||
return null;
|
||||
}
|
||||
return Api23Impl.createFromIconInner(icon);
|
||||
}
|
||||
|
||||
static Bitmap createLegacyIconFromAdaptiveIcon(Bitmap bitmap, boolean z) {
|
||||
int min = (int) (Math.min(bitmap.getWidth(), bitmap.getHeight()) * DEFAULT_VIEW_PORT_SCALE);
|
||||
Bitmap createBitmap = Bitmap.createBitmap(min, min, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(createBitmap);
|
||||
Paint paint = new Paint(3);
|
||||
float f = min;
|
||||
float f2 = 0.5f * f;
|
||||
float f3 = ICON_DIAMETER_FACTOR * f2;
|
||||
if (z) {
|
||||
float f4 = BLUR_FACTOR * f;
|
||||
paint.setColor(0);
|
||||
paint.setShadowLayer(f4, 0.0f, f * KEY_SHADOW_OFFSET_FACTOR, 1023410176);
|
||||
canvas.drawCircle(f2, f2, f3, paint);
|
||||
paint.setShadowLayer(f4, 0.0f, 0.0f, 503316480);
|
||||
canvas.drawCircle(f2, f2, f3, paint);
|
||||
paint.clearShadowLayer();
|
||||
}
|
||||
paint.setColor(ViewCompat.MEASURED_STATE_MASK);
|
||||
BitmapShader bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate((-(bitmap.getWidth() - min)) / 2.0f, (-(bitmap.getHeight() - min)) / 2.0f);
|
||||
bitmapShader.setLocalMatrix(matrix);
|
||||
paint.setShader(bitmapShader);
|
||||
canvas.drawCircle(f2, f2, f3, paint);
|
||||
canvas.setBitmap(null);
|
||||
return createBitmap;
|
||||
}
|
||||
|
||||
static class Api28Impl {
|
||||
private Api28Impl() {
|
||||
}
|
||||
|
||||
static String getResPackage(Object obj) {
|
||||
return ((Icon) obj).getResPackage();
|
||||
}
|
||||
|
||||
static int getType(Object obj) {
|
||||
return ((Icon) obj).getType();
|
||||
}
|
||||
|
||||
static int getResId(Object obj) {
|
||||
return ((Icon) obj).getResId();
|
||||
}
|
||||
|
||||
static Uri getUri(Object obj) {
|
||||
return ((Icon) obj).getUri();
|
||||
}
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static Drawable createAdaptiveIconDrawable(Drawable drawable, Drawable drawable2) {
|
||||
return new AdaptiveIconDrawable(drawable, drawable2);
|
||||
}
|
||||
|
||||
static Icon createWithAdaptiveBitmap(Bitmap bitmap) {
|
||||
return Icon.createWithAdaptiveBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api30Impl {
|
||||
private Api30Impl() {
|
||||
}
|
||||
|
||||
static Icon createWithAdaptiveBitmapContentUri(Uri uri) {
|
||||
return Icon.createWithAdaptiveBitmapContentUri(uri);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static IconCompat createFromIcon(Context context, Icon icon) {
|
||||
int type = getType(icon);
|
||||
if (type == 2) {
|
||||
String resPackage = getResPackage(icon);
|
||||
try {
|
||||
return IconCompat.createWithResource(IconCompat.getResources(context, resPackage), resPackage, getResId(icon));
|
||||
} catch (Resources.NotFoundException unused) {
|
||||
throw new IllegalArgumentException("Icon resource cannot be found");
|
||||
}
|
||||
}
|
||||
if (type == 4) {
|
||||
return IconCompat.createWithContentUri(getUri(icon));
|
||||
}
|
||||
if (type == 6) {
|
||||
return IconCompat.createWithAdaptiveBitmapContentUri(getUri(icon));
|
||||
}
|
||||
IconCompat iconCompat = new IconCompat(-1);
|
||||
iconCompat.mObj1 = icon;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
static int getType(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.getType(obj);
|
||||
}
|
||||
try {
|
||||
return ((Integer) obj.getClass().getMethod("getType", new Class[0]).invoke(obj, new Object[0])).intValue();
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon type " + obj, e);
|
||||
return -1;
|
||||
} catch (NoSuchMethodException e2) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon type " + obj, e2);
|
||||
return -1;
|
||||
} catch (InvocationTargetException e3) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon type " + obj, e3);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static String getResPackage(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.getResPackage(obj);
|
||||
}
|
||||
try {
|
||||
return (String) obj.getClass().getMethod("getResPackage", new Class[0]).invoke(obj, new Object[0]);
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon package", e);
|
||||
return null;
|
||||
} catch (NoSuchMethodException e2) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon package", e2);
|
||||
return null;
|
||||
} catch (InvocationTargetException e3) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon package", e3);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static IconCompat createFromIconInner(Object obj) {
|
||||
Preconditions.checkNotNull(obj);
|
||||
int type = getType(obj);
|
||||
if (type == 2) {
|
||||
return IconCompat.createWithResource(null, getResPackage(obj), getResId(obj));
|
||||
}
|
||||
if (type == 4) {
|
||||
return IconCompat.createWithContentUri(getUri(obj));
|
||||
}
|
||||
if (type == 6) {
|
||||
return IconCompat.createWithAdaptiveBitmapContentUri(getUri(obj));
|
||||
}
|
||||
IconCompat iconCompat = new IconCompat(-1);
|
||||
iconCompat.mObj1 = obj;
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
static int getResId(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.getResId(obj);
|
||||
}
|
||||
try {
|
||||
return ((Integer) obj.getClass().getMethod("getResId", new Class[0]).invoke(obj, new Object[0])).intValue();
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon resource", e);
|
||||
return 0;
|
||||
} catch (NoSuchMethodException e2) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon resource", e2);
|
||||
return 0;
|
||||
} catch (InvocationTargetException e3) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon resource", e3);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static Uri getUri(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return Api28Impl.getUri(obj);
|
||||
}
|
||||
try {
|
||||
return (Uri) obj.getClass().getMethod("getUri", new Class[0]).invoke(obj, new Object[0]);
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon uri", e);
|
||||
return null;
|
||||
} catch (NoSuchMethodException e2) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon uri", e2);
|
||||
return null;
|
||||
} catch (InvocationTargetException e3) {
|
||||
Log.e(IconCompat.TAG, "Unable to get icon uri", e3);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static Icon toIcon(IconCompat iconCompat, Context context) {
|
||||
Icon createWithBitmap;
|
||||
switch (iconCompat.mType) {
|
||||
case -1:
|
||||
return (Icon) iconCompat.mObj1;
|
||||
case 0:
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown type");
|
||||
case 1:
|
||||
createWithBitmap = Icon.createWithBitmap((Bitmap) iconCompat.mObj1);
|
||||
break;
|
||||
case 2:
|
||||
createWithBitmap = Icon.createWithResource(iconCompat.getResPackage(), iconCompat.mInt1);
|
||||
break;
|
||||
case 3:
|
||||
createWithBitmap = Icon.createWithData((byte[]) iconCompat.mObj1, iconCompat.mInt1, iconCompat.mInt2);
|
||||
break;
|
||||
case 4:
|
||||
createWithBitmap = Icon.createWithContentUri((String) iconCompat.mObj1);
|
||||
break;
|
||||
case 5:
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
createWithBitmap = Api26Impl.createWithAdaptiveBitmap((Bitmap) iconCompat.mObj1);
|
||||
break;
|
||||
} else {
|
||||
createWithBitmap = Icon.createWithBitmap(IconCompat.createLegacyIconFromAdaptiveIcon((Bitmap) iconCompat.mObj1, false));
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
createWithBitmap = Api30Impl.createWithAdaptiveBitmapContentUri(iconCompat.getUri());
|
||||
break;
|
||||
} else {
|
||||
if (context == null) {
|
||||
throw new IllegalArgumentException("Context is required to resolve the file uri of the icon: " + iconCompat.getUri());
|
||||
}
|
||||
InputStream uriInputStream = iconCompat.getUriInputStream(context);
|
||||
if (uriInputStream == null) {
|
||||
throw new IllegalStateException("Cannot load adaptive icon from uri: " + iconCompat.getUri());
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
createWithBitmap = Api26Impl.createWithAdaptiveBitmap(BitmapFactory.decodeStream(uriInputStream));
|
||||
break;
|
||||
} else {
|
||||
createWithBitmap = Icon.createWithBitmap(IconCompat.createLegacyIconFromAdaptiveIcon(BitmapFactory.decodeStream(uriInputStream), false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iconCompat.mTintList != null) {
|
||||
createWithBitmap.setTintList(iconCompat.mTintList);
|
||||
}
|
||||
if (iconCompat.mTintMode != IconCompat.DEFAULT_TINT_MODE) {
|
||||
createWithBitmap.setTintMode(iconCompat.mTintMode);
|
||||
}
|
||||
return createWithBitmap;
|
||||
}
|
||||
|
||||
static Drawable loadDrawable(Icon icon, Context context) {
|
||||
return icon.loadDrawable(context);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import androidx.versionedparcelable.VersionedParcel;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class IconCompatParcelizer {
|
||||
public static IconCompat read(VersionedParcel versionedParcel) {
|
||||
IconCompat iconCompat = new IconCompat();
|
||||
iconCompat.mType = versionedParcel.readInt(iconCompat.mType, 1);
|
||||
iconCompat.mData = versionedParcel.readByteArray(iconCompat.mData, 2);
|
||||
iconCompat.mParcelable = versionedParcel.readParcelable(iconCompat.mParcelable, 3);
|
||||
iconCompat.mInt1 = versionedParcel.readInt(iconCompat.mInt1, 4);
|
||||
iconCompat.mInt2 = versionedParcel.readInt(iconCompat.mInt2, 5);
|
||||
iconCompat.mTintList = (ColorStateList) versionedParcel.readParcelable(iconCompat.mTintList, 6);
|
||||
iconCompat.mTintModeStr = versionedParcel.readString(iconCompat.mTintModeStr, 7);
|
||||
iconCompat.mString1 = versionedParcel.readString(iconCompat.mString1, 8);
|
||||
iconCompat.onPostParceling();
|
||||
return iconCompat;
|
||||
}
|
||||
|
||||
public static void write(IconCompat iconCompat, VersionedParcel versionedParcel) {
|
||||
versionedParcel.setSerializationFlags(true, true);
|
||||
iconCompat.onPreParceling(versionedParcel.isStream());
|
||||
if (-1 != iconCompat.mType) {
|
||||
versionedParcel.writeInt(iconCompat.mType, 1);
|
||||
}
|
||||
if (iconCompat.mData != null) {
|
||||
versionedParcel.writeByteArray(iconCompat.mData, 2);
|
||||
}
|
||||
if (iconCompat.mParcelable != null) {
|
||||
versionedParcel.writeParcelable(iconCompat.mParcelable, 3);
|
||||
}
|
||||
if (iconCompat.mInt1 != 0) {
|
||||
versionedParcel.writeInt(iconCompat.mInt1, 4);
|
||||
}
|
||||
if (iconCompat.mInt2 != 0) {
|
||||
versionedParcel.writeInt(iconCompat.mInt2, 5);
|
||||
}
|
||||
if (iconCompat.mTintList != null) {
|
||||
versionedParcel.writeParcelable(iconCompat.mTintList, 6);
|
||||
}
|
||||
if (iconCompat.mTintModeStr != null) {
|
||||
versionedParcel.writeString(iconCompat.mTintModeStr, 7);
|
||||
}
|
||||
if (iconCompat.mString1 != null) {
|
||||
versionedParcel.writeString(iconCompat.mString1, 8);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.net.Uri;
|
||||
import kotlin.Metadata;
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
|
||||
/* compiled from: Icon.kt */
|
||||
@Metadata(d1 = {"\u0000\u0016\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0000\u001a\r\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u0087\b\u001a\r\u0010\u0003\u001a\u00020\u0001*\u00020\u0002H\u0087\b\u001a\r\u0010\u0003\u001a\u00020\u0001*\u00020\u0004H\u0087\b\u001a\r\u0010\u0003\u001a\u00020\u0001*\u00020\u0005H\u0087\b¨\u0006\u0006"}, d2 = {"toAdaptiveIcon", "Landroid/graphics/drawable/Icon;", "Landroid/graphics/Bitmap;", "toIcon", "Landroid/net/Uri;", "", "core-ktx_release"}, k = 2, mv = {1, 7, 1}, xi = 48)
|
||||
/* loaded from: classes.dex */
|
||||
public final class IconKt {
|
||||
public static final Icon toAdaptiveIcon(Bitmap bitmap) {
|
||||
Icon createWithAdaptiveBitmap;
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
createWithAdaptiveBitmap = Icon.createWithAdaptiveBitmap(bitmap);
|
||||
Intrinsics.checkNotNullExpressionValue(createWithAdaptiveBitmap, "createWithAdaptiveBitmap(this)");
|
||||
return createWithAdaptiveBitmap;
|
||||
}
|
||||
|
||||
public static final Icon toIcon(Bitmap bitmap) {
|
||||
Icon createWithBitmap;
|
||||
Intrinsics.checkNotNullParameter(bitmap, "<this>");
|
||||
createWithBitmap = Icon.createWithBitmap(bitmap);
|
||||
Intrinsics.checkNotNullExpressionValue(createWithBitmap, "createWithBitmap(this)");
|
||||
return createWithBitmap;
|
||||
}
|
||||
|
||||
public static final Icon toIcon(Uri uri) {
|
||||
Icon createWithContentUri;
|
||||
Intrinsics.checkNotNullParameter(uri, "<this>");
|
||||
createWithContentUri = Icon.createWithContentUri(uri);
|
||||
Intrinsics.checkNotNullExpressionValue(createWithContentUri, "createWithContentUri(this)");
|
||||
return createWithContentUri;
|
||||
}
|
||||
|
||||
public static final Icon toIcon(byte[] bArr) {
|
||||
Icon createWithData;
|
||||
Intrinsics.checkNotNullParameter(bArr, "<this>");
|
||||
createWithData = Icon.createWithData(bArr, 0, bArr.length);
|
||||
Intrinsics.checkNotNullExpressionValue(createWithData, "createWithData(this, 0, size)");
|
||||
return createWithData;
|
||||
}
|
||||
}
|
@ -0,0 +1,256 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class RoundedBitmapDrawable extends Drawable {
|
||||
private static final int DEFAULT_PAINT_FLAGS = 3;
|
||||
final Bitmap mBitmap;
|
||||
private int mBitmapHeight;
|
||||
private final BitmapShader mBitmapShader;
|
||||
private int mBitmapWidth;
|
||||
private float mCornerRadius;
|
||||
private boolean mIsCircular;
|
||||
private int mTargetDensity;
|
||||
private int mGravity = 119;
|
||||
private final Paint mPaint = new Paint(3);
|
||||
private final Matrix mShaderMatrix = new Matrix();
|
||||
final Rect mDstRect = new Rect();
|
||||
private final RectF mDstRectF = new RectF();
|
||||
private boolean mApplyGravity = true;
|
||||
|
||||
private static boolean isGreaterThanZero(float f) {
|
||||
return f > 0.05f;
|
||||
}
|
||||
|
||||
public final Bitmap getBitmap() {
|
||||
return this.mBitmap;
|
||||
}
|
||||
|
||||
public float getCornerRadius() {
|
||||
return this.mCornerRadius;
|
||||
}
|
||||
|
||||
public int getGravity() {
|
||||
return this.mGravity;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicHeight() {
|
||||
return this.mBitmapHeight;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicWidth() {
|
||||
return this.mBitmapWidth;
|
||||
}
|
||||
|
||||
public final Paint getPaint() {
|
||||
return this.mPaint;
|
||||
}
|
||||
|
||||
public boolean isCircular() {
|
||||
return this.mIsCircular;
|
||||
}
|
||||
|
||||
private void computeBitmapSize() {
|
||||
this.mBitmapWidth = this.mBitmap.getScaledWidth(this.mTargetDensity);
|
||||
this.mBitmapHeight = this.mBitmap.getScaledHeight(this.mTargetDensity);
|
||||
}
|
||||
|
||||
public void setTargetDensity(Canvas canvas) {
|
||||
setTargetDensity(canvas.getDensity());
|
||||
}
|
||||
|
||||
public void setTargetDensity(DisplayMetrics displayMetrics) {
|
||||
setTargetDensity(displayMetrics.densityDpi);
|
||||
}
|
||||
|
||||
public void setTargetDensity(int i) {
|
||||
if (this.mTargetDensity != i) {
|
||||
if (i == 0) {
|
||||
i = 160;
|
||||
}
|
||||
this.mTargetDensity = i;
|
||||
if (this.mBitmap != null) {
|
||||
computeBitmapSize();
|
||||
}
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setGravity(int i) {
|
||||
if (this.mGravity != i) {
|
||||
this.mGravity = i;
|
||||
this.mApplyGravity = true;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
public void setMipMap(boolean z) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean hasMipMap() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void setAntiAlias(boolean z) {
|
||||
this.mPaint.setAntiAlias(z);
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
public boolean hasAntiAlias() {
|
||||
return this.mPaint.isAntiAlias();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setFilterBitmap(boolean z) {
|
||||
this.mPaint.setFilterBitmap(z);
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setDither(boolean z) {
|
||||
this.mPaint.setDither(z);
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
void gravityCompatApply(int i, int i2, int i3, Rect rect, Rect rect2) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
void updateDstRect() {
|
||||
if (this.mApplyGravity) {
|
||||
if (this.mIsCircular) {
|
||||
int min = Math.min(this.mBitmapWidth, this.mBitmapHeight);
|
||||
gravityCompatApply(this.mGravity, min, min, getBounds(), this.mDstRect);
|
||||
int min2 = Math.min(this.mDstRect.width(), this.mDstRect.height());
|
||||
this.mDstRect.inset(Math.max(0, (this.mDstRect.width() - min2) / 2), Math.max(0, (this.mDstRect.height() - min2) / 2));
|
||||
this.mCornerRadius = min2 * 0.5f;
|
||||
} else {
|
||||
gravityCompatApply(this.mGravity, this.mBitmapWidth, this.mBitmapHeight, getBounds(), this.mDstRect);
|
||||
}
|
||||
this.mDstRectF.set(this.mDstRect);
|
||||
if (this.mBitmapShader != null) {
|
||||
this.mShaderMatrix.setTranslate(this.mDstRectF.left, this.mDstRectF.top);
|
||||
this.mShaderMatrix.preScale(this.mDstRectF.width() / this.mBitmap.getWidth(), this.mDstRectF.height() / this.mBitmap.getHeight());
|
||||
this.mBitmapShader.setLocalMatrix(this.mShaderMatrix);
|
||||
this.mPaint.setShader(this.mBitmapShader);
|
||||
}
|
||||
this.mApplyGravity = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
Bitmap bitmap = this.mBitmap;
|
||||
if (bitmap == null) {
|
||||
return;
|
||||
}
|
||||
updateDstRect();
|
||||
if (this.mPaint.getShader() == null) {
|
||||
canvas.drawBitmap(bitmap, (Rect) null, this.mDstRect, this.mPaint);
|
||||
return;
|
||||
}
|
||||
RectF rectF = this.mDstRectF;
|
||||
float f = this.mCornerRadius;
|
||||
canvas.drawRoundRect(rectF, f, f, this.mPaint);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
if (i != this.mPaint.getAlpha()) {
|
||||
this.mPaint.setAlpha(i);
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getAlpha() {
|
||||
return this.mPaint.getAlpha();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
this.mPaint.setColorFilter(colorFilter);
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public ColorFilter getColorFilter() {
|
||||
return this.mPaint.getColorFilter();
|
||||
}
|
||||
|
||||
public void setCircular(boolean z) {
|
||||
this.mIsCircular = z;
|
||||
this.mApplyGravity = true;
|
||||
if (z) {
|
||||
updateCircularCornerRadius();
|
||||
this.mPaint.setShader(this.mBitmapShader);
|
||||
invalidateSelf();
|
||||
return;
|
||||
}
|
||||
setCornerRadius(0.0f);
|
||||
}
|
||||
|
||||
private void updateCircularCornerRadius() {
|
||||
this.mCornerRadius = Math.min(this.mBitmapHeight, this.mBitmapWidth) / 2;
|
||||
}
|
||||
|
||||
public void setCornerRadius(float f) {
|
||||
if (this.mCornerRadius == f) {
|
||||
return;
|
||||
}
|
||||
this.mIsCircular = false;
|
||||
if (isGreaterThanZero(f)) {
|
||||
this.mPaint.setShader(this.mBitmapShader);
|
||||
} else {
|
||||
this.mPaint.setShader(null);
|
||||
}
|
||||
this.mCornerRadius = f;
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
protected void onBoundsChange(Rect rect) {
|
||||
super.onBoundsChange(rect);
|
||||
if (this.mIsCircular) {
|
||||
updateCircularCornerRadius();
|
||||
}
|
||||
this.mApplyGravity = true;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
Bitmap bitmap;
|
||||
return (this.mGravity != 119 || this.mIsCircular || (bitmap = this.mBitmap) == null || bitmap.hasAlpha() || this.mPaint.getAlpha() < 255 || isGreaterThanZero(this.mCornerRadius)) ? -3 : -1;
|
||||
}
|
||||
|
||||
RoundedBitmapDrawable(Resources resources, Bitmap bitmap) {
|
||||
this.mTargetDensity = 160;
|
||||
if (resources != null) {
|
||||
this.mTargetDensity = resources.getDisplayMetrics().densityDpi;
|
||||
}
|
||||
this.mBitmap = bitmap;
|
||||
if (bitmap != null) {
|
||||
computeBitmapSize();
|
||||
this.mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
||||
} else {
|
||||
this.mBitmapHeight = -1;
|
||||
this.mBitmapWidth = -1;
|
||||
this.mBitmapShader = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Rect;
|
||||
import android.view.Gravity;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class RoundedBitmapDrawable21 extends RoundedBitmapDrawable {
|
||||
protected RoundedBitmapDrawable21(Resources resources, Bitmap bitmap) {
|
||||
super(resources, bitmap);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void getOutline(Outline outline) {
|
||||
updateDstRect();
|
||||
outline.setRoundRect(this.mDstRect, getCornerRadius());
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
public void setMipMap(boolean z) {
|
||||
if (this.mBitmap != null) {
|
||||
this.mBitmap.setHasMipMap(z);
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
public boolean hasMipMap() {
|
||||
return this.mBitmap != null && this.mBitmap.hasMipMap();
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
void gravityCompatApply(int i, int i2, int i3, Rect rect, Rect rect2) {
|
||||
Gravity.apply(i, i2, i3, rect, rect2, 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
import androidx.core.graphics.BitmapCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class RoundedBitmapDrawableFactory {
|
||||
private static final String TAG = "RoundedBitmapDrawableFa";
|
||||
|
||||
private static class DefaultRoundedBitmapDrawable extends RoundedBitmapDrawable {
|
||||
DefaultRoundedBitmapDrawable(Resources resources, Bitmap bitmap) {
|
||||
super(resources, bitmap);
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
public void setMipMap(boolean z) {
|
||||
if (this.mBitmap != null) {
|
||||
BitmapCompat.setHasMipMap(this.mBitmap, z);
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
public boolean hasMipMap() {
|
||||
return this.mBitmap != null && BitmapCompat.hasMipMap(this.mBitmap);
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
void gravityCompatApply(int i, int i2, int i3, Rect rect, Rect rect2) {
|
||||
GravityCompat.apply(i, i2, i3, rect, rect2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static RoundedBitmapDrawable create(Resources resources, Bitmap bitmap) {
|
||||
return new RoundedBitmapDrawable21(resources, bitmap);
|
||||
}
|
||||
|
||||
public static RoundedBitmapDrawable create(Resources resources, String str) {
|
||||
RoundedBitmapDrawable create = create(resources, BitmapFactory.decodeFile(str));
|
||||
if (create.getBitmap() == null) {
|
||||
Log.w(TAG, "RoundedBitmapDrawable cannot decode " + str);
|
||||
}
|
||||
return create;
|
||||
}
|
||||
|
||||
public static RoundedBitmapDrawable create(Resources resources, InputStream inputStream) {
|
||||
RoundedBitmapDrawable create = create(resources, BitmapFactory.decodeStream(inputStream));
|
||||
if (create.getBitmap() == null) {
|
||||
Log.w(TAG, "RoundedBitmapDrawable cannot decode " + inputStream);
|
||||
}
|
||||
return create;
|
||||
}
|
||||
|
||||
private RoundedBitmapDrawableFactory() {
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface TintAwareDrawable {
|
||||
void setTint(int i);
|
||||
|
||||
void setTintList(ColorStateList colorStateList);
|
||||
|
||||
void setTintMode(PorterDuff.Mode mode);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface WrappedDrawable {
|
||||
Drawable getWrappedDrawable();
|
||||
|
||||
void setWrappedDrawable(Drawable drawable);
|
||||
}
|
@ -0,0 +1,292 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class WrappedDrawableApi14 extends Drawable implements Drawable.Callback, WrappedDrawable, TintAwareDrawable {
|
||||
static final PorterDuff.Mode DEFAULT_TINT_MODE = PorterDuff.Mode.SRC_IN;
|
||||
private boolean mColorFilterSet;
|
||||
private int mCurrentColor;
|
||||
private PorterDuff.Mode mCurrentMode;
|
||||
Drawable mDrawable;
|
||||
private boolean mMutated;
|
||||
WrappedDrawableState mState;
|
||||
|
||||
@Override // androidx.core.graphics.drawable.WrappedDrawable
|
||||
public final Drawable getWrappedDrawable() {
|
||||
return this.mDrawable;
|
||||
}
|
||||
|
||||
protected boolean isCompatTintEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
WrappedDrawableApi14(WrappedDrawableState wrappedDrawableState, Resources resources) {
|
||||
this.mState = wrappedDrawableState;
|
||||
updateLocalState(resources);
|
||||
}
|
||||
|
||||
WrappedDrawableApi14(Drawable drawable) {
|
||||
this.mState = mutateConstantState();
|
||||
setWrappedDrawable(drawable);
|
||||
}
|
||||
|
||||
private void updateLocalState(Resources resources) {
|
||||
WrappedDrawableState wrappedDrawableState = this.mState;
|
||||
if (wrappedDrawableState == null || wrappedDrawableState.mDrawableState == null) {
|
||||
return;
|
||||
}
|
||||
setWrappedDrawable(this.mState.mDrawableState.newDrawable(resources));
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void jumpToCurrentState() {
|
||||
this.mDrawable.jumpToCurrentState();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
this.mDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
protected void onBoundsChange(Rect rect) {
|
||||
Drawable drawable = this.mDrawable;
|
||||
if (drawable != null) {
|
||||
drawable.setBounds(rect);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setChangingConfigurations(int i) {
|
||||
this.mDrawable.setChangingConfigurations(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getChangingConfigurations() {
|
||||
int changingConfigurations = super.getChangingConfigurations();
|
||||
WrappedDrawableState wrappedDrawableState = this.mState;
|
||||
return changingConfigurations | (wrappedDrawableState != null ? wrappedDrawableState.getChangingConfigurations() : 0) | this.mDrawable.getChangingConfigurations();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setDither(boolean z) {
|
||||
this.mDrawable.setDither(z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setFilterBitmap(boolean z) {
|
||||
this.mDrawable.setFilterBitmap(z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
this.mDrawable.setAlpha(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
this.mDrawable.setColorFilter(colorFilter);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isStateful() {
|
||||
WrappedDrawableState wrappedDrawableState;
|
||||
ColorStateList colorStateList = (!isCompatTintEnabled() || (wrappedDrawableState = this.mState) == null) ? null : wrappedDrawableState.mTint;
|
||||
return (colorStateList != null && colorStateList.isStateful()) || this.mDrawable.isStateful();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean setState(int[] iArr) {
|
||||
return updateTint(iArr) || this.mDrawable.setState(iArr);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int[] getState() {
|
||||
return this.mDrawable.getState();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Drawable getCurrent() {
|
||||
return this.mDrawable.getCurrent();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean setVisible(boolean z, boolean z2) {
|
||||
return super.setVisible(z, z2) || this.mDrawable.setVisible(z, z2);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return this.mDrawable.getOpacity();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Region getTransparentRegion() {
|
||||
return this.mDrawable.getTransparentRegion();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicWidth() {
|
||||
return this.mDrawable.getIntrinsicWidth();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getIntrinsicHeight() {
|
||||
return this.mDrawable.getIntrinsicHeight();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getMinimumWidth() {
|
||||
return this.mDrawable.getMinimumWidth();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getMinimumHeight() {
|
||||
return this.mDrawable.getMinimumHeight();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean getPadding(Rect rect) {
|
||||
return this.mDrawable.getPadding(rect);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAutoMirrored(boolean z) {
|
||||
DrawableCompat.setAutoMirrored(this.mDrawable, z);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isAutoMirrored() {
|
||||
return DrawableCompat.isAutoMirrored(this.mDrawable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean onLayoutDirectionChanged(int i) {
|
||||
return DrawableCompat.setLayoutDirection(this.mDrawable, i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getLayoutDirection() {
|
||||
return DrawableCompat.getLayoutDirection(this.mDrawable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Drawable.ConstantState getConstantState() {
|
||||
WrappedDrawableState wrappedDrawableState = this.mState;
|
||||
if (wrappedDrawableState == null || !wrappedDrawableState.canConstantState()) {
|
||||
return null;
|
||||
}
|
||||
this.mState.mChangingConfigurations = getChangingConfigurations();
|
||||
return this.mState;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Drawable mutate() {
|
||||
if (!this.mMutated && super.mutate() == this) {
|
||||
this.mState = mutateConstantState();
|
||||
Drawable drawable = this.mDrawable;
|
||||
if (drawable != null) {
|
||||
drawable.mutate();
|
||||
}
|
||||
WrappedDrawableState wrappedDrawableState = this.mState;
|
||||
if (wrappedDrawableState != null) {
|
||||
Drawable drawable2 = this.mDrawable;
|
||||
wrappedDrawableState.mDrawableState = drawable2 != null ? drawable2.getConstantState() : null;
|
||||
}
|
||||
this.mMutated = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private WrappedDrawableState mutateConstantState() {
|
||||
return new WrappedDrawableState(this.mState);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void invalidateDrawable(Drawable drawable) {
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
|
||||
scheduleSelf(runnable, j);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.Callback
|
||||
public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
|
||||
unscheduleSelf(runnable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
protected boolean onLevelChange(int i) {
|
||||
return this.mDrawable.setLevel(i);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||||
public void setTint(int i) {
|
||||
setTintList(ColorStateList.valueOf(i));
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||||
public void setTintList(ColorStateList colorStateList) {
|
||||
this.mState.mTint = colorStateList;
|
||||
updateTint(getState());
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||||
public void setTintMode(PorterDuff.Mode mode) {
|
||||
this.mState.mTintMode = mode;
|
||||
updateTint(getState());
|
||||
}
|
||||
|
||||
private boolean updateTint(int[] iArr) {
|
||||
if (!isCompatTintEnabled()) {
|
||||
return false;
|
||||
}
|
||||
ColorStateList colorStateList = this.mState.mTint;
|
||||
PorterDuff.Mode mode = this.mState.mTintMode;
|
||||
if (colorStateList != null && mode != null) {
|
||||
int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor());
|
||||
if (!this.mColorFilterSet || colorForState != this.mCurrentColor || mode != this.mCurrentMode) {
|
||||
setColorFilter(colorForState, mode);
|
||||
this.mCurrentColor = colorForState;
|
||||
this.mCurrentMode = mode;
|
||||
this.mColorFilterSet = true;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
this.mColorFilterSet = false;
|
||||
clearColorFilter();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.WrappedDrawable
|
||||
public final void setWrappedDrawable(Drawable drawable) {
|
||||
Drawable drawable2 = this.mDrawable;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
}
|
||||
this.mDrawable = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
setVisible(drawable.isVisible(), true);
|
||||
setState(drawable.getState());
|
||||
setLevel(drawable.getLevel());
|
||||
setBounds(drawable.getBounds());
|
||||
WrappedDrawableState wrappedDrawableState = this.mState;
|
||||
if (wrappedDrawableState != null) {
|
||||
wrappedDrawableState.mDrawableState = drawable.getConstantState();
|
||||
}
|
||||
}
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class WrappedDrawableApi21 extends WrappedDrawableApi14 {
|
||||
private static final String TAG = "WrappedDrawableApi21";
|
||||
private static Method sIsProjectedDrawableMethod;
|
||||
|
||||
WrappedDrawableApi21(Drawable drawable) {
|
||||
super(drawable);
|
||||
findAndCacheIsProjectedDrawableMethod();
|
||||
}
|
||||
|
||||
WrappedDrawableApi21(WrappedDrawableState wrappedDrawableState, Resources resources) {
|
||||
super(wrappedDrawableState, resources);
|
||||
findAndCacheIsProjectedDrawableMethod();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setHotspot(float f, float f2) {
|
||||
this.mDrawable.setHotspot(f, f2);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setHotspotBounds(int i, int i2, int i3, int i4) {
|
||||
this.mDrawable.setHotspotBounds(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void getOutline(Outline outline) {
|
||||
this.mDrawable.getOutline(outline);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public Rect getDirtyBounds() {
|
||||
return this.mDrawable.getDirtyBounds();
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.WrappedDrawableApi14, android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||||
public void setTintList(ColorStateList colorStateList) {
|
||||
if (isCompatTintEnabled()) {
|
||||
super.setTintList(colorStateList);
|
||||
} else {
|
||||
this.mDrawable.setTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.WrappedDrawableApi14, android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||||
public void setTint(int i) {
|
||||
if (isCompatTintEnabled()) {
|
||||
super.setTint(i);
|
||||
} else {
|
||||
this.mDrawable.setTint(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.WrappedDrawableApi14, android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||||
public void setTintMode(PorterDuff.Mode mode) {
|
||||
if (isCompatTintEnabled()) {
|
||||
super.setTintMode(mode);
|
||||
} else {
|
||||
this.mDrawable.setTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.WrappedDrawableApi14, android.graphics.drawable.Drawable
|
||||
public boolean setState(int[] iArr) {
|
||||
if (!super.setState(iArr)) {
|
||||
return false;
|
||||
}
|
||||
invalidateSelf();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.core.graphics.drawable.WrappedDrawableApi14
|
||||
protected boolean isCompatTintEnabled() {
|
||||
if (Build.VERSION.SDK_INT != 21) {
|
||||
return false;
|
||||
}
|
||||
Drawable drawable = this.mDrawable;
|
||||
return (drawable instanceof GradientDrawable) || (drawable instanceof DrawableContainer) || (drawable instanceof InsetDrawable) || (drawable instanceof RippleDrawable);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean isProjected() {
|
||||
Method method;
|
||||
if (this.mDrawable != null && (method = sIsProjectedDrawableMethod) != null) {
|
||||
try {
|
||||
return ((Boolean) method.invoke(this.mDrawable, new Object[0])).booleanValue();
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling Drawable#isProjected() method", e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void findAndCacheIsProjectedDrawableMethod() {
|
||||
if (sIsProjectedDrawableMethod == null) {
|
||||
try {
|
||||
sIsProjectedDrawableMethod = Drawable.class.getDeclaredMethod("isProjected", new Class[0]);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Failed to retrieve Drawable#isProjected() method", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package androidx.core.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class WrappedDrawableState extends Drawable.ConstantState {
|
||||
int mChangingConfigurations;
|
||||
Drawable.ConstantState mDrawableState;
|
||||
ColorStateList mTint;
|
||||
PorterDuff.Mode mTintMode;
|
||||
|
||||
boolean canConstantState() {
|
||||
return this.mDrawableState != null;
|
||||
}
|
||||
|
||||
WrappedDrawableState(WrappedDrawableState wrappedDrawableState) {
|
||||
this.mTint = null;
|
||||
this.mTintMode = WrappedDrawableApi14.DEFAULT_TINT_MODE;
|
||||
if (wrappedDrawableState != null) {
|
||||
this.mChangingConfigurations = wrappedDrawableState.mChangingConfigurations;
|
||||
this.mDrawableState = wrappedDrawableState.mDrawableState;
|
||||
this.mTint = wrappedDrawableState.mTint;
|
||||
this.mTintMode = wrappedDrawableState.mTintMode;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable() {
|
||||
return newDrawable(null);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.ConstantState
|
||||
public Drawable newDrawable(Resources resources) {
|
||||
return new WrappedDrawableApi21(this, resources);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable.ConstantState
|
||||
public int getChangingConfigurations() {
|
||||
int i = this.mChangingConfigurations;
|
||||
Drawable.ConstantState constantState = this.mDrawableState;
|
||||
return i | (constantState != null ? constantState.getChangingConfigurations() : 0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user