Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package com.ubtech.utils;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
/* loaded from: classes2.dex */
public class ActivityUtils {
public static void a(FragmentManager fragmentManager, Fragment fragment, int i, String str) {
FragmentTransaction a = fragmentManager.a();
a.a(i, fragment, str);
a.a();
}
public static void b(FragmentManager fragmentManager, Fragment fragment, int i, String str) {
FragmentTransaction a = fragmentManager.a();
a.b(i, fragment, str);
a.a();
}
public static Fragment a(FragmentManager fragmentManager, String str) {
return fragmentManager.a(str);
}
}

View File

@@ -0,0 +1,26 @@
package com.ubtech.utils;
import android.os.Build;
/* loaded from: classes2.dex */
public class AndroidVersionCheckUtils {
public static boolean a() {
return Build.VERSION.SDK_INT >= 8;
}
public static boolean b() {
return Build.VERSION.SDK_INT >= 9;
}
public static boolean c() {
return Build.VERSION.SDK_INT >= 16;
}
public static boolean d() {
return Build.VERSION.SDK_INT >= 17;
}
public static boolean e() {
return Build.VERSION.SDK_INT >= 23;
}
}

View File

@@ -0,0 +1,130 @@
package com.ubtech.utils;
import android.graphics.Bitmap;
import android.util.Log;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/* loaded from: classes2.dex */
public class BitmapFile {
public static File a(Bitmap bitmap, String str) throws IOException {
return a(bitmap, Bitmap.CompressFormat.PNG, 100, str);
}
public static File a(Bitmap bitmap, Bitmap.CompressFormat compressFormat, int i, String str) throws IOException {
BufferedOutputStream bufferedOutputStream = null;
try {
try {
File file = new File(str);
if (!new File(file.getParent()).exists()) {
new File(file.getParent()).mkdirs();
}
file.createNewFile();
BufferedOutputStream bufferedOutputStream2 = new BufferedOutputStream(new FileOutputStream(file));
try {
bitmap.compress(compressFormat, i, bufferedOutputStream2);
try {
bufferedOutputStream2.close();
} catch (IOException e) {
Log.e("Cache", e.getMessage());
}
return file;
} catch (Exception e2) {
throw e2;
} catch (Throwable th) {
th = th;
bufferedOutputStream = bufferedOutputStream2;
if (bufferedOutputStream != null) {
try {
bufferedOutputStream.close();
} catch (IOException e3) {
Log.e("Cache", e3.getMessage());
}
}
throw th;
}
} catch (Exception e4) {
throw e4;
}
} catch (Throwable th2) {
th = th2;
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:27:0x0044 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/* JADX WARN: Type inference failed for: r4v0, types: [android.graphics.Bitmap$Config] */
/* JADX WARN: Type inference failed for: r4v1 */
/* JADX WARN: Type inference failed for: r4v10 */
/* JADX WARN: Type inference failed for: r4v11 */
/* JADX WARN: Type inference failed for: r4v12 */
/* JADX WARN: Type inference failed for: r4v13 */
/* JADX WARN: Type inference failed for: r4v2, types: [java.io.InputStream] */
/* JADX WARN: Type inference failed for: r4v4 */
/* JADX WARN: Type inference failed for: r4v5 */
/* JADX WARN: Type inference failed for: r4v6 */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:37:0x002d -> B:14:0x004d). Please report as a decompilation issue!!! */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static android.graphics.Bitmap a(java.lang.String r3, android.graphics.Bitmap.Config r4, int r5) {
/*
boolean r0 = android.text.TextUtils.isEmpty(r3)
r1 = 0
if (r0 == 0) goto L8
return r1
L8:
java.io.File r0 = new java.io.File
r0.<init>(r3)
boolean r3 = r0.exists()
if (r3 == 0) goto L4d
android.graphics.BitmapFactory$Options r3 = new android.graphics.BitmapFactory$Options
r3.<init>()
r2 = 0
r3.inJustDecodeBounds = r2
r3.inPreferredConfig = r4
r3.inSampleSize = r5
java.io.FileInputStream r4 = new java.io.FileInputStream // Catch: java.lang.Throwable -> L33 java.io.FileNotFoundException -> L36
r4.<init>(r0) // Catch: java.lang.Throwable -> L33 java.io.FileNotFoundException -> L36
android.graphics.Bitmap r1 = android.graphics.BitmapFactory.decodeStream(r4, r1, r3) // Catch: java.io.FileNotFoundException -> L31 java.lang.Throwable -> L41
r4.close() // Catch: java.lang.Exception -> L2c
goto L4d
L2c:
r3 = move-exception
r3.printStackTrace()
goto L4d
L31:
r3 = move-exception
goto L38
L33:
r3 = move-exception
r4 = r1
goto L42
L36:
r3 = move-exception
r4 = r1
L38:
r3.printStackTrace() // Catch: java.lang.Throwable -> L41
if (r4 == 0) goto L4d
r4.close() // Catch: java.lang.Exception -> L2c
goto L4d
L41:
r3 = move-exception
L42:
if (r4 == 0) goto L4c
r4.close() // Catch: java.lang.Exception -> L48
goto L4c
L48:
r4 = move-exception
r4.printStackTrace()
L4c:
throw r3
L4d:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.ubtech.utils.BitmapFile.a(java.lang.String, android.graphics.Bitmap$Config, int):android.graphics.Bitmap");
}
}

View File

@@ -0,0 +1,315 @@
package com.ubtech.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.util.Log;
import com.ijm.dataencryption.de.DataDecryptTool;
import java.lang.reflect.Array;
/* loaded from: classes2.dex */
public class BlurHelper {
private static BlurHelper e;
private Context a;
private Bitmap b;
private int c;
private float d = 0.125f;
private BlurHelper(Context context) {
this.a = context.getApplicationContext();
}
public static synchronized BlurHelper a(Context context) {
BlurHelper blurHelper;
synchronized (BlurHelper.class) {
if (e == null) {
e = new BlurHelper(context);
}
blurHelper = e;
}
return blurHelper;
}
public BlurHelper a(Bitmap bitmap) {
this.b = bitmap;
return this;
}
public BlurHelper a(int i) {
this.c = i;
return this;
}
public BlurHelper a(float f) {
this.d = f;
return this;
}
public Bitmap a() {
Bitmap bitmap = this.b;
if (bitmap != null) {
int i = this.c;
if (i >= 1) {
if (Build.VERSION.SDK_INT > 18) {
return a(this.a, bitmap, this.d, i);
}
return a(bitmap, this.d, i);
}
throw new RuntimeException("radius must >=1");
}
throw new RuntimeException("Bitmap can not be null");
}
public static Bitmap a(Context context, Bitmap bitmap, float f, int i) {
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, Math.round(bitmap.getWidth() * f), Math.round(bitmap.getHeight() * f), false);
RenderScript create = RenderScript.create(context);
create.setMessageHandler(new RenderScript.RSMessageHandler());
Allocation createFromBitmap = Allocation.createFromBitmap(create, bitmap, Allocation.MipmapControl.MIPMAP_NONE, 1);
Allocation createTyped = Allocation.createTyped(create, createFromBitmap.getType());
ScriptIntrinsicBlur create2 = ScriptIntrinsicBlur.create(create, Element.U8_4(create));
create2.setInput(createFromBitmap);
if (i <= 0) {
i = 1;
}
if (i > 25) {
i = 25;
}
create2.setRadius(i);
create2.forEach(createTyped);
createTyped.copyTo(createScaledBitmap);
create2.destroy();
createTyped.destroy();
createFromBitmap.destroy();
create.destroy();
return createScaledBitmap;
}
public static Bitmap a(Bitmap bitmap, float f, int i) {
int[] iArr;
int i2 = i;
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, Math.round(bitmap.getWidth() * f), Math.round(bitmap.getHeight() * f), false);
Bitmap copy = createScaledBitmap.copy(createScaledBitmap.getConfig(), true);
if (i2 < 1) {
return null;
}
int width = copy.getWidth();
int height = copy.getHeight();
int i3 = width * height;
int[] iArr2 = new int[i3];
Log.e("pix", width + " " + height + " " + iArr2.length);
copy.getPixels(iArr2, 0, width, 0, 0, width, height);
int i4 = width + (-1);
int i5 = height + (-1);
int i6 = i2 + i2 + 1;
int[] iArr3 = new int[i3];
int[] iArr4 = new int[i3];
int[] iArr5 = new int[i3];
int[] iArr6 = new int[Math.max(width, height)];
int i7 = (i6 + 1) >> 1;
int i8 = i7 * i7;
int i9 = i8 * DataDecryptTool.DECRYPT_ALL_FILE;
int[] iArr7 = new int[i9];
for (int i10 = 0; i10 < i9; i10++) {
iArr7[i10] = i10 / i8;
}
int[][] iArr8 = (int[][]) Array.newInstance((Class<?>) int.class, i6, 3);
int i11 = i2 + 1;
int i12 = 0;
int i13 = 0;
int i14 = 0;
while (i12 < height) {
Bitmap bitmap2 = copy;
int i15 = -i2;
int i16 = 0;
int i17 = 0;
int i18 = 0;
int i19 = 0;
int i20 = 0;
int i21 = 0;
int i22 = 0;
int i23 = 0;
int i24 = 0;
while (i15 <= i2) {
int i25 = i5;
int i26 = height;
int i27 = iArr2[i13 + Math.min(i4, Math.max(i15, 0))];
int[] iArr9 = iArr8[i15 + i2];
iArr9[0] = (i27 & 16711680) >> 16;
iArr9[1] = (i27 & 65280) >> 8;
iArr9[2] = i27 & 255;
int abs = i11 - Math.abs(i15);
i16 += iArr9[0] * abs;
i17 += iArr9[1] * abs;
i18 += iArr9[2] * abs;
if (i15 > 0) {
i22 += iArr9[0];
i23 += iArr9[1];
i24 += iArr9[2];
} else {
i19 += iArr9[0];
i20 += iArr9[1];
i21 += iArr9[2];
}
i15++;
height = i26;
i5 = i25;
}
int i28 = i5;
int i29 = height;
int i30 = i2;
int i31 = 0;
while (i31 < width) {
iArr3[i13] = iArr7[i16];
iArr4[i13] = iArr7[i17];
iArr5[i13] = iArr7[i18];
int i32 = i16 - i19;
int i33 = i17 - i20;
int i34 = i18 - i21;
int[] iArr10 = iArr8[((i30 - i2) + i6) % i6];
int i35 = i19 - iArr10[0];
int i36 = i20 - iArr10[1];
int i37 = i21 - iArr10[2];
if (i12 == 0) {
iArr = iArr7;
iArr6[i31] = Math.min(i31 + i2 + 1, i4);
} else {
iArr = iArr7;
}
int i38 = iArr2[i14 + iArr6[i31]];
iArr10[0] = (i38 & 16711680) >> 16;
iArr10[1] = (i38 & 65280) >> 8;
iArr10[2] = i38 & 255;
int i39 = i22 + iArr10[0];
int i40 = i23 + iArr10[1];
int i41 = i24 + iArr10[2];
i16 = i32 + i39;
i17 = i33 + i40;
i18 = i34 + i41;
i30 = (i30 + 1) % i6;
int[] iArr11 = iArr8[i30 % i6];
i19 = i35 + iArr11[0];
i20 = i36 + iArr11[1];
i21 = i37 + iArr11[2];
i22 = i39 - iArr11[0];
i23 = i40 - iArr11[1];
i24 = i41 - iArr11[2];
i13++;
i31++;
iArr7 = iArr;
}
i14 += width;
i12++;
copy = bitmap2;
height = i29;
i5 = i28;
}
Bitmap bitmap3 = copy;
int[] iArr12 = iArr7;
int i42 = i5;
int i43 = height;
int i44 = 0;
while (i44 < width) {
int i45 = -i2;
int i46 = i45 * width;
int i47 = 0;
int i48 = 0;
int i49 = 0;
int i50 = 0;
int i51 = 0;
int i52 = 0;
int i53 = 0;
int i54 = 0;
int i55 = 0;
while (i45 <= i2) {
int[] iArr13 = iArr6;
int max = Math.max(0, i46) + i44;
int[] iArr14 = iArr8[i45 + i2];
iArr14[0] = iArr3[max];
iArr14[1] = iArr4[max];
iArr14[2] = iArr5[max];
int abs2 = i11 - Math.abs(i45);
i47 += iArr3[max] * abs2;
i48 += iArr4[max] * abs2;
i49 += iArr5[max] * abs2;
if (i45 > 0) {
i53 += iArr14[0];
i54 += iArr14[1];
i55 += iArr14[2];
} else {
i50 += iArr14[0];
i51 += iArr14[1];
i52 += iArr14[2];
}
int i56 = i42;
if (i45 < i56) {
i46 += width;
}
i45++;
i42 = i56;
iArr6 = iArr13;
}
int[] iArr15 = iArr6;
int i57 = i42;
int i58 = i54;
int i59 = i55;
int i60 = i43;
int i61 = 0;
int i62 = i2;
int i63 = i53;
int i64 = i52;
int i65 = i51;
int i66 = i50;
int i67 = i49;
int i68 = i48;
int i69 = i47;
int i70 = i44;
while (i61 < i60) {
iArr2[i70] = (iArr2[i70] & (-16777216)) | (iArr12[i69] << 16) | (iArr12[i68] << 8) | iArr12[i67];
int i71 = i69 - i66;
int i72 = i68 - i65;
int i73 = i67 - i64;
int[] iArr16 = iArr8[((i62 - i2) + i6) % i6];
int i74 = i66 - iArr16[0];
int i75 = i65 - iArr16[1];
int i76 = i64 - iArr16[2];
if (i44 == 0) {
iArr15[i61] = Math.min(i61 + i11, i57) * width;
}
int i77 = iArr15[i61] + i44;
iArr16[0] = iArr3[i77];
iArr16[1] = iArr4[i77];
iArr16[2] = iArr5[i77];
int i78 = i63 + iArr16[0];
int i79 = i58 + iArr16[1];
int i80 = i59 + iArr16[2];
i69 = i71 + i78;
i68 = i72 + i79;
i67 = i73 + i80;
i62 = (i62 + 1) % i6;
int[] iArr17 = iArr8[i62];
i66 = i74 + iArr17[0];
i65 = i75 + iArr17[1];
i64 = i76 + iArr17[2];
i63 = i78 - iArr17[0];
i58 = i79 - iArr17[1];
i59 = i80 - iArr17[2];
i70 += width;
i61++;
i2 = i;
}
i44++;
i2 = i;
i43 = i60;
i42 = i57;
iArr6 = iArr15;
}
int i81 = i43;
Log.e("pix", width + " " + i81 + " " + iArr2.length);
bitmap3.setPixels(iArr2, 0, width, 0, 0, width, i81);
return bitmap3;
}
}

View File

@@ -0,0 +1,16 @@
package com.ubtech.utils;
import android.content.Context;
import android.util.DisplayMetrics;
/* loaded from: classes2.dex */
public class DensityUtils {
public static float a(Context context, int i) {
return (i * context.getResources().getDisplayMetrics().density) + 0.5f;
}
public static int[] a(Context context) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return new int[]{displayMetrics.widthPixels, displayMetrics.heightPixels};
}
}

View File

@@ -0,0 +1,36 @@
package com.ubtech.utils;
import android.content.Context;
import android.util.DisplayMetrics;
/* loaded from: classes2.dex */
public class DisplayUtil {
public static int a(Context context, float f) {
if (context != null) {
return (int) ((f * context.getResources().getDisplayMetrics().density) + 0.5f);
}
return 0;
}
public static int b(Context context) {
new DisplayMetrics();
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
if (displayMetrics == null) {
return 0;
}
return displayMetrics.widthPixels;
}
public static int a(Context context) {
new DisplayMetrics();
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
if (displayMetrics == null) {
return 0;
}
return displayMetrics.heightPixels;
}
public static int a(Context context, int i) {
return context.getResources().getDimensionPixelSize(i);
}
}

View File

@@ -0,0 +1,90 @@
package com.ubtech.utils;
/* loaded from: classes2.dex */
public class EncryptUtils {
/* JADX WARN: Not initialized variable reg: 4, insn: 0x0049: MOVE (r1 I:??[OBJECT, ARRAY]) = (r4 I:??[OBJECT, ARRAY]), block:B:32:0x0049 */
/* JADX WARN: Removed duplicated region for block: B:35:0x004c A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static java.lang.String a(java.io.File r7) {
/*
boolean r0 = r7.isFile()
r1 = 0
if (r0 != 0) goto L8
return r1
L8:
r0 = 1024(0x400, float:1.435E-42)
byte[] r2 = new byte[r0]
java.lang.String r3 = "MD5"
java.security.MessageDigest r3 = java.security.MessageDigest.getInstance(r3) // Catch: java.lang.Throwable -> L36 java.lang.Exception -> L38
java.io.FileInputStream r4 = new java.io.FileInputStream // Catch: java.lang.Throwable -> L36 java.lang.Exception -> L38
r4.<init>(r7) // Catch: java.lang.Throwable -> L36 java.lang.Exception -> L38
L17:
r7 = 0
int r5 = r4.read(r2, r7, r0) // Catch: java.lang.Exception -> L34 java.lang.Throwable -> L48
r6 = -1
if (r5 == r6) goto L23
r3.update(r2, r7, r5) // Catch: java.lang.Exception -> L34 java.lang.Throwable -> L48
goto L17
L23:
r4.close() // Catch: java.lang.Exception -> L27
goto L2b
L27:
r7 = move-exception
r7.printStackTrace()
L2b:
byte[] r7 = r3.digest()
java.lang.String r7 = a(r7)
return r7
L34:
r7 = move-exception
goto L3a
L36:
r7 = move-exception
goto L4a
L38:
r7 = move-exception
r4 = r1
L3a:
r7.printStackTrace() // Catch: java.lang.Throwable -> L48
if (r4 == 0) goto L47
r4.close() // Catch: java.lang.Exception -> L43
goto L47
L43:
r7 = move-exception
r7.printStackTrace()
L47:
return r1
L48:
r7 = move-exception
r1 = r4
L4a:
if (r1 == 0) goto L54
r1.close() // Catch: java.lang.Exception -> L50
goto L54
L50:
r0 = move-exception
r0.printStackTrace()
L54:
throw r7
*/
throw new UnsupportedOperationException("Method not decompiled: com.ubtech.utils.EncryptUtils.a(java.io.File):java.lang.String");
}
private static String a(byte[] bArr) {
StringBuilder sb = new StringBuilder("");
if (bArr == null || bArr.length <= 0) {
return null;
}
for (byte b : bArr) {
String hexString = Integer.toHexString(b & 255);
if (hexString.length() < 2) {
sb.append(0);
}
sb.append(hexString);
}
return sb.toString();
}
}

View File

@@ -0,0 +1,500 @@
package com.ubtech.utils;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.ijm.dataencryption.de.DataDecryptTool;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
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.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/* loaded from: classes2.dex */
public class FileHelper {
public static final String a = "FileHelper";
public static void a(Context context, String str, String str2, boolean z) throws IOException {
a(context.getAssets().open(str), str2, z);
}
public static boolean b(File file, File file2) {
boolean z = false;
if (file != null && file.exists() && file.isFile() && file2 != null) {
try {
FileInputStream fileInputStream = new FileInputStream(file);
try {
FileOutputStream fileOutputStream = new FileOutputStream(file2);
try {
byte[] bArr = new byte[DataDecryptTool.DECRYPT_SP_FILE];
while (true) {
int read = fileInputStream.read(bArr);
if (read == -1) {
break;
}
fileOutputStream.write(bArr, 0, read);
}
fileOutputStream.flush();
z = true;
fileOutputStream.close();
fileInputStream.close();
} finally {
}
} finally {
}
} catch (Exception e) {
e.printStackTrace();
}
}
return z;
}
public static boolean c(String str, String str2) {
File file = new File(str);
if (!file.exists() || TextUtils.isEmpty(str2)) {
return false;
}
return file.renameTo(new File(str2));
}
public static void a(String str, String str2, boolean z) throws IOException {
File file = new File(str);
if (file.exists()) {
a(new FileInputStream(file), str2, z);
}
}
public static void a(InputStream inputStream, String str, boolean z) throws IOException {
File file = new File(str);
if (!file.exists()) {
file.mkdirs();
}
ZipInputStream zipInputStream = new ZipInputStream(inputStream);
try {
try {
byte[] bArr = new byte[1048576];
for (ZipEntry nextEntry = zipInputStream.getNextEntry(); nextEntry != null; nextEntry = zipInputStream.getNextEntry()) {
String replace = nextEntry.getName().replace("\\", File.separator);
if (nextEntry.isDirectory()) {
File file2 = new File(str + File.separator + replace);
if (z || !file2.exists()) {
file2.mkdirs();
}
} else {
File file3 = new File(str + File.separator + replace);
if (!file3.getParentFile().exists()) {
file3.getParentFile().mkdirs();
}
if (z || !file3.exists()) {
if (file3.getParentFile().exists() && !file3.getParentFile().isDirectory()) {
file3.getParentFile().mkdirs();
}
if (replace.endsWith(File.separator)) {
file3.mkdirs();
} else {
file3.createNewFile();
FileOutputStream fileOutputStream = new FileOutputStream(file3);
while (true) {
try {
int read = zipInputStream.read(bArr);
if (read <= 0) {
break;
} else {
fileOutputStream.write(bArr, 0, read);
}
} catch (Throwable th) {
try {
throw th;
} catch (Throwable th2) {
try {
fileOutputStream.close();
} catch (Throwable th3) {
th.addSuppressed(th3);
}
throw th2;
}
}
}
fileOutputStream.close();
}
}
}
}
try {
zipInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e2) {
e2.printStackTrace();
throw e2;
}
} catch (Throwable th4) {
try {
zipInputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
throw th4;
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v0, types: [java.io.File] */
/* JADX WARN: Type inference failed for: r1v1 */
/* JADX WARN: Type inference failed for: r1v10 */
/* JADX WARN: Type inference failed for: r1v11 */
/* JADX WARN: Type inference failed for: r1v12, types: [java.io.InputStreamReader, java.io.Reader] */
/* JADX WARN: Type inference failed for: r1v2 */
/* JADX WARN: Type inference failed for: r1v3 */
/* JADX WARN: Type inference failed for: r1v4, types: [java.io.Closeable] */
/* JADX WARN: Type inference failed for: r1v5 */
/* JADX WARN: Type inference failed for: r1v7 */
/* JADX WARN: Type inference failed for: r1v9 */
public static String b(String str, String str2) {
FileInputStream fileInputStream;
Closeable closeable;
Closeable closeable2;
?? file = new File(str);
String str3 = "";
if (file.exists() && !file.isDirectory()) {
if (str2 == null || "".equals(str2)) {
str2 = "UTF-8";
}
BufferedReader bufferedReader = null;
try {
try {
fileInputStream = new FileInputStream((File) file);
try {
file = new InputStreamReader(fileInputStream, str2);
try {
BufferedReader bufferedReader2 = new BufferedReader(file);
try {
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader2.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
}
str3 = sb.toString();
a(bufferedReader2);
closeable2 = file;
} catch (FileNotFoundException e) {
e = e;
bufferedReader = bufferedReader2;
e.printStackTrace();
Log.i(a, e.getMessage());
closeable = file;
a(bufferedReader);
closeable2 = closeable;
a(closeable2);
a(fileInputStream);
return str3;
} catch (IOException e2) {
e = e2;
bufferedReader = bufferedReader2;
e.printStackTrace();
Log.i(a, e.getMessage());
closeable = file;
a(bufferedReader);
closeable2 = closeable;
a(closeable2);
a(fileInputStream);
return str3;
} catch (Throwable th) {
th = th;
bufferedReader = bufferedReader2;
a(bufferedReader);
a((Closeable) file);
a(fileInputStream);
throw th;
}
} catch (FileNotFoundException e3) {
e = e3;
} catch (IOException e4) {
e = e4;
}
} catch (FileNotFoundException e5) {
e = e5;
file = 0;
} catch (IOException e6) {
e = e6;
file = 0;
} catch (Throwable th2) {
th = th2;
file = 0;
}
} catch (FileNotFoundException e7) {
e = e7;
file = 0;
fileInputStream = null;
} catch (IOException e8) {
e = e8;
file = 0;
fileInputStream = null;
} catch (Throwable th3) {
th = th3;
file = 0;
fileInputStream = null;
}
a(closeable2);
a(fileInputStream);
} catch (Throwable th4) {
th = th4;
}
}
return str3;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Not initialized variable reg: 2, insn: 0x004e: MOVE (r0 I:??[OBJECT, ARRAY]) = (r2 I:??[OBJECT, ARRAY]), block:B:41:0x004e */
/* JADX WARN: Type inference failed for: r1v1, types: [boolean] */
/* JADX WARN: Type inference failed for: r1v2, types: [java.io.Closeable] */
/* JADX WARN: Type inference failed for: r1v3 */
/* JADX WARN: Type inference failed for: r1v4 */
/* JADX WARN: Type inference failed for: r1v5 */
/* JADX WARN: Type inference failed for: r1v6 */
/* JADX WARN: Type inference failed for: r1v7 */
/* JADX WARN: Type inference failed for: r1v9, types: [java.io.FileInputStream] */
public static byte[] b(File file) {
Closeable closeable;
ByteArrayOutputStream byteArrayOutputStream;
Closeable closeable2;
Closeable closeable3 = null;
r0 = null;
byte[] bArr = null;
closeable3 = null;
if (file != null) {
?? isFile = file.isFile();
try {
if (isFile != 0) {
try {
isFile = new FileInputStream(file);
} catch (IOException e) {
e = e;
isFile = 0;
byteArrayOutputStream = null;
} catch (Exception e2) {
e = e2;
isFile = 0;
byteArrayOutputStream = null;
} catch (Throwable th) {
th = th;
isFile = 0;
}
try {
byte[] bArr2 = new byte[DataDecryptTool.DECRYPT_SP_FILE];
byteArrayOutputStream = new ByteArrayOutputStream();
while (true) {
try {
int read = isFile.read(bArr2);
if (read == -1) {
break;
}
byteArrayOutputStream.write(bArr2, 0, read);
} catch (IOException e3) {
e = e3;
e.printStackTrace();
closeable2 = isFile;
a(closeable2);
a(byteArrayOutputStream);
return bArr;
} catch (Exception e4) {
e = e4;
e.printStackTrace();
closeable2 = isFile;
a(closeable2);
a(byteArrayOutputStream);
return bArr;
}
}
bArr = byteArrayOutputStream.toByteArray();
closeable2 = isFile;
} catch (IOException e5) {
e = e5;
byteArrayOutputStream = null;
} catch (Exception e6) {
e = e6;
byteArrayOutputStream = null;
} catch (Throwable th2) {
th = th2;
a((Closeable) isFile);
a(closeable3);
throw th;
}
a(closeable2);
a(byteArrayOutputStream);
return bArr;
}
} catch (Throwable th3) {
th = th3;
closeable3 = closeable;
}
}
Log.e(a, "FileHelper#readFileToByteArray: file not exist");
return null;
}
public static void a(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void a(File file) {
if (file == null) {
return;
}
if (file.isFile()) {
file.delete();
return;
}
if (file.isDirectory()) {
File[] listFiles = file.listFiles();
if (listFiles != null && listFiles.length != 0) {
for (File file2 : listFiles) {
a(file2);
}
file.delete();
return;
}
file.delete();
}
}
public static boolean a(String str, String str2, String str3) {
FileOutputStream fileOutputStream;
OutputStreamWriter outputStreamWriter;
BufferedWriter bufferedWriter = null;
try {
if (TextUtils.isEmpty(str3)) {
str3 = "UTF-8";
}
File file = new File(str);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream fileOutputStream2 = new FileOutputStream(file);
try {
outputStreamWriter = new OutputStreamWriter(fileOutputStream2, str3);
try {
BufferedWriter bufferedWriter2 = new BufferedWriter(outputStreamWriter);
try {
bufferedWriter2.write(str2);
bufferedWriter2.flush();
a(bufferedWriter2);
a(outputStreamWriter);
a(fileOutputStream2);
return true;
} catch (Exception e) {
e = e;
bufferedWriter = bufferedWriter2;
Exception exc = e;
fileOutputStream = fileOutputStream2;
e = exc;
try {
e.printStackTrace();
Log.i(a, e.getMessage());
a(bufferedWriter);
a(outputStreamWriter);
a(fileOutputStream);
return false;
} catch (Throwable th) {
th = th;
a(bufferedWriter);
a(outputStreamWriter);
a(fileOutputStream);
throw th;
}
} catch (Throwable th2) {
th = th2;
bufferedWriter = bufferedWriter2;
Throwable th3 = th;
fileOutputStream = fileOutputStream2;
th = th3;
a(bufferedWriter);
a(outputStreamWriter);
a(fileOutputStream);
throw th;
}
} catch (Exception e2) {
e = e2;
} catch (Throwable th4) {
th = th4;
}
} catch (Exception e3) {
e = e3;
outputStreamWriter = null;
} catch (Throwable th5) {
th = th5;
outputStreamWriter = null;
}
} catch (Exception e4) {
e = e4;
fileOutputStream = null;
outputStreamWriter = null;
} catch (Throwable th6) {
th = th6;
fileOutputStream = null;
outputStreamWriter = null;
}
}
public static void a(File file, File file2) throws Exception {
if (file == null || !file.exists()) {
return;
}
if (file.isFile()) {
b(file, file2);
return;
}
if (!file2.exists()) {
file2.mkdirs();
}
File[] listFiles = file.listFiles();
if (listFiles == null || listFiles.length == 0) {
return;
}
for (int i = 0; i < listFiles.length; i++) {
if (listFiles[i].isFile()) {
b(listFiles[i], new File(file2.getAbsolutePath() + File.separator + listFiles[i].getName()));
}
if (listFiles[i].isDirectory()) {
a(new File(file.getAbsolutePath() + File.separator + listFiles[i].getName()), new File(file2.getAbsolutePath() + File.separator + listFiles[i].getName()));
}
}
}
public static String a(String str) {
if (TextUtils.isEmpty(str)) {
return "";
}
int lastIndexOf = str.lastIndexOf(File.separator);
return lastIndexOf == -1 ? str : str.substring(lastIndexOf + 1);
}
public static boolean a(String str, String str2) {
if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str) || !new File(str2).exists()) {
return false;
}
return EncryptUtils.a(new File(str2)).toLowerCase().equals(str.toLowerCase());
}
}

View File

@@ -0,0 +1,11 @@
package com.ubtech.utils;
import android.content.Context;
import androidx.core.content.ContextCompat;
/* loaded from: classes2.dex */
public class PermissionHelper {
public static boolean a(Context context, String str) {
return ContextCompat.a(context, str) == 0;
}
}

View File

@@ -0,0 +1,67 @@
package com.ubtech.utils;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.regex.Pattern;
/* loaded from: classes2.dex */
public class StringUtils {
public static boolean a(CharSequence charSequence) {
return a("^((13[0-9])|(14[5,9])|16[0-7]|(15[0-3,5-9])|(17[0-3,5-8])|(18[0-9])|(147)|(149)|(191)|(193)|(19[8,9]))\\d{8}$", charSequence);
}
public static String b(String str) {
try {
return URLEncoder.encode(str, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
return str;
}
}
public static String c(String str) {
return String.format("TB_DIY_STEP_%s", str);
}
public static boolean d(String str) {
try {
return Pattern.compile("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}").matcher(str).matches();
} catch (Exception unused) {
return false;
}
}
public static boolean e(String str) {
return str == null || str.length() < 1;
}
public static boolean f(String str) {
try {
return Pattern.compile("[0-9]{1,}").matcher(str).matches();
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static boolean a(String str, CharSequence charSequence) {
return charSequence != null && charSequence.length() > 0 && Pattern.matches(str, charSequence);
}
public static String a(String str) {
try {
return URLDecoder.decode(str, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
return str;
}
}
public static boolean a(char c) {
return Pattern.compile("[\\u4e00-\\u9fa5]").matcher(c + "").matches();
}
public static String a(String str, String str2) {
return String.format("TB_DIY_STEP_%s_%s", str, str2);
}
}

View File

@@ -0,0 +1,46 @@
package com.ubtech.utils;
import android.util.Log;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public class ThreadExecutor {
private static ThreadExecutor c;
private String a = "ThreadExecutor";
private ExecutorService b;
private ThreadExecutor() {
this.b = null;
if (this.b == null) {
int min = Math.min(3, (int) ((Runtime.getRuntime().availableProcessors() * 1.2d) + 1.0d));
this.b = new ThreadPoolExecutor(min, min, 10000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
}
}
public void a(Runnable runnable) {
if (this.b.isShutdown()) {
Log.i(this.a, "ExecutorService was already shutdown!");
} else {
this.b.execute(runnable);
}
}
public <T> Future<T> a(Callable<T> callable) {
FutureTask futureTask = new FutureTask(callable);
this.b.execute(futureTask);
return futureTask;
}
public static ThreadExecutor a() {
if (c == null) {
c = new ThreadExecutor();
}
return c;
}
}

View File

@@ -0,0 +1,51 @@
package com.ubtech.utils;
import android.content.Context;
import android.util.DisplayMetrics;
/* loaded from: classes2.dex */
public class ViewUtils {
public static class Value {
public int a;
public int b;
public int c;
public int d;
public int e;
public int f;
public int[] a() {
return new int[]{this.c, this.d};
}
public String toString() {
return "Value{horiSpace=" + this.a + ", vertSpace=" + this.b + ", childWidth=" + this.c + ", childHeight=" + this.d + ", width=" + this.e + ", height=" + this.f + '}';
}
}
public static DisplayMetrics a(Context context) {
return context.getResources().getDisplayMetrics();
}
public static Value a(int i, int i2, int i3, int i4, int i5, float f) {
Value value = new Value();
value.e = i;
value.f = i2;
if ((i2 * 1.0f) / i > (i4 * f) / i3) {
value.c = (value.e - (i5 * i3)) / i3;
value.d = (int) (value.c * f);
value.a = i5;
value.b = (value.f - (value.d * i4)) / i4;
} else {
value.d = (value.f - (i5 * i4)) / i4;
value.c = (int) (value.d / f);
value.b = i5;
value.a = (value.e - (value.c * i3)) / i3;
}
return value;
}
public static int a(Context context, int i) {
return context.getResources().getDimensionPixelSize(i);
}
}

View File

@@ -0,0 +1,141 @@
package com.ubtech.utils;
import android.text.TextUtils;
import android.util.Log;
import com.ubtrobot.log.ALog;
import java.lang.reflect.Method;
import java.util.Map;
/* loaded from: classes2.dex */
public class XLog {
private static boolean a = true;
private static String b = "XLog";
private static boolean c = false;
private static Map<Integer, Integer> d;
private static String a(int i) {
if (i == 0) {
return "v";
}
if (i == 1) {
return "d";
}
if (i == 2) {
return "i";
}
if (i == 3) {
return "w";
}
if (i != 4) {
return null;
}
return "e";
}
public static void a(boolean z) {
a = z;
}
public static void b(String str, String str2) {
ALog.a(str).b(a(str2), new Object[0]);
}
public static void c(String str, String str2) {
ALog.a(str).e(a(str2), new Object[0]);
}
public static void d(String str, String str2) {
if (a) {
ALog.a(str).a(a(str2), new Object[0]);
}
}
public static void a(String str, String str2) {
if (a) {
ALog.a(str).d(a(str2));
}
}
public static void b(String str, String str2, Object... objArr) {
ALog.a(str).b(a(String.format(str2, objArr)), new Object[0]);
}
public static void c(String str, String str2, Object... objArr) {
ALog.a(str).e(a(String.format(str2, objArr)), new Object[0]);
}
public static void d(String str, String str2, Object... objArr) {
ALog.a(str).c(a(String.format(str2, objArr)), new Object[0]);
}
public static void a(String str, String str2, Object... objArr) {
if (a) {
ALog.a(str).d(a(String.format(str2, objArr)));
}
}
public static void a(String str, String str2, Throwable th) {
a(4, str, a(str2), th);
}
private static void a(int i, String str, String str2, Throwable th) {
if (c && d.containsKey(Integer.valueOf(i))) {
i = d.get(Integer.valueOf(i)).intValue();
}
String str3 = b + "-" + str;
String a2 = a(i);
if (TextUtils.isEmpty(a2)) {
return;
}
try {
if (th != null) {
Method method = Log.class.getMethod(a2, String.class, String.class, Throwable.class);
if (method != null) {
method.invoke(null, str3, str2, th);
}
} else {
Method method2 = Log.class.getMethod(a2, String.class, String.class);
if (method2 != null) {
method2.invoke(null, str3, str2);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private static String a(String str) {
String className;
StringBuilder sb = new StringBuilder();
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
if (stackTrace != null) {
int length = stackTrace.length;
int i = 0;
while (true) {
if (i >= length) {
break;
}
StackTraceElement stackTraceElement = stackTrace[i];
if (stackTraceElement == null || (className = stackTraceElement.getClassName()) == null || className.contains(XLog.class.getSimpleName())) {
i++;
} else {
String substring = className.substring(className.lastIndexOf(".") + 1);
if (className.contains("$")) {
substring = substring.replace("$", ".");
}
sb.append("[");
sb.append(substring);
sb.append(":");
sb.append(stackTraceElement.getMethodName());
sb.append("-");
sb.append(stackTraceElement.getLineNumber());
sb.append("-");
sb.append(Thread.currentThread().getName());
sb.append("] ");
sb.append(str);
}
}
}
return sb.toString();
}
}

View File

@@ -0,0 +1,43 @@
package com.ubtech.utils;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/* loaded from: classes2.dex */
public class XmlHelper {
public static Document a(String str) throws Exception {
try {
return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(str)));
} catch (IOException e) {
e.printStackTrace();
throw e;
} catch (ParserConfigurationException e2) {
e2.printStackTrace();
throw e2;
} catch (SAXException e3) {
e3.printStackTrace();
throw e3;
}
}
public static Document a(File file) throws Exception {
try {
return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file);
} catch (IOException e) {
e.printStackTrace();
throw e;
} catch (ParserConfigurationException e2) {
e2.printStackTrace();
throw e2;
} catch (SAXException e3) {
e3.printStackTrace();
throw e3;
}
}
}