Initial commit
This commit is contained in:
29
sources/com/ubt/jimu/utils/AnimUtils.java
Normal file
29
sources/com/ubt/jimu/utils/AnimUtils.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.os.Build;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.CycleInterpolator;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AnimUtils {
|
||||
public static Animation a(int i) {
|
||||
TranslateAnimation translateAnimation = new TranslateAnimation(0.0f, 10.0f, 0.0f, 0.0f);
|
||||
translateAnimation.setInterpolator(new CycleInterpolator(i));
|
||||
translateAnimation.setDuration(1000L);
|
||||
return translateAnimation;
|
||||
}
|
||||
|
||||
public static void a(ProgressBar progressBar, int i) {
|
||||
if (Build.VERSION.SDK_INT < 11) {
|
||||
return;
|
||||
}
|
||||
ObjectAnimator ofInt = ObjectAnimator.ofInt(progressBar, "progress", 0, i);
|
||||
ofInt.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
ofInt.setDuration(1400L);
|
||||
ofInt.start();
|
||||
}
|
||||
}
|
59
sources/com/ubt/jimu/utils/Base64.java
Normal file
59
sources/com/ubt/jimu/utils/Base64.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class Base64 {
|
||||
private static final byte[] a = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
|
||||
|
||||
public static String a(byte[] bArr, String str) throws UnsupportedEncodingException {
|
||||
int length = (bArr.length * 4) / 3;
|
||||
byte[] bArr2 = new byte[length + (length / 76) + 3];
|
||||
int length2 = bArr.length - (bArr.length % 3);
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < length2; i3 += 3) {
|
||||
int i4 = i + 1;
|
||||
byte[] bArr3 = a;
|
||||
bArr2[i] = bArr3[(bArr[i3] & 255) >> 2];
|
||||
int i5 = i4 + 1;
|
||||
int i6 = i3 + 1;
|
||||
bArr2[i4] = bArr3[((bArr[i3] & 3) << 4) | ((bArr[i6] & 255) >> 4)];
|
||||
int i7 = i5 + 1;
|
||||
int i8 = i3 + 2;
|
||||
bArr2[i5] = bArr3[((bArr[i6] & 15) << 2) | ((bArr[i8] & 255) >> 6)];
|
||||
i = i7 + 1;
|
||||
bArr2[i7] = bArr3[bArr[i8] & 63];
|
||||
if ((i - i2) % 76 == 0 && i != 0) {
|
||||
bArr2[i] = 10;
|
||||
i2++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
int length3 = bArr.length % 3;
|
||||
if (length3 == 1) {
|
||||
int i9 = i + 1;
|
||||
byte[] bArr4 = a;
|
||||
bArr2[i] = bArr4[(bArr[length2] & 255) >> 2];
|
||||
int i10 = i9 + 1;
|
||||
bArr2[i9] = bArr4[(bArr[length2] & 3) << 4];
|
||||
int i11 = i10 + 1;
|
||||
bArr2[i10] = 61;
|
||||
i = i11 + 1;
|
||||
bArr2[i11] = 61;
|
||||
} else if (length3 == 2) {
|
||||
int i12 = i + 1;
|
||||
byte[] bArr5 = a;
|
||||
bArr2[i] = bArr5[(bArr[length2] & 255) >> 2];
|
||||
int i13 = i12 + 1;
|
||||
int i14 = (bArr[length2] & 3) << 4;
|
||||
int i15 = length2 + 1;
|
||||
bArr2[i12] = bArr5[((bArr[i15] & 255) >> 4) | i14];
|
||||
int i16 = i13 + 1;
|
||||
bArr2[i13] = bArr5[(bArr[i15] & 15) << 2];
|
||||
i = i16 + 1;
|
||||
bArr2[i16] = 61;
|
||||
}
|
||||
return new String(bArr2, 0, i, str);
|
||||
}
|
||||
}
|
179
sources/com/ubt/jimu/utils/BitmapCompressUtils.java
Normal file
179
sources/com/ubt/jimu/utils/BitmapCompressUtils.java
Normal file
@@ -0,0 +1,179 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class BitmapCompressUtils {
|
||||
|
||||
public static class BitmapAttriBute {
|
||||
public int a;
|
||||
public Bitmap.Config b;
|
||||
public String c;
|
||||
public int d;
|
||||
|
||||
public void a(int i) {
|
||||
this.d = i;
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.c = str;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public Bitmap.Config a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void a(Bitmap.Config config) {
|
||||
this.b = config;
|
||||
}
|
||||
}
|
||||
|
||||
public static int a(BitmapAttriBute bitmapAttriBute) {
|
||||
int d = bitmapAttriBute.d();
|
||||
int b = bitmapAttriBute.b();
|
||||
double d2 = d;
|
||||
if (d2 < 1280.0d && b < 1280.0d) {
|
||||
return 0;
|
||||
}
|
||||
if (d2 <= 1280.0d && b <= 1280.0d) {
|
||||
return 0;
|
||||
}
|
||||
int i = d / b;
|
||||
return (d2 <= 1280.0d || ((double) b) <= 1280.0d) ? i > 1 ? i > 2 ? 0 : 1 : ((double) i) < 7.8125E-4d ? 0 : 2 : i > 1 ? 2 : 1;
|
||||
}
|
||||
|
||||
public static BitmapAttriBute b(String str) {
|
||||
Bitmap decodeFile = BitmapFactory.decodeFile(str);
|
||||
Log.e("comp_file_space", "原图片占用空间:" + ((decodeFile.getByteCount() / DataDecryptTool.DECRYPT_SP_FILE) / DataDecryptTool.DECRYPT_SP_FILE));
|
||||
decodeFile.recycle();
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(str, options);
|
||||
options.inJustDecodeBounds = false;
|
||||
BitmapAttriBute bitmapAttriBute = new BitmapAttriBute();
|
||||
bitmapAttriBute.a(options.outHeight);
|
||||
bitmapAttriBute.b(options.outWidth);
|
||||
bitmapAttriBute.a(options.outMimeType);
|
||||
bitmapAttriBute.a(options.inPreferredConfig);
|
||||
return bitmapAttriBute;
|
||||
}
|
||||
|
||||
public static byte[] a(String str) {
|
||||
BitmapAttriBute b = b(str);
|
||||
int a = a(b);
|
||||
int i = 100;
|
||||
if (a == 0) {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
Bitmap decodeFile = BitmapFactory.decodeFile(str);
|
||||
decodeFile.compress(b.c().contains("png") ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
|
||||
try {
|
||||
byteArrayOutputStream.flush();
|
||||
byteArrayOutputStream.close();
|
||||
decodeFile.recycle();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
}
|
||||
if (a != 1) {
|
||||
if (a == 2) {
|
||||
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = false;
|
||||
int ceil = (int) Math.ceil(b.b() / 1280.0d);
|
||||
options.inSampleSize = ceil;
|
||||
options.outWidth = (int) ((b.d() * 1280.0d) / b.b());
|
||||
options.outHeight = 1280;
|
||||
options.inDither = false;
|
||||
options.inPreferredConfig = null;
|
||||
options.inPurgeable = true;
|
||||
options.inInputShareable = true;
|
||||
Log.e("compress_height", ceil + "");
|
||||
Bitmap decodeFile2 = BitmapFactory.decodeFile(str, options);
|
||||
Log.e("compress_size_height", (decodeFile2.getByteCount() / DataDecryptTool.DECRYPT_SP_FILE) + "kb");
|
||||
decodeFile2.compress(b.c().contains("png") ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream2);
|
||||
Log.e("compress_size_h_byte", (byteArrayOutputStream2.size() / DataDecryptTool.DECRYPT_SP_FILE) + "kb");
|
||||
while (byteArrayOutputStream2.size() > 1048576 && i > 50) {
|
||||
byteArrayOutputStream2.reset();
|
||||
i -= 25;
|
||||
decodeFile2.compress(b.c().contains("png") ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, i, byteArrayOutputStream2);
|
||||
Log.e("compress_heigth_qulity", (byteArrayOutputStream2.size() / DataDecryptTool.DECRYPT_SP_FILE) + "kb");
|
||||
}
|
||||
byte[] byteArray = byteArrayOutputStream2.toByteArray();
|
||||
try {
|
||||
byteArrayOutputStream2.flush();
|
||||
byteArrayOutputStream2.close();
|
||||
decodeFile2.recycle();
|
||||
} catch (IOException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
return byteArray;
|
||||
}
|
||||
ByteArrayOutputStream byteArrayOutputStream3 = new ByteArrayOutputStream();
|
||||
Bitmap decodeFile3 = BitmapFactory.decodeFile(str);
|
||||
decodeFile3.compress(b.c().contains("png") ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream3);
|
||||
try {
|
||||
byteArrayOutputStream3.flush();
|
||||
byteArrayOutputStream3.close();
|
||||
decodeFile3.recycle();
|
||||
} catch (IOException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
return byteArrayOutputStream3.toByteArray();
|
||||
}
|
||||
ByteArrayOutputStream byteArrayOutputStream4 = new ByteArrayOutputStream();
|
||||
BitmapFactory.Options options2 = new BitmapFactory.Options();
|
||||
options2.inJustDecodeBounds = false;
|
||||
int ceil2 = (int) Math.ceil(b.d() / 1280.0d);
|
||||
options2.inSampleSize = ceil2;
|
||||
options2.inPreferredConfig = Bitmap.Config.ARGB_8888;
|
||||
Log.e("compress_width", ceil2 + "");
|
||||
options2.outHeight = (int) ((((double) b.b()) * 1280.0d) / ((double) b.d()));
|
||||
options2.outWidth = 1280;
|
||||
options2.inDither = false;
|
||||
options2.inPreferredConfig = b.a();
|
||||
options2.inPurgeable = true;
|
||||
options2.inInputShareable = true;
|
||||
Bitmap decodeFile4 = BitmapFactory.decodeFile(str, options2);
|
||||
Log.e("compress_size", "原图片高度:" + b.b() + "原图片宽度:" + b.d());
|
||||
Log.e("compress_size", "图片大小" + ((decodeFile4.getByteCount() / DataDecryptTool.DECRYPT_SP_FILE) / DataDecryptTool.DECRYPT_SP_FILE) + "M 图片高度:" + decodeFile4.getHeight() + "图片宽度:" + decodeFile4.getWidth());
|
||||
decodeFile4.compress(b.c().contains("png") ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream4);
|
||||
Log.e("compress_size_byte", (byteArrayOutputStream4.size() / DataDecryptTool.DECRYPT_SP_FILE) + "kb");
|
||||
while (byteArrayOutputStream4.size() > 1048576 && i > 50) {
|
||||
byteArrayOutputStream4.reset();
|
||||
i -= 25;
|
||||
decodeFile4.compress(b.c().contains("png") ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, i, byteArrayOutputStream4);
|
||||
Log.e("compress_width_qulity", (byteArrayOutputStream4.size() / DataDecryptTool.DECRYPT_SP_FILE) + "kb");
|
||||
}
|
||||
byte[] byteArray2 = byteArrayOutputStream4.toByteArray();
|
||||
try {
|
||||
byteArrayOutputStream4.flush();
|
||||
byteArrayOutputStream4.close();
|
||||
decodeFile4.recycle();
|
||||
} catch (IOException e4) {
|
||||
e4.printStackTrace();
|
||||
}
|
||||
return byteArray2;
|
||||
}
|
||||
}
|
150
sources/com/ubt/jimu/utils/BitmapUtils.java
Normal file
150
sources/com/ubt/jimu/utils/BitmapUtils.java
Normal file
@@ -0,0 +1,150 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.renderscript.Allocation;
|
||||
import android.renderscript.Element;
|
||||
import android.renderscript.RenderScript;
|
||||
import android.renderscript.ScriptIntrinsicBlur;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import com.ubt.jimu.utils.ExternalOverFroyoUtils;
|
||||
import com.ubtech.utils.BitmapFile;
|
||||
import com.ubtech.utils.BlurHelper;
|
||||
import com.ubtech.utils.DensityUtils;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class BitmapUtils {
|
||||
public static Bitmap a(Context context, Bitmap bitmap, String str) {
|
||||
File file = new File(ExternalOverFroyoUtils.a(context, ExternalOverFroyoUtils.Dir.Image.getName()), str);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
int[] a = DensityUtils.a(context);
|
||||
return a(file.getPath(), Math.max(a[0], a[1]), Math.min(a[0], a[1]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
BlurHelper a2 = BlurHelper.a(context);
|
||||
a2.a(bitmap);
|
||||
a2.a(25);
|
||||
a2.a(1.0f);
|
||||
Bitmap a3 = a2.a();
|
||||
if (a3 == null) {
|
||||
return null;
|
||||
}
|
||||
BitmapFile.a(a3, file.getAbsolutePath());
|
||||
return a3;
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap a(Context context, Bitmap bitmap, float f) {
|
||||
if (bitmap == null) {
|
||||
return null;
|
||||
}
|
||||
Bitmap createBitmap = Bitmap.createBitmap(bitmap);
|
||||
RenderScript create = RenderScript.create(context);
|
||||
ScriptIntrinsicBlur create2 = ScriptIntrinsicBlur.create(create, Element.U8_4(create));
|
||||
Allocation createFromBitmap = Allocation.createFromBitmap(create, bitmap);
|
||||
Allocation createFromBitmap2 = Allocation.createFromBitmap(create, createBitmap);
|
||||
create2.setRadius(f);
|
||||
create2.setInput(createFromBitmap);
|
||||
create2.forEach(createFromBitmap2);
|
||||
createFromBitmap2.copyTo(createBitmap);
|
||||
create2.destroy();
|
||||
createFromBitmap2.destroy();
|
||||
createFromBitmap.destroy();
|
||||
create.destroy();
|
||||
return createBitmap;
|
||||
}
|
||||
|
||||
public static int a(BitmapFactory.Options options, int i, int i2) {
|
||||
int i3 = options.outHeight;
|
||||
int i4 = options.outWidth;
|
||||
int i5 = 1;
|
||||
if (i3 > i2 || i4 > i) {
|
||||
int i6 = i3 / 2;
|
||||
int i7 = i4 / 2;
|
||||
while (true) {
|
||||
if (i6 / i5 <= i2 && i7 / i5 <= i7) {
|
||||
break;
|
||||
}
|
||||
i5 *= 2;
|
||||
}
|
||||
}
|
||||
return i5;
|
||||
}
|
||||
|
||||
public static Bitmap a(String str, int i, int i2) {
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(str, options);
|
||||
options.inSampleSize = a(options, i, i2);
|
||||
options.inJustDecodeBounds = false;
|
||||
return BitmapFactory.decodeFile(str, options);
|
||||
}
|
||||
|
||||
public static Bitmap a(Context context, View view) {
|
||||
Bitmap bitmap = null;
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||
int i = displayMetrics.heightPixels;
|
||||
int i2 = displayMetrics.widthPixels;
|
||||
if (view != null) {
|
||||
view.clearFocus();
|
||||
view.setPressed(false);
|
||||
boolean willNotCacheDrawing = view.willNotCacheDrawing();
|
||||
view.setWillNotCacheDrawing(false);
|
||||
int drawingCacheBackgroundColor = view.getDrawingCacheBackgroundColor();
|
||||
view.setDrawingCacheBackgroundColor(0);
|
||||
float alpha = view.getAlpha();
|
||||
view.setAlpha(1.0f);
|
||||
if (drawingCacheBackgroundColor != 0) {
|
||||
view.destroyDrawingCache();
|
||||
}
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i2, 1073741824), View.MeasureSpec.makeMeasureSpec(i, 1073741824));
|
||||
view.layout(0, 0, i2, i);
|
||||
view.bringToFront();
|
||||
view.buildDrawingCache();
|
||||
Bitmap drawingCache = view.getDrawingCache();
|
||||
if (drawingCache == null) {
|
||||
return null;
|
||||
}
|
||||
bitmap = Bitmap.createBitmap(drawingCache);
|
||||
view.setAlpha(alpha);
|
||||
view.destroyDrawingCache();
|
||||
view.setWillNotCacheDrawing(willNotCacheDrawing);
|
||||
view.setDrawingCacheBackgroundColor(drawingCacheBackgroundColor);
|
||||
}
|
||||
return a(context, bitmap, 25.0f);
|
||||
}
|
||||
|
||||
public static Bitmap a(Drawable drawable) {
|
||||
Bitmap createBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(createBitmap);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
drawable.draw(canvas);
|
||||
return createBitmap;
|
||||
}
|
||||
|
||||
public static Bitmap a(Context context, int i, int i2, int i3) {
|
||||
Drawable c = ContextCompat.c(context, i);
|
||||
Bitmap createBitmap = Bitmap.createBitmap(i2, i3, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(createBitmap);
|
||||
c.setBounds(0, 0, i2, i3);
|
||||
c.draw(canvas);
|
||||
return createBitmap;
|
||||
}
|
||||
}
|
184
sources/com/ubt/jimu/utils/CrashExceptionHandler.java
Normal file
184
sources/com/ubt/jimu/utils/CrashExceptionHandler.java
Normal file
@@ -0,0 +1,184 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.Thread;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CrashExceptionHandler implements Thread.UncaughtExceptionHandler {
|
||||
private static CrashExceptionHandler d;
|
||||
private Context a;
|
||||
private Thread.UncaughtExceptionHandler b;
|
||||
private Map<String, String> c = new HashMap();
|
||||
|
||||
private CrashExceptionHandler(Context context) {
|
||||
c(context);
|
||||
}
|
||||
|
||||
private boolean a(Throwable th, Thread thread) {
|
||||
if (th == null) {
|
||||
return true;
|
||||
}
|
||||
a(this.a);
|
||||
a(th);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static CrashExceptionHandler b(Context context) {
|
||||
if (d == null) {
|
||||
d = new CrashExceptionHandler(context);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
private void c(Context context) {
|
||||
this.a = context;
|
||||
this.b = Thread.getDefaultUncaughtExceptionHandler();
|
||||
}
|
||||
|
||||
@Override // java.lang.Thread.UncaughtExceptionHandler
|
||||
public void uncaughtException(Thread thread, Throwable th) {
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.b;
|
||||
if (uncaughtExceptionHandler != null) {
|
||||
uncaughtExceptionHandler.uncaughtException(thread, th);
|
||||
}
|
||||
if (a(th, thread)) {
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(10);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint({"SimpleDateFormat"})
|
||||
private void a(Throwable th) {
|
||||
StringBuilder sb;
|
||||
if (th == null) {
|
||||
return;
|
||||
}
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
for (String str : this.c.keySet()) {
|
||||
String str2 = this.c.get(str);
|
||||
sb2.append(str);
|
||||
sb2.append("=");
|
||||
sb2.append(str2);
|
||||
sb2.append("\n");
|
||||
}
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
PrintWriter printWriter = new PrintWriter(stringWriter);
|
||||
th.printStackTrace(printWriter);
|
||||
for (Throwable cause = th.getCause(); cause != null; cause = cause.getCause()) {
|
||||
cause.printStackTrace(printWriter);
|
||||
}
|
||||
printWriter.close();
|
||||
sb2.append(stringWriter.toString());
|
||||
FileOutputStream fileOutputStream = null;
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
String str3 = simpleDateFormat.format(new Date()) + "-" + currentTimeMillis + ".txt";
|
||||
try {
|
||||
try {
|
||||
File b = ExternalOverFroyoUtils.b(this.a, "crash");
|
||||
if (!b.exists()) {
|
||||
b.mkdirs();
|
||||
}
|
||||
FileOutputStream fileOutputStream2 = new FileOutputStream(new File(b.getAbsolutePath() + File.separator + str3));
|
||||
try {
|
||||
fileOutputStream2.write(sb2.toString().getBytes());
|
||||
try {
|
||||
fileOutputStream2.close();
|
||||
} catch (IOException e) {
|
||||
e = e;
|
||||
sb = new StringBuilder();
|
||||
sb.append("关闭Crash文件流时出错:");
|
||||
sb.append(e.getMessage());
|
||||
Log.e("CrashExceptionHandler", sb.toString());
|
||||
}
|
||||
} catch (FileNotFoundException e2) {
|
||||
e = e2;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
Log.e("CrashExceptionHandler", "保存crash文件时出错:" + e.getMessage());
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e3) {
|
||||
e = e3;
|
||||
sb = new StringBuilder();
|
||||
sb.append("关闭Crash文件流时出错:");
|
||||
sb.append(e.getMessage());
|
||||
Log.e("CrashExceptionHandler", sb.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e4) {
|
||||
e = e4;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
Log.e("CrashExceptionHandler", "保存crash文件时出错:" + e.getMessage());
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e5) {
|
||||
e = e5;
|
||||
sb = new StringBuilder();
|
||||
sb.append("关闭Crash文件流时出错:");
|
||||
sb.append(e.getMessage());
|
||||
Log.e("CrashExceptionHandler", sb.toString());
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e6) {
|
||||
Log.e("CrashExceptionHandler", "关闭Crash文件流时出错:" + e6.getMessage());
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (FileNotFoundException e7) {
|
||||
e = e7;
|
||||
} catch (Exception e8) {
|
||||
e = e8;
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Context context) {
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 1);
|
||||
if (packageInfo != null) {
|
||||
String str = packageInfo.versionName == null ? "null" : packageInfo.versionName;
|
||||
String str2 = packageInfo.versionCode + "";
|
||||
this.c.put("versionName", str);
|
||||
this.c.put("versionCode", str2);
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
Log.e("CrashExceptionHandler", "收集包信息时出错。");
|
||||
}
|
||||
try {
|
||||
for (Field field : Build.class.getDeclaredFields()) {
|
||||
field.setAccessible(true);
|
||||
this.c.put(field.getName(), field.get(null).toString());
|
||||
}
|
||||
} catch (Exception unused2) {
|
||||
Log.e("CrashExceptionHandler", "收集crash信息时出错。");
|
||||
}
|
||||
}
|
||||
}
|
41
sources/com/ubt/jimu/utils/CustomViewPager.java
Normal file
41
sources/com/ubt/jimu/utils/CustomViewPager.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CustomViewPager extends ViewPager {
|
||||
private boolean k0;
|
||||
|
||||
public CustomViewPager(Context context) {
|
||||
super(context);
|
||||
this.k0 = false;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager, android.view.ViewGroup
|
||||
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
||||
if (this.k0) {
|
||||
return super.onInterceptTouchEvent(motionEvent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager, android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
if (this.k0) {
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setScanScroll(boolean z) {
|
||||
this.k0 = z;
|
||||
}
|
||||
|
||||
public CustomViewPager(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.k0 = false;
|
||||
}
|
||||
}
|
33
sources/com/ubt/jimu/utils/DateTimeUtil.java
Normal file
33
sources/com/ubt/jimu/utils/DateTimeUtil.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.R;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
@SuppressLint({"SimpleDateFormat"})
|
||||
/* loaded from: classes2.dex */
|
||||
public class DateTimeUtil {
|
||||
public static String a() {
|
||||
return a(new Date(System.currentTimeMillis()), "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
public static String a(Date date, String str) {
|
||||
return new SimpleDateFormat(str).format(date);
|
||||
}
|
||||
|
||||
public static String a(Context context, long j) {
|
||||
if (j == 0) {
|
||||
return context.getString(R.string.unknown_date_time);
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int i = calendar.get(1);
|
||||
calendar.setTimeInMillis(j);
|
||||
if (i > calendar.get(1)) {
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(j));
|
||||
}
|
||||
return new SimpleDateFormat("MM-dd HH:mm").format(new Date(j));
|
||||
}
|
||||
}
|
117
sources/com/ubt/jimu/utils/DeviceUtils.java
Normal file
117
sources/com/ubt/jimu/utils/DeviceUtils.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubtech.utils.PermissionHelper;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DeviceUtils {
|
||||
private static String a;
|
||||
|
||||
@SuppressLint({"MissingPermission"})
|
||||
public static String a(Context context) {
|
||||
String str;
|
||||
if (!android.text.TextUtils.isEmpty(a)) {
|
||||
return a;
|
||||
}
|
||||
ALog.a("DeviceUtils").d("getDeviceId");
|
||||
if (!PermissionHelper.a(context, "android.permission.READ_PHONE_STATE")) {
|
||||
String b = b(context);
|
||||
a = b;
|
||||
return b;
|
||||
}
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
|
||||
if (telephonyManager == null) {
|
||||
String b2 = b(context);
|
||||
a = b2;
|
||||
return b2;
|
||||
}
|
||||
try {
|
||||
str = telephonyManager.getDeviceId();
|
||||
try {
|
||||
if ((android.text.TextUtils.isEmpty(str) || str.length() <= 8) && Build.VERSION.SDK_INT >= 23) {
|
||||
str = telephonyManager.getDeviceId(0);
|
||||
}
|
||||
XLog.a("woo", "get hardware DeviceId:" + str);
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
ALog.a(e, "get phone deviceId fail!", new Object[0]);
|
||||
if (!android.text.TextUtils.isEmpty(str)) {
|
||||
}
|
||||
str = b(context);
|
||||
a = str;
|
||||
return str;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
str = "";
|
||||
}
|
||||
if (!android.text.TextUtils.isEmpty(str) || str.length() <= 8) {
|
||||
str = b(context);
|
||||
}
|
||||
a = str;
|
||||
return str;
|
||||
}
|
||||
|
||||
public static void a(Activity activity) {
|
||||
}
|
||||
|
||||
private static String b(Context context) {
|
||||
android.text.TextUtils.isEmpty("");
|
||||
String string = Settings.Secure.getString(context.getContentResolver(), "android_id");
|
||||
if (android.text.TextUtils.isEmpty(string) || string.length() <= 8) {
|
||||
return Cache.getInstance().getUuid();
|
||||
}
|
||||
XLog.d("woo", "androidId :" + string, new Object[0]);
|
||||
return string;
|
||||
}
|
||||
|
||||
public static ActivityManager.MemoryInfo c(Context context) {
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
|
||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||
activityManager.getMemoryInfo(memoryInfo);
|
||||
return memoryInfo;
|
||||
}
|
||||
|
||||
public static boolean d(Context context) {
|
||||
ALog.a("DeviceUtils").d("isBackground");
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
|
||||
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService("keyguard");
|
||||
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : activityManager.getRunningAppProcesses()) {
|
||||
if (runningAppProcessInfo.processName.equals(context.getPackageName())) {
|
||||
int i = runningAppProcessInfo.importance;
|
||||
return (i != 100 && i != 200) || keyguardManager.inKeyguardRestrictedInputMode();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int a() {
|
||||
try {
|
||||
File[] listFiles = new File("/sys/devices/system/cpu/").listFiles(new FileFilter() { // from class: com.ubt.jimu.utils.DeviceUtils.1CpuFilter
|
||||
@Override // java.io.FileFilter
|
||||
public boolean accept(File file) {
|
||||
return Pattern.matches("cpu[0-9]", file.getName());
|
||||
}
|
||||
});
|
||||
ALog.a("DeviceUtils").d("CPU Count: " + listFiles.length);
|
||||
return listFiles.length;
|
||||
} catch (Exception e) {
|
||||
ALog.a("DeviceUtils").d("CPU Count: Failed.");
|
||||
e.printStackTrace();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
36
sources/com/ubt/jimu/utils/EncryptUtils.java
Normal file
36
sources/com/ubt/jimu/utils/EncryptUtils.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class EncryptUtils {
|
||||
public static String a(String str, int i) {
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.update(str.getBytes());
|
||||
byte[] digest = messageDigest.digest();
|
||||
StringBuffer stringBuffer = new StringBuffer("");
|
||||
for (int i2 = 0; i2 < digest.length; i2++) {
|
||||
int i3 = digest[i2];
|
||||
if (i3 < 0) {
|
||||
i3 += DataDecryptTool.DECRYPT_ALL_FILE;
|
||||
}
|
||||
if (i3 < 16) {
|
||||
stringBuffer.append("0");
|
||||
}
|
||||
stringBuffer.append(Integer.toHexString(i3));
|
||||
}
|
||||
return i == 32 ? stringBuffer.toString().toUpperCase() : stringBuffer.toString().substring(8, 24).toUpperCase();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(byte[] bArr) throws UnsupportedEncodingException {
|
||||
return Base64.a(bArr, "UTF-8");
|
||||
}
|
||||
}
|
102
sources/com/ubt/jimu/utils/ExternalOverFroyoUtils.java
Normal file
102
sources/com/ubt/jimu/utils/ExternalOverFroyoUtils.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.blockly.Utils;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubtech.utils.AndroidVersionCheckUtils;
|
||||
import java.io.File;
|
||||
|
||||
@TargetApi(9)
|
||||
/* loaded from: classes2.dex */
|
||||
public class ExternalOverFroyoUtils {
|
||||
|
||||
public enum Dir {
|
||||
Model("model"),
|
||||
Cache("cache"),
|
||||
User("user"),
|
||||
Image("image");
|
||||
|
||||
private String name;
|
||||
|
||||
Dir(String str) {
|
||||
this.name = str;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean a() {
|
||||
if (AndroidVersionCheckUtils.b()) {
|
||||
return Environment.isExternalStorageRemovable();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static File b(Context context, String str) {
|
||||
String path = context.getCacheDir().getPath();
|
||||
try {
|
||||
if ("mounted".equals(Environment.getExternalStorageState()) || !a()) {
|
||||
path = b(context).getPath();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("DiskCacheDir", e.getMessage() + "");
|
||||
}
|
||||
return new File(path + File.separator + str);
|
||||
}
|
||||
|
||||
public static String c(Context context) {
|
||||
return Environment.getExternalStorageDirectory().getPath() + File.separator + "Android" + File.separator + "data" + File.separator + context.getPackageName();
|
||||
}
|
||||
|
||||
public static String a(Context context, ModelType modelType) {
|
||||
String str = Environment.getExternalStorageDirectory().getPath() + File.separator + "Android" + File.separator + "data" + File.separator + context.getPackageName() + File.separator + "files" + File.separator;
|
||||
if (modelType == null) {
|
||||
return str;
|
||||
}
|
||||
return str + modelType.getName() + File.separator;
|
||||
}
|
||||
|
||||
public static String c(String str) {
|
||||
return b() + File.separator + "playerdata" + File.separator + str;
|
||||
}
|
||||
|
||||
public static String a(Context context) {
|
||||
String str = Environment.getExternalStorageDirectory().getPath() + File.separator + "Android" + File.separator + "data" + File.separator + context.getPackageName() + File.separator + "apk";
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static File b(Context context) {
|
||||
if (AndroidVersionCheckUtils.a()) {
|
||||
return context.getExternalCacheDir();
|
||||
}
|
||||
return new File(Environment.getExternalStorageDirectory().getPath() + ("/Android/data/" + context.getPackageName() + "/cache/"));
|
||||
}
|
||||
|
||||
public static File a(Context context, String str) {
|
||||
return new File(c(context), str);
|
||||
}
|
||||
|
||||
public static boolean a(String str) {
|
||||
return new File(c(str) + File.separator + str + ".xml").exists();
|
||||
}
|
||||
|
||||
public static int b(String str) {
|
||||
File[] listFiles = new File(c(str) + File.separator + str + Utils.BLOCKLY_ADD_PATH).listFiles();
|
||||
return (listFiles == null || listFiles.length <= 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
public static String b() {
|
||||
return c(JimuApplication.l()) + File.separator + "files" + File.separator + "users" + File.separator + Cache.getInstance().getUserId();
|
||||
}
|
||||
}
|
23
sources/com/ubt/jimu/utils/FileTools.java
Normal file
23
sources/com/ubt/jimu/utils/FileTools.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class FileTools {
|
||||
public static boolean a(String str) {
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
}
|
||||
file.delete();
|
||||
File file2 = new File(file.getParent());
|
||||
if (!file2.exists() || !file2.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
file2.delete();
|
||||
return true;
|
||||
}
|
||||
}
|
116
sources/com/ubt/jimu/utils/GlideCacheUtils.java
Normal file
116
sources/com/ubt/jimu/utils/GlideCacheUtils.java
Normal file
@@ -0,0 +1,116 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
import com.bumptech.glide.Glide;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class GlideCacheUtils {
|
||||
private static GlideCacheUtils a;
|
||||
|
||||
public static GlideCacheUtils a() {
|
||||
if (a == null) {
|
||||
a = new GlideCacheUtils();
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public void b(Context context) {
|
||||
try {
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
Glide.b(context).b();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String c(Context context) {
|
||||
try {
|
||||
return a(a(new File(context.getCacheDir() + "/image_manager_disk_cache")));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void a(final Context context) {
|
||||
try {
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
new Thread(new Runnable(this) { // from class: com.ubt.jimu.utils.GlideCacheUtils.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Glide.b(context).a();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Glide.b(context).a();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private long a(File file) throws Exception {
|
||||
long length;
|
||||
long j = 0;
|
||||
try {
|
||||
for (File file2 : file.listFiles()) {
|
||||
if (file2.isDirectory()) {
|
||||
length = a(file2);
|
||||
} else {
|
||||
length = file2.length();
|
||||
}
|
||||
j += length;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
public void a(String str, boolean z) {
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
File file = new File(str);
|
||||
if (file.isDirectory()) {
|
||||
for (File file2 : file.listFiles()) {
|
||||
a(file2.getAbsolutePath(), true);
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
if (!file.isDirectory()) {
|
||||
file.delete();
|
||||
} else if (file.listFiles().length == 0) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(double d) {
|
||||
double d2 = d / 1024.0d;
|
||||
if (d2 < 1.0d) {
|
||||
return "0.0KB";
|
||||
}
|
||||
double d3 = d2 / 1024.0d;
|
||||
if (d3 < 1.0d) {
|
||||
return new BigDecimal(Double.toString(d2)).setScale(2, 4).toPlainString() + "KB";
|
||||
}
|
||||
double d4 = d3 / 1024.0d;
|
||||
if (d4 < 1.0d) {
|
||||
return new BigDecimal(Double.toString(d3)).setScale(2, 4).toPlainString() + "MB";
|
||||
}
|
||||
double d5 = d4 / 1024.0d;
|
||||
if (d5 < 1.0d) {
|
||||
return new BigDecimal(Double.toString(d4)).setScale(2, 4).toPlainString() + "GB";
|
||||
}
|
||||
return BigDecimal.valueOf(d5).setScale(2, 4).toPlainString() + "TB";
|
||||
}
|
||||
}
|
46
sources/com/ubt/jimu/utils/GlideCircleTransform.java
Normal file
46
sources/com/ubt/jimu/utils/GlideCircleTransform.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Shader;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class GlideCircleTransform extends BitmapTransformation {
|
||||
public GlideCircleTransform(Context context) {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
||||
protected Bitmap a(BitmapPool bitmapPool, Bitmap bitmap, int i, int i2) {
|
||||
return a(bitmapPool, bitmap);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public void a(MessageDigest messageDigest) {
|
||||
}
|
||||
|
||||
private static Bitmap a(BitmapPool bitmapPool, Bitmap bitmap) {
|
||||
if (bitmap == null) {
|
||||
return null;
|
||||
}
|
||||
int min = Math.min(bitmap.getWidth(), bitmap.getHeight());
|
||||
Bitmap createBitmap = Bitmap.createBitmap(bitmap, (bitmap.getWidth() - min) / 2, (bitmap.getHeight() - min) / 2, min, min);
|
||||
Bitmap a = bitmapPool.a(min, min, Bitmap.Config.ARGB_8888);
|
||||
if (a == null) {
|
||||
a = Bitmap.createBitmap(min, min, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
Canvas canvas = new Canvas(a);
|
||||
Paint paint = new Paint();
|
||||
Shader.TileMode tileMode = Shader.TileMode.CLAMP;
|
||||
paint.setShader(new BitmapShader(createBitmap, tileMode, tileMode));
|
||||
paint.setAntiAlias(true);
|
||||
float f = min / 2.0f;
|
||||
canvas.drawCircle(f, f, f, paint);
|
||||
return a;
|
||||
}
|
||||
}
|
28
sources/com/ubt/jimu/utils/GlideImageLoaderUtils.java
Normal file
28
sources/com/ubt/jimu/utils/GlideImageLoaderUtils.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.R;
|
||||
import com.youth.banner.loader.ImageLoader;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class GlideImageLoaderUtils extends ImageLoader {
|
||||
private Context mContext;
|
||||
|
||||
public GlideImageLoaderUtils(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override // com.youth.banner.loader.ImageLoaderInterface
|
||||
public void displayImage(Context context, Object obj, ImageView imageView) {
|
||||
RequestBuilder<Drawable> a = Glide.e(context.getApplicationContext()).a(obj);
|
||||
a.a(new RequestOptions().a(true).a(DiskCacheStrategy.a).b(R.drawable.community_img).a(R.drawable.community_img).b());
|
||||
a.a(0.1f);
|
||||
a.a(imageView);
|
||||
}
|
||||
}
|
54
sources/com/ubt/jimu/utils/GlideRoundTransform.java
Normal file
54
sources/com/ubt/jimu/utils/GlideRoundTransform.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class GlideRoundTransform extends BitmapTransformation {
|
||||
private static float b;
|
||||
|
||||
public GlideRoundTransform(Context context) {
|
||||
this(context, 0.0f);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
||||
public Bitmap a(BitmapPool bitmapPool, Bitmap bitmap, int i, int i2) {
|
||||
return a(bitmapPool, bitmap);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public void a(MessageDigest messageDigest) {
|
||||
}
|
||||
|
||||
public GlideRoundTransform(Context context, float f) {
|
||||
b = Resources.getSystem().getDisplayMetrics().density * f;
|
||||
}
|
||||
|
||||
private static Bitmap a(BitmapPool bitmapPool, Bitmap bitmap) {
|
||||
if (bitmap == null) {
|
||||
return null;
|
||||
}
|
||||
Bitmap a = bitmapPool.a(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
if (a == null) {
|
||||
a = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
Canvas canvas = new Canvas(a);
|
||||
Paint paint = new Paint();
|
||||
Shader.TileMode tileMode = Shader.TileMode.CLAMP;
|
||||
paint.setShader(new BitmapShader(bitmap, tileMode, tileMode));
|
||||
paint.setAntiAlias(true);
|
||||
RectF rectF = new RectF(0.0f, 0.0f, bitmap.getWidth(), bitmap.getHeight());
|
||||
float f = b;
|
||||
canvas.drawRoundRect(rectF, f, f, paint);
|
||||
return a;
|
||||
}
|
||||
}
|
60
sources/com/ubt/jimu/utils/GlideUtils.java
Normal file
60
sources/com/ubt/jimu/utils/GlideUtils.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class GlideUtils {
|
||||
public static String a(Context context) {
|
||||
try {
|
||||
LogUtils.c(context.getExternalCacheDir() + "/image_manager_disk_cache");
|
||||
LogUtils.c("context.getExternalCacheDir():" + context.getExternalCacheDir().getAbsolutePath());
|
||||
return a(a(new File(r2)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
private static long a(File file) throws Exception {
|
||||
long length;
|
||||
long j = 0;
|
||||
try {
|
||||
if (file.exists()) {
|
||||
LogUtils.c(file.getAbsolutePath());
|
||||
}
|
||||
for (File file2 : file.listFiles()) {
|
||||
if (file2.isDirectory()) {
|
||||
length = a(file2);
|
||||
} else {
|
||||
length = file2.length();
|
||||
}
|
||||
j += length;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
private static String a(double d) {
|
||||
double d2 = d / 1024.0d;
|
||||
if (d2 < 1.0d) {
|
||||
return d + "KB";
|
||||
}
|
||||
double d3 = d2 / 1024.0d;
|
||||
if (d3 < 1.0d) {
|
||||
return new BigDecimal(Double.toString(d2)).setScale(2, 4).toPlainString() + "KB";
|
||||
}
|
||||
double d4 = d3 / 1024.0d;
|
||||
if (d4 < 1.0d) {
|
||||
return new BigDecimal(Double.toString(d3)).setScale(2, 4).toPlainString() + "MB";
|
||||
}
|
||||
double d5 = d4 / 1024.0d;
|
||||
if (d5 < 1.0d) {
|
||||
return new BigDecimal(Double.toString(d4)).setScale(2, 4).toPlainString() + "GB";
|
||||
}
|
||||
return BigDecimal.valueOf(d5).setScale(2, 4).toPlainString() + "TB";
|
||||
}
|
||||
}
|
128
sources/com/ubt/jimu/utils/GsonUtil.java
Normal file
128
sources/com/ubt/jimu/utils/GsonUtil.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class GsonUtil {
|
||||
|
||||
public static class NullStringToEmptyAdapterFactory<T> implements TypeAdapterFactory {
|
||||
@Override // com.google.gson.TypeAdapterFactory
|
||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||||
if (typeToken.getRawType() != String.class) {
|
||||
return null;
|
||||
}
|
||||
return new StringNullAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
public static class StringNullAdapter extends TypeAdapter<String> {
|
||||
@Override // com.google.gson.TypeAdapter
|
||||
public String read(JsonReader jsonReader) throws IOException {
|
||||
if (jsonReader.peek() != JsonToken.NULL) {
|
||||
return jsonReader.nextString();
|
||||
}
|
||||
jsonReader.nextNull();
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override // com.google.gson.TypeAdapter
|
||||
public void write(JsonWriter jsonWriter, String str) throws IOException {
|
||||
if (str == null) {
|
||||
jsonWriter.nullValue();
|
||||
} else {
|
||||
jsonWriter.value(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Double.valueOf(1.0d);
|
||||
Double.valueOf(1.1d);
|
||||
Double.valueOf(1.2d);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public static String a(Object obj, Type type, boolean z, Double d, String str, boolean z2) {
|
||||
String str2 = "{}";
|
||||
if (obj == null) {
|
||||
return "{}";
|
||||
}
|
||||
GsonBuilder registerTypeAdapterFactory = new GsonBuilder().registerTypeAdapterFactory(new NullStringToEmptyAdapterFactory());
|
||||
if (z) {
|
||||
registerTypeAdapterFactory.serializeNulls();
|
||||
}
|
||||
if (d != null) {
|
||||
registerTypeAdapterFactory.setVersion(d.doubleValue());
|
||||
}
|
||||
if (a(str)) {
|
||||
str = "yyyy-MM-dd HH:mm:ss";
|
||||
}
|
||||
registerTypeAdapterFactory.setDateFormat(str);
|
||||
if (z2) {
|
||||
registerTypeAdapterFactory.excludeFieldsWithoutExposeAnnotation();
|
||||
}
|
||||
Gson create = registerTypeAdapterFactory.create();
|
||||
try {
|
||||
obj = type != null ? create.toJson(obj, type) : create.toJson(obj);
|
||||
str2 = obj;
|
||||
return str2;
|
||||
} catch (Exception unused) {
|
||||
return ((obj instanceof Collection) || (obj instanceof Iterator) || (obj instanceof Enumeration) || obj.getClass().isArray()) ? "[]" : str2;
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(Object obj) {
|
||||
return a(obj, null, false, null, null, true);
|
||||
}
|
||||
|
||||
public static <T> T a(String str, TypeToken<T> typeToken, String str2) {
|
||||
if (a(str)) {
|
||||
return null;
|
||||
}
|
||||
GsonBuilder registerTypeAdapterFactory = new GsonBuilder().registerTypeAdapterFactory(new NullStringToEmptyAdapterFactory());
|
||||
a(str2);
|
||||
try {
|
||||
return (T) registerTypeAdapterFactory.create().fromJson(str, typeToken.getType());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T a(String str, TypeToken<T> typeToken) {
|
||||
return (T) a(str, typeToken, (String) null);
|
||||
}
|
||||
|
||||
public static <T> T a(String str, Class<T> cls, String str2) {
|
||||
if (a(str)) {
|
||||
return null;
|
||||
}
|
||||
GsonBuilder registerTypeAdapterFactory = new GsonBuilder().registerTypeAdapterFactory(new NullStringToEmptyAdapterFactory());
|
||||
a(str2);
|
||||
try {
|
||||
return (T) registerTypeAdapterFactory.create().fromJson(str, (Class) cls);
|
||||
} catch (Exception unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T a(String str, Class<T> cls) {
|
||||
return (T) a(str, cls, (String) null);
|
||||
}
|
||||
|
||||
public static boolean a(String str) {
|
||||
return str == null || "".equals(str);
|
||||
}
|
||||
}
|
64
sources/com/ubt/jimu/utils/InputMethod.java
Normal file
64
sources/com/ubt/jimu/utils/InputMethod.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class InputMethod {
|
||||
public static void a(Activity activity) {
|
||||
try {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService("input_method");
|
||||
if (inputMethodManager.isActive()) {
|
||||
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 2);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean b(Activity activity, View view) {
|
||||
if (view == null || !(view instanceof EditText)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService("input_method");
|
||||
if (inputMethodManager.isActive()) {
|
||||
return inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 2);
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void c(Activity activity, View view) {
|
||||
try {
|
||||
((InputMethodManager) activity.getSystemService("input_method")).showSoftInput(view, 2);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Activity activity, View view) {
|
||||
try {
|
||||
((InputMethodManager) activity.getSystemService("input_method")).hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean a(View view, MotionEvent motionEvent) {
|
||||
if (view == null || !(view instanceof EditText)) {
|
||||
return false;
|
||||
}
|
||||
int[] iArr = {0, 0};
|
||||
view.getLocationInWindow(iArr);
|
||||
int i = iArr[0];
|
||||
int i2 = iArr[1];
|
||||
return motionEvent.getX() <= ((float) i) || motionEvent.getX() >= ((float) (view.getWidth() + i)) || motionEvent.getY() <= ((float) i2) || motionEvent.getY() >= ((float) (view.getHeight() + i2));
|
||||
}
|
||||
}
|
48
sources/com/ubt/jimu/utils/JsonHelper.java
Normal file
48
sources/com/ubt/jimu/utils/JsonHelper.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.util.Log;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class JsonHelper {
|
||||
private static final Gson a = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
||||
|
||||
public static Object a(String str, Type type) {
|
||||
if (str != null) {
|
||||
try {
|
||||
return a.fromJson(str, type);
|
||||
} catch (Exception e) {
|
||||
Log.e("GSON", e.getMessage() + "");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> T b(String str, Class<T> cls) {
|
||||
if (!android.text.TextUtils.isEmpty(str)) {
|
||||
try {
|
||||
return (T) a.fromJson(str, (Class) cls);
|
||||
} catch (Exception e) {
|
||||
Log.e("GSON", e.getMessage() + "");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object a(String str, Class<?> cls) {
|
||||
if (str != null) {
|
||||
try {
|
||||
return a.fromJson(str, (Class) cls);
|
||||
} catch (Exception e) {
|
||||
Log.e("GSON", e.getMessage() + "");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String a(Object obj) {
|
||||
return a.toJson(obj);
|
||||
}
|
||||
}
|
12
sources/com/ubt/jimu/utils/KeybordUtils.java
Normal file
12
sources/com/ubt/jimu/utils/KeybordUtils.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class KeybordUtils {
|
||||
public static void a(EditText editText, Context context) {
|
||||
((InputMethodManager) context.getSystemService("input_method")).hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
}
|
||||
}
|
205
sources/com/ubt/jimu/utils/LocaleUtils.java
Normal file
205
sources/com/ubt/jimu/utils/LocaleUtils.java
Normal file
@@ -0,0 +1,205 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.LocaleList;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.ubt.jimu.Channel;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.NSLocale;
|
||||
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
||||
import com.ubtech.utils.XLog;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.CharBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class LocaleUtils {
|
||||
public static final Locale[] a = {Locale.US, Locale.SIMPLIFIED_CHINESE, Locale.TRADITIONAL_CHINESE, Locale.FRANCE, new Locale("es"), new Locale("pt"), Locale.GERMANY, Locale.JAPAN, Locale.ITALY, Locale.KOREA, new Locale("ru"), new Locale("pl"), new Locale("tr"), new Locale("da"), LocaleEx.a, LocaleEx.b, LocaleEx.c};
|
||||
private static final HashMap<String, String> b = new HashMap<>(20);
|
||||
|
||||
interface LocaleEx {
|
||||
public static final Locale a = new Locale("in");
|
||||
public static final Locale b = new Locale("th");
|
||||
public static final Locale c = new Locale("yue");
|
||||
}
|
||||
|
||||
static {
|
||||
b.put("en", "English");
|
||||
b.put("zh-hans", "China");
|
||||
b.put("zh-hant", "HokongChinese");
|
||||
b.put("fr", "French");
|
||||
b.put("es", "Spanish");
|
||||
b.put("ar", "Arab");
|
||||
b.put("de", "German");
|
||||
b.put("ja", "Japan");
|
||||
b.put("ko", "Korean");
|
||||
b.put("pt", "Portugal");
|
||||
b.put("it", "Italy");
|
||||
b.put("ru", "Russian");
|
||||
b.put("pl", "Polski");
|
||||
b.put("da", "Danish");
|
||||
b.put("tr", "Turkish");
|
||||
b.put(JockstickDataConverter.ID, "Indonesian");
|
||||
b.put("th", "Thai");
|
||||
}
|
||||
|
||||
public static String a(Context context) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
try {
|
||||
InputStream openRawResource = context.getResources().openRawResource(R.raw.diallingcode);
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(openRawResource);
|
||||
CharBuffer allocate = CharBuffer.allocate(51200);
|
||||
if (inputStreamReader.read(allocate) != 0) {
|
||||
allocate.flip();
|
||||
}
|
||||
List list = (List) new Gson().fromJson(allocate.toString(), new TypeToken<ArrayList<NSLocale>>() { // from class: com.ubt.jimu.utils.LocaleUtils.1
|
||||
}.getType());
|
||||
if (list != null && list.size() != 0) {
|
||||
Locale e = e();
|
||||
String country = e.getCountry();
|
||||
if (!e.getLanguage().equals(Locale.CHINA.getLanguage())) {
|
||||
if (!e.getLanguage().equals(Locale.ENGLISH.getLanguage())) {
|
||||
Iterator it = list.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
NSLocale nSLocale = (NSLocale) it.next();
|
||||
nSLocale.setName(new Locale("", nSLocale.getCode()).getDisplayCountry());
|
||||
if (!android.text.TextUtils.isEmpty(country) && country.equals(nSLocale.getCode())) {
|
||||
stringBuffer.append(nSLocale.getName());
|
||||
stringBuffer.append(nSLocale.getDial_code());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Iterator it2 = list.iterator();
|
||||
while (true) {
|
||||
if (!it2.hasNext()) {
|
||||
break;
|
||||
}
|
||||
NSLocale nSLocale2 = (NSLocale) it2.next();
|
||||
if (!android.text.TextUtils.isEmpty(country) && country.equals(nSLocale2.getCode())) {
|
||||
stringBuffer.append(nSLocale2.getName());
|
||||
stringBuffer.append(nSLocale2.getDial_code());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Iterator it3 = list.iterator();
|
||||
while (true) {
|
||||
if (!it3.hasNext()) {
|
||||
break;
|
||||
}
|
||||
NSLocale nSLocale3 = (NSLocale) it3.next();
|
||||
nSLocale3.setName(nSLocale3.getChineseName());
|
||||
if (!android.text.TextUtils.isEmpty(country) && country.equals(nSLocale3.getCode())) {
|
||||
stringBuffer.append(nSLocale3.getName());
|
||||
stringBuffer.append(nSLocale3.getDial_code());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
String trim = stringBuffer.toString().trim();
|
||||
if (openRawResource != null) {
|
||||
try {
|
||||
openRawResource.close();
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return trim;
|
||||
}
|
||||
stringBuffer.append("中国+86");
|
||||
String trim2 = stringBuffer.toString().trim();
|
||||
if (openRawResource != null) {
|
||||
try {
|
||||
openRawResource.close();
|
||||
} catch (Exception e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
}
|
||||
return trim2;
|
||||
} catch (Exception e4) {
|
||||
e4.printStackTrace();
|
||||
if (0 != 0) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Exception e5) {
|
||||
e5.printStackTrace();
|
||||
}
|
||||
}
|
||||
stringBuffer.append("中国+86");
|
||||
return stringBuffer.toString().trim();
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (0 != 0) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Exception e6) {
|
||||
e6.printStackTrace();
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public static String b() {
|
||||
Locale e = e();
|
||||
Locale[] localeArr = a;
|
||||
int length = localeArr.length;
|
||||
boolean z = false;
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= length) {
|
||||
break;
|
||||
}
|
||||
if (localeArr[i].getLanguage().equals(e.getLanguage())) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return !z ? Locale.US.getLanguage() : Locale.CHINA.getLanguage().equals(e.getLanguage()) ? Locale.CHINA.getCountry().equals(e.getCountry()) ? "zh-hans" : "zh-hant" : LocaleEx.c.getLanguage().equals(e.getLanguage()) ? "zh-hant" : LocaleEx.a.getLanguage().equals(e.getLanguage()) ? JockstickDataConverter.ID : e.getLanguage();
|
||||
}
|
||||
|
||||
public static String c() {
|
||||
return g() ? "zh-hans" : b();
|
||||
}
|
||||
|
||||
public static String d() {
|
||||
Locale e = e();
|
||||
return (e == null || android.text.TextUtils.isEmpty(e.getCountry())) ? Locale.US.getCountry() : e.getCountry();
|
||||
}
|
||||
|
||||
public static Locale e() {
|
||||
return Build.VERSION.SDK_INT >= 24 ? LocaleList.getDefault().get(0) : Locale.getDefault();
|
||||
}
|
||||
|
||||
public static boolean f() {
|
||||
return Locale.getDefault().getCountry().equals(Locale.CHINA.getCountry());
|
||||
}
|
||||
|
||||
public static boolean g() {
|
||||
return !Channel.GOOGLE_PLAY.getChannelName().equals(PackageHelper.a("CHANNEL_ID"));
|
||||
}
|
||||
|
||||
public static String a() {
|
||||
String str = b.get(b());
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
str = "English";
|
||||
}
|
||||
XLog.a("lang-test", "full lang %s", str);
|
||||
return str;
|
||||
}
|
||||
}
|
52
sources/com/ubt/jimu/utils/LogUtils.java
Normal file
52
sources/com/ubt/jimu/utils/LogUtils.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import com.ubtrobot.log.ALog;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class LogUtils {
|
||||
static String a;
|
||||
static int b;
|
||||
|
||||
private static String a(String str) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("(");
|
||||
stringBuffer.append(a);
|
||||
stringBuffer.append(":");
|
||||
stringBuffer.append(b);
|
||||
stringBuffer.append(")");
|
||||
stringBuffer.append(" :");
|
||||
stringBuffer.append(str);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void b(String str) {
|
||||
if (a()) {
|
||||
a(new Throwable().getStackTrace());
|
||||
ALog.a(a).d(a(str));
|
||||
}
|
||||
}
|
||||
|
||||
public static void c(String str) {
|
||||
if (a()) {
|
||||
a(new Throwable().getStackTrace());
|
||||
ALog.a("TestLog").d(a(str));
|
||||
}
|
||||
}
|
||||
|
||||
public static void d(String str) {
|
||||
if (a()) {
|
||||
a(new Throwable().getStackTrace());
|
||||
ALog.a(a).e(a(str), new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(StackTraceElement[] stackTraceElementArr) {
|
||||
a = stackTraceElementArr[1].getFileName();
|
||||
stackTraceElementArr[1].getMethodName();
|
||||
b = stackTraceElementArr[1].getLineNumber();
|
||||
}
|
||||
}
|
47
sources/com/ubt/jimu/utils/Md5Utils.java
Normal file
47
sources/com/ubt/jimu/utils/Md5Utils.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class Md5Utils {
|
||||
public static String a(String str) {
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.update(str.getBytes());
|
||||
return a(messageDigest.digest());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(byte[] bArr) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (byte b : bArr) {
|
||||
String hexString = Integer.toHexString(b & 255);
|
||||
if (hexString.length() == 1) {
|
||||
stringBuffer.append('0');
|
||||
}
|
||||
stringBuffer.append(hexString);
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static String a(String str, int i) {
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.update(str.getBytes());
|
||||
String a = a(messageDigest.digest());
|
||||
return android.text.TextUtils.isEmpty(a) ? "" : a.length() <= i ? a : a.substring(a.length() - i, a.length());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
35
sources/com/ubt/jimu/utils/NetWorkUtil.java
Normal file
35
sources/com/ubt/jimu/utils/NetWorkUtil.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class NetWorkUtil {
|
||||
|
||||
public enum NetworkType {
|
||||
WIFI,
|
||||
MOBILE,
|
||||
OTHER,
|
||||
NONE_NET
|
||||
}
|
||||
|
||||
public static NetworkType a(Context context) {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
|
||||
if (connectivityManager == null) {
|
||||
return NetworkType.NONE_NET;
|
||||
}
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
if (activeNetworkInfo == null) {
|
||||
return NetworkType.NONE_NET;
|
||||
}
|
||||
int type = activeNetworkInfo.getType();
|
||||
return type == -1 ? NetworkType.NONE_NET : type == 0 ? NetworkType.MOBILE : type == 1 ? NetworkType.WIFI : NetworkType.OTHER;
|
||||
}
|
||||
|
||||
public static boolean b(Context context) {
|
||||
ConnectivityManager connectivityManager;
|
||||
NetworkInfo activeNetworkInfo;
|
||||
return (context == null || (connectivityManager = (ConnectivityManager) context.getSystemService("connectivity")) == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null || !activeNetworkInfo.isConnected()) ? false : true;
|
||||
}
|
||||
}
|
55
sources/com/ubt/jimu/utils/PackageHelper.java
Normal file
55
sources/com/ubt/jimu/utils/PackageHelper.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Constants;
|
||||
import com.ubt.jimu.blockly.BuildConfig;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubtech.utils.FileHelper;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PackageHelper {
|
||||
public static String a() {
|
||||
String b = b();
|
||||
return (b == null || b.equals(BuildConfig.VERSION_NAME)) ? b : b.substring(0, b.lastIndexOf("."));
|
||||
}
|
||||
|
||||
public static String b() {
|
||||
PackageInfo packageInfo;
|
||||
try {
|
||||
packageInfo = JimuApplication.l().getPackageManager().getPackageInfo(JimuApplication.l().getPackageName(), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
packageInfo = null;
|
||||
}
|
||||
return packageInfo != null ? packageInfo.versionName : BuildConfig.VERSION_NAME;
|
||||
}
|
||||
|
||||
public static void c() {
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
jSONObject.put(Constants.UNITY_LANGUAGE_FILE, JimuApplication.l().g());
|
||||
FileHelper.a(ExternalOverFroyoUtils.a(JimuApplication.l(), (ModelType) null) + Constants.UNITY_LANGUAGE_FILE, jSONObject.toString(), (String) null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(String str) {
|
||||
ApplicationInfo applicationInfo;
|
||||
try {
|
||||
applicationInfo = JimuApplication.l().getPackageManager().getApplicationInfo(JimuApplication.l().getPackageName(), PeripheralType.SERVO);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
applicationInfo = null;
|
||||
}
|
||||
if (applicationInfo != null) {
|
||||
return applicationInfo.metaData.getString(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
17
sources/com/ubt/jimu/utils/ResoureUtils.java
Normal file
17
sources/com/ubt/jimu/utils/ResoureUtils.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ResoureUtils {
|
||||
public static int a(Context context, String str, String str2) {
|
||||
String packageName = context.getPackageName();
|
||||
try {
|
||||
return context.getPackageManager().getResourcesForApplication(packageName).getIdentifier(str, str2, packageName);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
19
sources/com/ubt/jimu/utils/RxSchedulers.java
Normal file
19
sources/com/ubt/jimu/utils/RxSchedulers.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.ObservableTransformer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class RxSchedulers {
|
||||
public static <T> ObservableTransformer<T, T> a() {
|
||||
return new ObservableTransformer<T, T>() { // from class: com.ubt.jimu.utils.RxSchedulers.1
|
||||
@Override // io.reactivex.ObservableTransformer
|
||||
public ObservableSource<T> apply(Observable<T> observable) {
|
||||
return observable.subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
169
sources/com/ubt/jimu/utils/SPUtils.java
Normal file
169
sources/com/ubt/jimu/utils/SPUtils.java
Normal file
@@ -0,0 +1,169 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.StreamCorruptedException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class SPUtils {
|
||||
private static SharedPreferences a;
|
||||
|
||||
public static int a(String str, int i) {
|
||||
if (a == null) {
|
||||
a = JimuApplication.l().getSharedPreferences("JIMU_APP_CONFIG", 0);
|
||||
}
|
||||
return a.getInt(str, i);
|
||||
}
|
||||
|
||||
public static boolean b(String str, int i) {
|
||||
if (a == null) {
|
||||
a = JimuApplication.l().getSharedPreferences("JIMU_APP_CONFIG", 0);
|
||||
}
|
||||
SharedPreferences.Editor edit = a.edit();
|
||||
edit.putInt(str, i);
|
||||
return edit.commit();
|
||||
}
|
||||
|
||||
public static Object c(String str) {
|
||||
return a(JimuApplication.l(), "JIMU_APP_CONFIG", str);
|
||||
}
|
||||
|
||||
public static boolean a(String str, String str2) {
|
||||
if (a == null) {
|
||||
a = JimuApplication.l().getSharedPreferences("JIMU_APP_CONFIG", 0);
|
||||
}
|
||||
SharedPreferences.Editor edit = a.edit();
|
||||
edit.putString(str, str2);
|
||||
return edit.commit();
|
||||
}
|
||||
|
||||
public static String b(String str) {
|
||||
if (a == null) {
|
||||
a = JimuApplication.l().getSharedPreferences("JIMU_APP_CONFIG", 0);
|
||||
}
|
||||
return a.getString(str, "");
|
||||
}
|
||||
|
||||
public static boolean a(String str, boolean z) {
|
||||
if (a == null) {
|
||||
a = JimuApplication.l().getSharedPreferences("JIMU_APP_CONFIG", 0);
|
||||
}
|
||||
SharedPreferences.Editor edit = a.edit();
|
||||
edit.putBoolean(str, z);
|
||||
return edit.commit();
|
||||
}
|
||||
|
||||
public static Object b(String str, String str2) {
|
||||
return a(JimuApplication.l(), str, str2);
|
||||
}
|
||||
|
||||
public static boolean a(String str) {
|
||||
if (a == null) {
|
||||
a = JimuApplication.l().getSharedPreferences("JIMU_APP_CONFIG", 0);
|
||||
}
|
||||
return a.getBoolean(str, false);
|
||||
}
|
||||
|
||||
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:47:0x004c -> B:11:0x004f). Please report as a decompilation issue!!! */
|
||||
public static void a(Context context, String str, String str2, Object obj) {
|
||||
ObjectOutputStream objectOutputStream;
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences(str, 0);
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream objectOutputStream2 = null;
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
|
||||
try {
|
||||
objectOutputStream.writeObject(obj);
|
||||
String encodeToString = android.util.Base64.encodeToString(byteArrayOutputStream.toByteArray(), 0);
|
||||
SharedPreferences.Editor edit = sharedPreferences.edit();
|
||||
edit.putString(str2, encodeToString);
|
||||
edit.commit();
|
||||
try {
|
||||
byteArrayOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
objectOutputStream.close();
|
||||
} catch (IOException e2) {
|
||||
e = e2;
|
||||
objectOutputStream2 = objectOutputStream;
|
||||
e.printStackTrace();
|
||||
try {
|
||||
byteArrayOutputStream.close();
|
||||
} catch (IOException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
if (objectOutputStream2 != null) {
|
||||
objectOutputStream2.close();
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
try {
|
||||
byteArrayOutputStream.close();
|
||||
} catch (IOException e4) {
|
||||
e4.printStackTrace();
|
||||
}
|
||||
if (objectOutputStream != null) {
|
||||
try {
|
||||
objectOutputStream.close();
|
||||
throw th;
|
||||
} catch (IOException e5) {
|
||||
e5.printStackTrace();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
objectOutputStream = objectOutputStream2;
|
||||
}
|
||||
} catch (IOException e6) {
|
||||
e = e6;
|
||||
}
|
||||
} catch (IOException e7) {
|
||||
e7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(String str, Object obj) {
|
||||
a(JimuApplication.l(), "JIMU_APP_CONFIG", str, obj);
|
||||
}
|
||||
|
||||
public static void a(String str, String str2, Object obj) {
|
||||
a(JimuApplication.l(), str, str2, obj);
|
||||
}
|
||||
|
||||
public static Object a(Context context, String str, String str2) {
|
||||
String string = context.getSharedPreferences(str, 0).getString(str2, "");
|
||||
if (android.text.TextUtils.isEmpty(string)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
try {
|
||||
return new ObjectInputStream(new ByteArrayInputStream(android.util.Base64.decode(string.getBytes(), 0))).readObject();
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} catch (StreamCorruptedException e2) {
|
||||
e2.printStackTrace();
|
||||
return null;
|
||||
} catch (IOException e3) {
|
||||
e3.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object a(Context context, String str) {
|
||||
return a(context, "JIMU_USER_CONFIG", str);
|
||||
}
|
||||
}
|
33
sources/com/ubt/jimu/utils/ScreenUtil.java
Normal file
33
sources/com/ubt/jimu/utils/ScreenUtil.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ScreenUtil {
|
||||
public static int a(Context context) {
|
||||
Display defaultDisplay = ((Activity) context).getWindowManager().getDefaultDisplay();
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
try {
|
||||
Class.forName("android.view.Display").getMethod("getRealMetrics", DisplayMetrics.class).invoke(defaultDisplay, displayMetrics);
|
||||
return displayMetrics.heightPixels;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static int b(Context context) {
|
||||
Display defaultDisplay = ((Activity) context).getWindowManager().getDefaultDisplay();
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
try {
|
||||
Class.forName("android.view.Display").getMethod("getRealMetrics", DisplayMetrics.class).invoke(defaultDisplay, displayMetrics);
|
||||
return displayMetrics.widthPixels;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
54
sources/com/ubt/jimu/utils/ShortcutHelper.java
Normal file
54
sources/com/ubt/jimu/utils/ShortcutHelper.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.pm.ShortcutManager;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.Build;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.community.view.PublishCommunityActivity;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ShortcutHelper {
|
||||
public static final List<String> a = Collections.singletonList("post");
|
||||
|
||||
@TargetApi(25)
|
||||
public static void a(Context context) {
|
||||
if (Build.VERSION.SDK_INT < 25) {
|
||||
return;
|
||||
}
|
||||
((ShortcutManager) context.getSystemService(ShortcutManager.class)).disableShortcuts(a);
|
||||
}
|
||||
|
||||
@TargetApi(25)
|
||||
public static void b(Context context) {
|
||||
if (Build.VERSION.SDK_INT < 25) {
|
||||
return;
|
||||
}
|
||||
ShortcutManager shortcutManager = (ShortcutManager) context.getSystemService(ShortcutManager.class);
|
||||
Intent intent = new Intent(context, (Class<?>) PublishCommunityActivity.class);
|
||||
intent.setAction("android.intent.action.VIEW");
|
||||
intent.setFlags(32768);
|
||||
shortcutManager.addDynamicShortcuts(Collections.singletonList(new ShortcutInfo.Builder(context, "post").setShortLabel(context.getString(R.string.shortcut_post_short_label)).setLongLabel(context.getString(R.string.shortcut_post_long_label)).setDisabledMessage(context.getString(R.string.shortcut_post_disabled)).setIcon(Icon.createWithResource(context, R.drawable.img_publish)).setIntent(intent).build()));
|
||||
}
|
||||
|
||||
@TargetApi(25)
|
||||
public static void c(Context context) {
|
||||
if (Build.VERSION.SDK_INT < 25) {
|
||||
return;
|
||||
}
|
||||
((ShortcutManager) context.getSystemService(ShortcutManager.class)).reportShortcutUsed("post");
|
||||
}
|
||||
|
||||
@TargetApi(25)
|
||||
public static void d(Context context) {
|
||||
if (Build.VERSION.SDK_INT < 25) {
|
||||
return;
|
||||
}
|
||||
((ShortcutManager) context.getSystemService(ShortcutManager.class)).reportShortcutUsed("search");
|
||||
}
|
||||
}
|
65
sources/com/ubt/jimu/utils/SoftKeyBoardListener.java
Normal file
65
sources/com/ubt/jimu/utils/SoftKeyBoardListener.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class SoftKeyBoardListener {
|
||||
private View a;
|
||||
int b;
|
||||
private OnSoftKeyBoardChangeListener c;
|
||||
private ViewTreeObserver.OnGlobalLayoutListener d = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: com.ubt.jimu.utils.SoftKeyBoardListener.1
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
Rect rect = new Rect();
|
||||
SoftKeyBoardListener.this.a.getWindowVisibleDisplayFrame(rect);
|
||||
int height = rect.height();
|
||||
System.out.println("" + height);
|
||||
SoftKeyBoardListener softKeyBoardListener = SoftKeyBoardListener.this;
|
||||
int i = softKeyBoardListener.b;
|
||||
if (i == 0) {
|
||||
softKeyBoardListener.b = height;
|
||||
return;
|
||||
}
|
||||
if (i == height) {
|
||||
return;
|
||||
}
|
||||
if (i - height > 200) {
|
||||
if (softKeyBoardListener.c != null) {
|
||||
SoftKeyBoardListener.this.c.b(SoftKeyBoardListener.this.b - height);
|
||||
}
|
||||
SoftKeyBoardListener.this.b = height;
|
||||
} else if (height - i > 200) {
|
||||
if (softKeyBoardListener.c != null) {
|
||||
SoftKeyBoardListener.this.c.a(height - SoftKeyBoardListener.this.b);
|
||||
}
|
||||
SoftKeyBoardListener.this.b = height;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public interface OnSoftKeyBoardChangeListener {
|
||||
void a(int i);
|
||||
|
||||
void b(int i);
|
||||
}
|
||||
|
||||
public SoftKeyBoardListener(Activity activity) {
|
||||
this.a = activity.getWindow().getDecorView();
|
||||
this.a.getViewTreeObserver().addOnGlobalLayoutListener(this.d);
|
||||
}
|
||||
|
||||
private void a(OnSoftKeyBoardChangeListener onSoftKeyBoardChangeListener) {
|
||||
this.c = onSoftKeyBoardChangeListener;
|
||||
}
|
||||
|
||||
public static void a(SoftKeyBoardListener softKeyBoardListener, OnSoftKeyBoardChangeListener onSoftKeyBoardChangeListener) {
|
||||
softKeyBoardListener.a(onSoftKeyBoardChangeListener);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.a.getViewTreeObserver().removeOnGlobalLayoutListener(this.d);
|
||||
}
|
||||
}
|
106
sources/com/ubt/jimu/utils/SystemUtils.java
Normal file
106
sources/com/ubt/jimu/utils/SystemUtils.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Vibrator;
|
||||
import com.ubt.jimu.Channel;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class SystemUtils {
|
||||
public static boolean a(Context context, String str) {
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return context.getPackageManager().getApplicationInfo(str, UnityActivity.BLOCKLY_TYPE_NONE) != null;
|
||||
}
|
||||
|
||||
public static void b(String str) {
|
||||
try {
|
||||
a(str);
|
||||
new File(str.toString()).delete();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(String str) {
|
||||
File file;
|
||||
File file2 = new File(str);
|
||||
if (!file2.exists() || !file2.isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
String[] list = file2.list();
|
||||
boolean z = false;
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (str.endsWith(File.separator)) {
|
||||
file = new File(str + list[i]);
|
||||
} else {
|
||||
file = new File(str + File.separator + list[i]);
|
||||
}
|
||||
if (file.isFile()) {
|
||||
file.delete();
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
a(str + "/" + list[i]);
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
public static void b(Context context) {
|
||||
((Vibrator) context.getSystemService("vibrator")).vibrate(50L);
|
||||
}
|
||||
|
||||
private static long b() {
|
||||
long j = Cache.getInstance().differ;
|
||||
if (j <= 0) {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
return j + SystemClock.elapsedRealtime();
|
||||
}
|
||||
|
||||
public static long a() {
|
||||
long b = b();
|
||||
LogUtils.c("当前时间:" + b + "服务器校准的时间:" + b());
|
||||
return b;
|
||||
}
|
||||
|
||||
public static long a(long j) {
|
||||
String valueOf;
|
||||
int length;
|
||||
if (!Channel.FIR_TEST.getChannelName().equals("google_play")) {
|
||||
return j;
|
||||
}
|
||||
if (j > 0 && (length = (valueOf = String.valueOf(j)).length()) >= 4) {
|
||||
return Long.valueOf(valueOf.substring(0, length - 3)).longValue() * 1000;
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public static boolean a(Context context) {
|
||||
Intent intent = new Intent("android.intent.action.VIEW");
|
||||
intent.setData(Uri.parse("market://details?id=" + context.getPackageName()));
|
||||
intent.setPackage("com.android.vending");
|
||||
if (intent.resolveActivity(context.getPackageManager()) != null) {
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
Intent intent2 = new Intent("android.intent.action.VIEW");
|
||||
intent2.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName()));
|
||||
if (intent2.resolveActivity(context.getPackageManager()) == null) {
|
||||
return false;
|
||||
}
|
||||
context.startActivity(intent2);
|
||||
return true;
|
||||
}
|
||||
}
|
17
sources/com/ubt/jimu/utils/TSnackbarUtils.java
Normal file
17
sources/com/ubt/jimu/utils/TSnackbarUtils.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.view.View;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.utils.topsnackbar.TSnackbar;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class TSnackbarUtils {
|
||||
private static int a = 1500;
|
||||
private static int b;
|
||||
|
||||
public static void a(View view, CharSequence charSequence) {
|
||||
TSnackbar a2 = TSnackbar.a(view, charSequence, a, b);
|
||||
a2.d(R.color.rehearsal_delete_bg);
|
||||
a2.e();
|
||||
}
|
||||
}
|
202
sources/com/ubt/jimu/utils/TextUtils.java
Normal file
202
sources/com/ubt/jimu/utils/TextUtils.java
Normal file
@@ -0,0 +1,202 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class TextUtils {
|
||||
public static void a(TextView textView, String str, String str2, ClickableSpan clickableSpan) {
|
||||
int indexOf = str.indexOf(str2);
|
||||
if (indexOf < 0) {
|
||||
indexOf = 0;
|
||||
}
|
||||
int length = str2.length() + indexOf;
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
spannableString.setSpan(clickableSpan, indexOf, length, 33);
|
||||
textView.setText(spannableString);
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
private static boolean a(char c) {
|
||||
return (c == 0 || c == '\t' || c == '\n' || c == '\r' || (c >= ' ' && c <= 55295) || ((c >= 57344 && c <= 65533) || (c >= 0 && c <= 65535))) ? false : true;
|
||||
}
|
||||
|
||||
public static boolean b(String str) {
|
||||
return Pattern.compile("^[A-Za-z]+$").matcher(str).matches();
|
||||
}
|
||||
|
||||
public static boolean c(String str) {
|
||||
return Pattern.compile("^[0-9]+$").matcher(str).matches();
|
||||
}
|
||||
|
||||
public static boolean d(String str) {
|
||||
return Pattern.compile("^[A-Za-z0-9]+$").matcher(str).matches();
|
||||
}
|
||||
|
||||
public static String e(String str) {
|
||||
if (str == null || str.length() == 0) {
|
||||
return str;
|
||||
}
|
||||
if (str.toLowerCase().startsWith("https")) {
|
||||
try {
|
||||
return URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return str;
|
||||
}
|
||||
}
|
||||
String replace = str.replace("http", "https");
|
||||
try {
|
||||
return URLEncoder.encode(replace, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e2) {
|
||||
e2.printStackTrace();
|
||||
return replace;
|
||||
}
|
||||
}
|
||||
|
||||
public static int f(String str) {
|
||||
if (StringUtils.e(str) || str.equals("local")) {
|
||||
return 0;
|
||||
}
|
||||
return Integer.parseInt(str);
|
||||
}
|
||||
|
||||
public static SpannableString a(String str, String str2, int i, int i2) {
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
spannableString.setSpan(new ForegroundColorSpan(i2), i, str2.length() + i, 33);
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
public static SpannableString a(String str, int i, int i2, int i3) {
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
spannableString.setSpan(new ForegroundColorSpan(i3), i, i2, 33);
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
public static SpannableString a(int i, int i2, String str) {
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
spannableString.setSpan(new StyleSpan(1), i, i2, 33);
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
public static String a(Context context, long j) {
|
||||
long currentTimeMillis = (System.currentTimeMillis() - j) / 1000;
|
||||
if (currentTimeMillis < 60) {
|
||||
return context.getString(R.string.time_second);
|
||||
}
|
||||
if (currentTimeMillis < 3600) {
|
||||
return String.format(context.getString(R.string.time_minute), (currentTimeMillis / 60) + "");
|
||||
}
|
||||
if (currentTimeMillis < 86400) {
|
||||
return String.format(context.getString(R.string.time_hour), (currentTimeMillis / 3600) + "");
|
||||
}
|
||||
if (currentTimeMillis < 2592000) {
|
||||
return String.format(context.getString(R.string.time_day), (currentTimeMillis / 86400) + "");
|
||||
}
|
||||
if (currentTimeMillis < 31104000) {
|
||||
return String.format(context.getString(R.string.time_month), (currentTimeMillis / 2592000) + "");
|
||||
}
|
||||
return String.format(context.getString(R.string.time_year), (currentTimeMillis / 31104000) + "");
|
||||
}
|
||||
|
||||
public static String a(int i) {
|
||||
return i > 1000 ? String.format("%s k", new DecimalFormat("#.0").format(i / 1000)) : String.valueOf(i);
|
||||
}
|
||||
|
||||
public static boolean a(String str) {
|
||||
try {
|
||||
return Pattern.compile("^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$").matcher(str).matches();
|
||||
} catch (Exception unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean a(String str, int i, EditText editText) {
|
||||
char[] charArray = str.toCharArray();
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
for (char c : charArray) {
|
||||
i2 = StringUtils.a(c) ? i2 + 2 : i2 + 1;
|
||||
i3++;
|
||||
if (i2 > i) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i2 > i) {
|
||||
int i4 = i3 - 1;
|
||||
editText.setText(charArray, 0, i4);
|
||||
editText.setSelection(i4);
|
||||
return true;
|
||||
}
|
||||
LogUtils.d("leng=" + i2);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean a() {
|
||||
return !Cache.getInstance().getUserId().equals("local");
|
||||
}
|
||||
|
||||
public static void a(View view, boolean z) {
|
||||
if (z) {
|
||||
view.setAlpha(1.0f);
|
||||
} else {
|
||||
view.setAlpha(0.3f);
|
||||
}
|
||||
view.setEnabled(z);
|
||||
}
|
||||
|
||||
public static String a(EditText editText, String str) {
|
||||
if (str == null || str.length() < 1) {
|
||||
return "";
|
||||
}
|
||||
char[] charArray = str.toCharArray();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean z = false;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
try {
|
||||
if (a(str.charAt(i))) {
|
||||
charArray[i] = 0;
|
||||
z = true;
|
||||
} else {
|
||||
sb.append(charArray[i]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
editText.setText(sb.toString());
|
||||
editText.setSelection(sb.length());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean a(String str, String str2) {
|
||||
if (android.text.TextUtils.isEmpty(str)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return Pattern.compile(str2).matcher(str).find();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
52
sources/com/ubt/jimu/utils/ThreadManagerUtils.java
Normal file
52
sources/com/ubt/jimu/utils/ThreadManagerUtils.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ThreadManagerUtils {
|
||||
private static final ThreadPoolProxy a = new ThreadPoolProxy(1, 3, 5000);
|
||||
|
||||
public static ThreadPoolProxy a() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public static class ThreadPoolProxy {
|
||||
private final int a;
|
||||
private final int b;
|
||||
private final long c;
|
||||
private ThreadPoolExecutor d;
|
||||
|
||||
public ThreadPoolProxy(int i, int i2, long j) {
|
||||
this.a = i;
|
||||
this.b = i2;
|
||||
this.c = j;
|
||||
}
|
||||
|
||||
private void b() {
|
||||
ThreadPoolExecutor threadPoolExecutor = this.d;
|
||||
if (threadPoolExecutor == null || threadPoolExecutor.isShutdown()) {
|
||||
this.d = new ThreadPoolExecutor(this.a, this.b, this.c, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.DiscardPolicy());
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Runnable runnable) {
|
||||
b();
|
||||
this.d.execute(runnable);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
ThreadPoolExecutor threadPoolExecutor = this.d;
|
||||
if (threadPoolExecutor == null || threadPoolExecutor.isShutdown()) {
|
||||
return;
|
||||
}
|
||||
Iterator it = this.d.getQueue().iterator();
|
||||
while (it.hasNext()) {
|
||||
this.d.remove((Runnable) it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
sources/com/ubt/jimu/utils/UiUtils.java
Normal file
44
sources/com/ubt/jimu/utils/UiUtils.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.TypedArray;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class UiUtils {
|
||||
public static boolean a(Activity activity) {
|
||||
try {
|
||||
Field declaredField = Activity.class.getDeclaredField("mActivityInfo");
|
||||
declaredField.setAccessible(true);
|
||||
((ActivityInfo) declaredField.get(activity)).screenOrientation = -1;
|
||||
declaredField.setAccessible(false);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean b(Activity activity) {
|
||||
boolean z;
|
||||
try {
|
||||
TypedArray obtainStyledAttributes = activity.obtainStyledAttributes((int[]) Class.forName("com.android.internal.R$styleable").getField("Window").get(null));
|
||||
Method method = ActivityInfo.class.getMethod("isTranslucentOrFloating", TypedArray.class);
|
||||
method.setAccessible(true);
|
||||
z = ((Boolean) method.invoke(null, obtainStyledAttributes)).booleanValue();
|
||||
try {
|
||||
method.setAccessible(false);
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
e.printStackTrace();
|
||||
return z;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
z = false;
|
||||
}
|
||||
return z;
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.ubt.jimu.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class WrapContentLinearLayoutManager extends LinearLayoutManager {
|
||||
public WrapContentLinearLayoutManager(Context context, int i, boolean z) {
|
||||
super(context, i, z);
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
public void e(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
try {
|
||||
super.e(recycler, state);
|
||||
} catch (Exception e) {
|
||||
LogUtils.c("不知名异常" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public WrapContentLinearLayoutManager(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
}
|
||||
}
|
36
sources/com/ubt/jimu/utils/fileUpdataTool/VideoUtils.java
Normal file
36
sources/com/ubt/jimu/utils/fileUpdataTool/VideoUtils.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.utils.fileUpdataTool;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class VideoUtils {
|
||||
private static VideoUtils a;
|
||||
|
||||
public static VideoUtils a() {
|
||||
if (a == null) {
|
||||
a = new VideoUtils();
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public Observable<Bitmap> b(final String str) {
|
||||
return Observable.create(new ObservableOnSubscribe<Bitmap>() { // from class: com.ubt.jimu.utils.fileUpdataTool.VideoUtils.1
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public void subscribe(ObservableEmitter<Bitmap> observableEmitter) throws Exception {
|
||||
observableEmitter.onNext(VideoUtils.this.a(str));
|
||||
}
|
||||
}).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a());
|
||||
}
|
||||
|
||||
public Bitmap a(String str) {
|
||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||
mediaMetadataRetriever.setDataSource(str);
|
||||
return mediaMetadataRetriever.getFrameAtTime();
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.ubt.jimu.utils.smartScaleTool;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public enum MeasureTools$Orientation {
|
||||
VERTICAL_RATIO,
|
||||
HORIZONTAL_RATIO
|
||||
}
|
15
sources/com/ubt/jimu/utils/smartScaleTool/ScreenUtils.java
Normal file
15
sources/com/ubt/jimu/utils/smartScaleTool/ScreenUtils.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.ubt.jimu.utils.smartScaleTool;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ScreenUtils {
|
||||
public static int[] a(float f, RecyclerView recyclerView, float f2, int i) {
|
||||
float f3 = i;
|
||||
int measuredWidth = (int) ((recyclerView.getMeasuredWidth() - (f2 * f3)) / f3);
|
||||
int i2 = (int) (measuredWidth * f);
|
||||
LogUtils.c("width==" + measuredWidth + "height==" + i2);
|
||||
return new int[]{measuredWidth, i2};
|
||||
}
|
||||
}
|
21
sources/com/ubt/jimu/utils/topsnackbar/AnimationUtils.java
Normal file
21
sources/com/ubt/jimu/utils/topsnackbar/AnimationUtils.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.ubt.jimu.utils.topsnackbar;
|
||||
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import androidx.interpolator.view.animation.FastOutLinearInInterpolator;
|
||||
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
||||
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AnimationUtils {
|
||||
static final Interpolator a;
|
||||
|
||||
static {
|
||||
new LinearInterpolator();
|
||||
a = new FastOutSlowInInterpolator();
|
||||
new FastOutLinearInInterpolator();
|
||||
new LinearOutSlowInInterpolator();
|
||||
new DecelerateInterpolator();
|
||||
}
|
||||
}
|
195
sources/com/ubt/jimu/utils/topsnackbar/SnackbarManager.java
Normal file
195
sources/com/ubt/jimu/utils/topsnackbar/SnackbarManager.java
Normal file
@@ -0,0 +1,195 @@
|
||||
package com.ubt.jimu.utils.topsnackbar;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class SnackbarManager {
|
||||
private static SnackbarManager d;
|
||||
private static StaticHandler e;
|
||||
private final Object a = new Object();
|
||||
private SnackbarRecord b;
|
||||
private SnackbarRecord c;
|
||||
|
||||
interface Callback {
|
||||
void a();
|
||||
|
||||
void a(int i);
|
||||
}
|
||||
|
||||
private static class SnackbarRecord {
|
||||
final WeakReference<Callback> a;
|
||||
int b;
|
||||
|
||||
SnackbarRecord(int i, Callback callback) {
|
||||
this.a = new WeakReference<>(callback);
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
boolean a(Callback callback) {
|
||||
return callback != null && this.a.get() == callback;
|
||||
}
|
||||
}
|
||||
|
||||
public static class StaticHandler extends Handler {
|
||||
private final WeakReference<SnackbarManager> a;
|
||||
|
||||
public StaticHandler(SnackbarManager snackbarManager) {
|
||||
this.a = new WeakReference<>(snackbarManager);
|
||||
}
|
||||
|
||||
public WeakReference<SnackbarManager> a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
super.handleMessage(message);
|
||||
if (message.what != 0) {
|
||||
return;
|
||||
}
|
||||
a().get().a((SnackbarRecord) message.obj);
|
||||
}
|
||||
}
|
||||
|
||||
private SnackbarManager() {
|
||||
e = new StaticHandler(a());
|
||||
}
|
||||
|
||||
static SnackbarManager a() {
|
||||
if (d == null) {
|
||||
d = new SnackbarManager();
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
private boolean f(Callback callback) {
|
||||
SnackbarRecord snackbarRecord = this.b;
|
||||
return snackbarRecord != null && snackbarRecord.a(callback);
|
||||
}
|
||||
|
||||
private boolean g(Callback callback) {
|
||||
SnackbarRecord snackbarRecord = this.c;
|
||||
return snackbarRecord != null && snackbarRecord.a(callback);
|
||||
}
|
||||
|
||||
public boolean b(Callback callback) {
|
||||
boolean z;
|
||||
synchronized (this.a) {
|
||||
z = f(callback) || g(callback);
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
public void c(Callback callback) {
|
||||
synchronized (this.a) {
|
||||
if (f(callback)) {
|
||||
this.b = null;
|
||||
if (this.c != null) {
|
||||
b();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void d(Callback callback) {
|
||||
synchronized (this.a) {
|
||||
if (f(callback)) {
|
||||
b(this.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void e(Callback callback) {
|
||||
synchronized (this.a) {
|
||||
if (f(callback)) {
|
||||
b(this.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b() {
|
||||
SnackbarRecord snackbarRecord = this.c;
|
||||
if (snackbarRecord != null) {
|
||||
this.b = snackbarRecord;
|
||||
this.c = null;
|
||||
Callback callback = this.b.a.get();
|
||||
if (callback != null) {
|
||||
callback.a();
|
||||
} else {
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, Callback callback) {
|
||||
synchronized (this.a) {
|
||||
if (f(callback)) {
|
||||
this.b.b = i;
|
||||
e.removeCallbacksAndMessages(this.b);
|
||||
b(this.b);
|
||||
return;
|
||||
}
|
||||
if (g(callback)) {
|
||||
this.c.b = i;
|
||||
} else {
|
||||
this.c = new SnackbarRecord(i, callback);
|
||||
}
|
||||
if (this.b == null || !a(this.b, 4)) {
|
||||
this.b = null;
|
||||
b();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b(SnackbarRecord snackbarRecord) {
|
||||
int i = snackbarRecord.b;
|
||||
if (i == -2) {
|
||||
return;
|
||||
}
|
||||
if (i <= 0) {
|
||||
i = i == -1 ? ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED : 2750;
|
||||
}
|
||||
e.removeCallbacksAndMessages(snackbarRecord);
|
||||
StaticHandler staticHandler = e;
|
||||
staticHandler.sendMessageDelayed(Message.obtain(staticHandler, 0, snackbarRecord), i);
|
||||
}
|
||||
|
||||
public void a(Callback callback, int i) {
|
||||
synchronized (this.a) {
|
||||
if (f(callback)) {
|
||||
a(this.b, i);
|
||||
} else if (g(callback)) {
|
||||
a(this.c, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Callback callback) {
|
||||
synchronized (this.a) {
|
||||
if (f(callback)) {
|
||||
e.removeCallbacksAndMessages(this.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(SnackbarRecord snackbarRecord, int i) {
|
||||
Callback callback = snackbarRecord.a.get();
|
||||
if (callback == null) {
|
||||
return false;
|
||||
}
|
||||
e.removeCallbacksAndMessages(snackbarRecord);
|
||||
callback.a(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
void a(SnackbarRecord snackbarRecord) {
|
||||
synchronized (this.a) {
|
||||
if (this.b == snackbarRecord || this.c == snackbarRecord) {
|
||||
a(snackbarRecord, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
687
sources/com/ubt/jimu/utils/topsnackbar/TSnackbar.java
Normal file
687
sources/com/ubt/jimu/utils/topsnackbar/TSnackbar.java
Normal file
@@ -0,0 +1,687 @@
|
||||
package com.ubt.jimu.utils.topsnackbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.OnApplyWindowInsetsListener;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import com.google.android.material.behavior.SwipeDismissBehavior;
|
||||
import com.google.android.material.snackbar.Snackbar$SnackbarLayout;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.R$styleable;
|
||||
import com.ubt.jimu.utils.topsnackbar.SnackbarManager;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class TSnackbar {
|
||||
static final Handler i = new Handler(Looper.getMainLooper(), new Handler.Callback() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.1
|
||||
@Override // android.os.Handler.Callback
|
||||
public boolean handleMessage(Message message) {
|
||||
int i2 = message.what;
|
||||
if (i2 == 0) {
|
||||
((TSnackbar) message.obj).f();
|
||||
return true;
|
||||
}
|
||||
if (i2 != 1) {
|
||||
return false;
|
||||
}
|
||||
((TSnackbar) message.obj).b(message.arg1);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
private final ViewGroup a;
|
||||
private final Context b;
|
||||
final SnackbarLayout c;
|
||||
private int d;
|
||||
private Callback e;
|
||||
private final AccessibilityManager g;
|
||||
private int f = 0;
|
||||
final SnackbarManager.Callback h = new SnackbarManager.Callback() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.3
|
||||
@Override // com.ubt.jimu.utils.topsnackbar.SnackbarManager.Callback
|
||||
public void a() {
|
||||
Handler handler = TSnackbar.i;
|
||||
handler.sendMessage(handler.obtainMessage(0, TSnackbar.this));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.utils.topsnackbar.SnackbarManager.Callback
|
||||
public void a(int i2) {
|
||||
Handler handler = TSnackbar.i;
|
||||
handler.sendMessage(handler.obtainMessage(1, i2, 0, TSnackbar.this));
|
||||
}
|
||||
};
|
||||
|
||||
final class Behavior extends SwipeDismissBehavior<Snackbar$SnackbarLayout> {
|
||||
Behavior() {
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.behavior.SwipeDismissBehavior
|
||||
public boolean a(View view) {
|
||||
return view instanceof Snackbar$SnackbarLayout;
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.behavior.SwipeDismissBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public boolean a(CoordinatorLayout coordinatorLayout, Snackbar$SnackbarLayout snackbar$SnackbarLayout, MotionEvent motionEvent) {
|
||||
if (coordinatorLayout.a(snackbar$SnackbarLayout, (int) motionEvent.getX(), (int) motionEvent.getY())) {
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 0) {
|
||||
SnackbarManager.a().a(TSnackbar.this.h);
|
||||
} else if (actionMasked == 1 || actionMasked == 3) {
|
||||
SnackbarManager.a().e(TSnackbar.this.h);
|
||||
}
|
||||
}
|
||||
return super.a(coordinatorLayout, (CoordinatorLayout) snackbar$SnackbarLayout, motionEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class Callback {
|
||||
public abstract void a(TSnackbar tSnackbar);
|
||||
|
||||
public abstract void a(TSnackbar tSnackbar, int i);
|
||||
}
|
||||
|
||||
public static class SnackbarLayout extends LinearLayout {
|
||||
private TextView a;
|
||||
private Button b;
|
||||
private int c;
|
||||
private int d;
|
||||
private OnLayoutChangeListener e;
|
||||
private OnAttachStateChangeListener f;
|
||||
|
||||
interface OnAttachStateChangeListener {
|
||||
void onViewAttachedToWindow(View view);
|
||||
|
||||
void onViewDetachedFromWindow(View view);
|
||||
}
|
||||
|
||||
interface OnLayoutChangeListener {
|
||||
void a(View view, int i, int i2, int i3, int i4);
|
||||
}
|
||||
|
||||
public SnackbarLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
void a(int i, int i2) {
|
||||
ViewCompat.a((View) this.a, 0.0f);
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this.a);
|
||||
a.a(1.0f);
|
||||
long j = i2;
|
||||
a.a(j);
|
||||
long j2 = i;
|
||||
a.b(j2);
|
||||
a.c();
|
||||
if (this.b.getVisibility() == 0) {
|
||||
ViewCompat.a((View) this.b, 0.0f);
|
||||
ViewPropertyAnimatorCompat a2 = ViewCompat.a(this.b);
|
||||
a2.a(1.0f);
|
||||
a2.a(j);
|
||||
a2.b(j2);
|
||||
a2.c();
|
||||
}
|
||||
}
|
||||
|
||||
void b(int i, int i2) {
|
||||
ViewCompat.a((View) this.a, 1.0f);
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this.a);
|
||||
a.a(0.0f);
|
||||
long j = i2;
|
||||
a.a(j);
|
||||
long j2 = i;
|
||||
a.b(j2);
|
||||
a.c();
|
||||
if (this.b.getVisibility() == 0) {
|
||||
ViewCompat.a((View) this.b, 1.0f);
|
||||
ViewPropertyAnimatorCompat a2 = ViewCompat.a(this.b);
|
||||
a2.a(0.0f);
|
||||
a2.a(j);
|
||||
a2.b(j2);
|
||||
a2.c();
|
||||
}
|
||||
}
|
||||
|
||||
Button getActionView() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
TextView getMessageView() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
OnAttachStateChangeListener onAttachStateChangeListener = this.f;
|
||||
if (onAttachStateChangeListener != null) {
|
||||
onAttachStateChangeListener.onViewAttachedToWindow(this);
|
||||
}
|
||||
ViewCompat.B(this);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
OnAttachStateChangeListener onAttachStateChangeListener = this.f;
|
||||
if (onAttachStateChangeListener != null) {
|
||||
onAttachStateChangeListener.onViewDetachedFromWindow(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.a = (TextView) findViewById(R.id.snackbar_text);
|
||||
this.b = (Button) findViewById(R.id.snackbar_action);
|
||||
}
|
||||
|
||||
@Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
OnLayoutChangeListener onLayoutChangeListener = this.e;
|
||||
if (onLayoutChangeListener != null) {
|
||||
onLayoutChangeListener.a(this, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:15:0x0055, code lost:
|
||||
|
||||
if (a(1, r0, r0 - r1) != false) goto L26;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:16:0x0063, code lost:
|
||||
|
||||
r4 = false;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:25:0x0060, code lost:
|
||||
|
||||
if (a(0, r0, r0) != false) goto L26;
|
||||
*/
|
||||
@Override // android.widget.LinearLayout, android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
protected void onMeasure(int r8, int r9) {
|
||||
/*
|
||||
r7 = this;
|
||||
super.onMeasure(r8, r9)
|
||||
int r0 = r7.c
|
||||
if (r0 <= 0) goto L18
|
||||
int r0 = r7.getMeasuredWidth()
|
||||
int r1 = r7.c
|
||||
if (r0 <= r1) goto L18
|
||||
r8 = 1073741824(0x40000000, float:2.0)
|
||||
int r8 = android.view.View.MeasureSpec.makeMeasureSpec(r1, r8)
|
||||
super.onMeasure(r8, r9)
|
||||
L18:
|
||||
android.content.res.Resources r0 = r7.getResources()
|
||||
r1 = 2131165631(0x7f0701bf, float:1.7945485E38)
|
||||
int r0 = r0.getDimensionPixelSize(r1)
|
||||
android.content.res.Resources r1 = r7.getResources()
|
||||
r2 = 2131165630(0x7f0701be, float:1.7945483E38)
|
||||
int r1 = r1.getDimensionPixelSize(r2)
|
||||
android.widget.TextView r2 = r7.a
|
||||
android.text.Layout r2 = r2.getLayout()
|
||||
int r2 = r2.getLineCount()
|
||||
r3 = 0
|
||||
r4 = 1
|
||||
if (r2 <= r4) goto L3e
|
||||
r2 = 1
|
||||
goto L3f
|
||||
L3e:
|
||||
r2 = 0
|
||||
L3f:
|
||||
if (r2 == 0) goto L58
|
||||
int r5 = r7.d
|
||||
if (r5 <= 0) goto L58
|
||||
android.widget.Button r5 = r7.b
|
||||
int r5 = r5.getMeasuredWidth()
|
||||
int r6 = r7.d
|
||||
if (r5 <= r6) goto L58
|
||||
int r1 = r0 - r1
|
||||
boolean r0 = r7.a(r4, r0, r1)
|
||||
if (r0 == 0) goto L63
|
||||
goto L64
|
||||
L58:
|
||||
if (r2 == 0) goto L5b
|
||||
goto L5c
|
||||
L5b:
|
||||
r0 = r1
|
||||
L5c:
|
||||
boolean r0 = r7.a(r3, r0, r0)
|
||||
if (r0 == 0) goto L63
|
||||
goto L64
|
||||
L63:
|
||||
r4 = 0
|
||||
L64:
|
||||
if (r4 == 0) goto L69
|
||||
super.onMeasure(r8, r9)
|
||||
L69:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.onMeasure(int, int):void");
|
||||
}
|
||||
|
||||
void setOnAttachStateChangeListener(OnAttachStateChangeListener onAttachStateChangeListener) {
|
||||
this.f = onAttachStateChangeListener;
|
||||
}
|
||||
|
||||
void setOnLayoutChangeListener(OnLayoutChangeListener onLayoutChangeListener) {
|
||||
this.e = onLayoutChangeListener;
|
||||
}
|
||||
|
||||
public SnackbarLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.SnackbarLayout);
|
||||
this.c = obtainStyledAttributes.getDimensionPixelSize(0, -1);
|
||||
this.d = obtainStyledAttributes.getDimensionPixelSize(2, -1);
|
||||
if (obtainStyledAttributes.hasValue(1)) {
|
||||
ViewCompat.b(this, obtainStyledAttributes.getDimensionPixelSize(1, 0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
setClickable(true);
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_snackbar_include, this);
|
||||
ViewCompat.e((View) this, 1);
|
||||
ViewCompat.f((View) this, 1);
|
||||
ViewCompat.a((View) this, true);
|
||||
ViewCompat.a(this, new OnApplyWindowInsetsListener(this) { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.1
|
||||
@Override // androidx.core.view.OnApplyWindowInsetsListener
|
||||
public WindowInsetsCompat a(View view, WindowInsetsCompat windowInsetsCompat) {
|
||||
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), windowInsetsCompat.b());
|
||||
return windowInsetsCompat;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean a(int i, int i2, int i3) {
|
||||
boolean z;
|
||||
if (i != getOrientation()) {
|
||||
setOrientation(i);
|
||||
z = true;
|
||||
} else {
|
||||
z = false;
|
||||
}
|
||||
if (this.a.getPaddingTop() == i2 && this.a.getPaddingBottom() == i3) {
|
||||
return z;
|
||||
}
|
||||
a(this.a, i2, i3);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void a(View view, int i, int i2) {
|
||||
if (ViewCompat.z(view)) {
|
||||
ViewCompat.a(view, ViewCompat.o(view), i, ViewCompat.n(view), i2);
|
||||
} else {
|
||||
view.setPadding(view.getPaddingLeft(), i, view.getPaddingRight(), i2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TSnackbar(ViewGroup viewGroup, int i2) {
|
||||
this.a = viewGroup;
|
||||
this.b = viewGroup.getContext();
|
||||
LayoutInflater from = LayoutInflater.from(this.b);
|
||||
if (i2 == 0) {
|
||||
this.c = (SnackbarLayout) from.inflate(R.layout.layout_snackbar_top, this.a, false);
|
||||
} else {
|
||||
this.c = (SnackbarLayout) from.inflate(R.layout.layout_snackbar_bottom, this.a, false);
|
||||
}
|
||||
this.g = (AccessibilityManager) this.b.getSystemService("accessibility");
|
||||
}
|
||||
|
||||
private void g(final int i2) {
|
||||
if (Build.VERSION.SDK_INT < 14) {
|
||||
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.design_snackbar_out);
|
||||
loadAnimation.setInterpolator(AnimationUtils.a);
|
||||
loadAnimation.setDuration(250L);
|
||||
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.10
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
TSnackbar.this.c(i2);
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
});
|
||||
this.c.startAnimation(loadAnimation);
|
||||
return;
|
||||
}
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
||||
a.b(this.c.getHeight());
|
||||
a.a(AnimationUtils.a);
|
||||
a.a(250L);
|
||||
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.9
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void b(View view) {
|
||||
TSnackbar.this.c(i2);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void c(View view) {
|
||||
TSnackbar.this.c.b(0, 180);
|
||||
}
|
||||
});
|
||||
a.c();
|
||||
}
|
||||
|
||||
private void h(final int i2) {
|
||||
if (Build.VERSION.SDK_INT < 14) {
|
||||
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.top_out);
|
||||
loadAnimation.setInterpolator(AnimationUtils.a);
|
||||
loadAnimation.setDuration(250L);
|
||||
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.14
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
TSnackbar.this.c(i2);
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
});
|
||||
this.c.startAnimation(loadAnimation);
|
||||
return;
|
||||
}
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
||||
a.b(-this.c.getHeight());
|
||||
a.a(AnimationUtils.a);
|
||||
a.a(250L);
|
||||
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.13
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void b(View view) {
|
||||
TSnackbar.this.c(i2);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void c(View view) {
|
||||
TSnackbar.this.c.b(0, 180);
|
||||
}
|
||||
});
|
||||
a.c();
|
||||
}
|
||||
|
||||
public void d(int i2) {
|
||||
this.c.setBackgroundColor(this.b.getResources().getColor(i2));
|
||||
}
|
||||
|
||||
public TSnackbar e(int i2) {
|
||||
this.d = i2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TSnackbar f(int i2) {
|
||||
this.f = i2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static TSnackbar a(View view, CharSequence charSequence, int i2, int i3) {
|
||||
TSnackbar tSnackbar = new TSnackbar(a(view), i3);
|
||||
tSnackbar.a(charSequence);
|
||||
tSnackbar.e(i2);
|
||||
tSnackbar.f(i3);
|
||||
return tSnackbar;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return SnackbarManager.a().b(this.h);
|
||||
}
|
||||
|
||||
void c() {
|
||||
SnackbarManager.a().d(this.h);
|
||||
Callback callback = this.e;
|
||||
if (callback != null) {
|
||||
callback.a(this);
|
||||
}
|
||||
}
|
||||
|
||||
boolean d() {
|
||||
return !this.g.isEnabled();
|
||||
}
|
||||
|
||||
public void e() {
|
||||
SnackbarManager.a().a(this.d, this.h);
|
||||
}
|
||||
|
||||
final void f() {
|
||||
if (this.c.getParent() == null) {
|
||||
ViewGroup.LayoutParams layoutParams = this.c.getLayoutParams();
|
||||
if (layoutParams instanceof CoordinatorLayout.LayoutParams) {
|
||||
CoordinatorLayout.LayoutParams layoutParams2 = (CoordinatorLayout.LayoutParams) layoutParams;
|
||||
Behavior behavior = new Behavior();
|
||||
behavior.b(0.1f);
|
||||
behavior.a(0.6f);
|
||||
behavior.a(0);
|
||||
behavior.a(new SwipeDismissBehavior.OnDismissListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.4
|
||||
@Override // com.google.android.material.behavior.SwipeDismissBehavior.OnDismissListener
|
||||
public void a(View view) {
|
||||
view.setVisibility(8);
|
||||
TSnackbar.this.a(0);
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.behavior.SwipeDismissBehavior.OnDismissListener
|
||||
public void a(int i2) {
|
||||
if (i2 == 0) {
|
||||
SnackbarManager.a().e(TSnackbar.this.h);
|
||||
} else if (i2 == 1 || i2 == 2) {
|
||||
SnackbarManager.a().a(TSnackbar.this.h);
|
||||
}
|
||||
}
|
||||
});
|
||||
layoutParams2.a(behavior);
|
||||
layoutParams2.g = 80;
|
||||
}
|
||||
this.a.addView(this.c);
|
||||
}
|
||||
this.c.setOnAttachStateChangeListener(new SnackbarLayout.OnAttachStateChangeListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.5
|
||||
@Override // com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.OnAttachStateChangeListener
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.OnAttachStateChangeListener
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
if (TSnackbar.this.b()) {
|
||||
TSnackbar.i.post(new Runnable() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.5.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
TSnackbar.this.c(3);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!ViewCompat.x(this.c)) {
|
||||
this.c.setOnLayoutChangeListener(new SnackbarLayout.OnLayoutChangeListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.6
|
||||
@Override // com.ubt.jimu.utils.topsnackbar.TSnackbar.SnackbarLayout.OnLayoutChangeListener
|
||||
public void a(View view, int i2, int i3, int i4, int i5) {
|
||||
TSnackbar.this.c.setOnLayoutChangeListener(null);
|
||||
if (!TSnackbar.this.d()) {
|
||||
TSnackbar.this.c();
|
||||
} else if (TSnackbar.this.f == 0) {
|
||||
TSnackbar.this.g();
|
||||
} else {
|
||||
TSnackbar.this.a();
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!d()) {
|
||||
c();
|
||||
} else if (this.f == 0) {
|
||||
g();
|
||||
} else {
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
final void b(int i2) {
|
||||
if (d() && this.c.getVisibility() == 0) {
|
||||
if (this.f == 0) {
|
||||
h(i2);
|
||||
return;
|
||||
} else {
|
||||
g(i2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
c(i2);
|
||||
}
|
||||
|
||||
void c(int i2) {
|
||||
SnackbarManager.a().c(this.h);
|
||||
Callback callback = this.e;
|
||||
if (callback != null) {
|
||||
callback.a(this, i2);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 11) {
|
||||
this.c.setVisibility(8);
|
||||
}
|
||||
ViewParent parent = this.c.getParent();
|
||||
if (parent instanceof ViewGroup) {
|
||||
((ViewGroup) parent).removeView(this.c);
|
||||
}
|
||||
}
|
||||
|
||||
private static ViewGroup a(View view) {
|
||||
ViewGroup viewGroup = null;
|
||||
while (!(view instanceof CoordinatorLayout)) {
|
||||
if (view instanceof FrameLayout) {
|
||||
if (view.getId() == 16908290) {
|
||||
return (ViewGroup) view;
|
||||
}
|
||||
viewGroup = (ViewGroup) view;
|
||||
}
|
||||
if (view != null) {
|
||||
Object parent = view.getParent();
|
||||
view = parent instanceof View ? (View) parent : null;
|
||||
}
|
||||
if (view == null) {
|
||||
return viewGroup;
|
||||
}
|
||||
}
|
||||
return (ViewGroup) view;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void g() {
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
ViewCompat.k(this.c, -r0.getHeight());
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
||||
a.b(0.0f);
|
||||
a.a(AnimationUtils.a);
|
||||
a.a(250L);
|
||||
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.11
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void b(View view) {
|
||||
if (TSnackbar.this.e != null) {
|
||||
TSnackbar.this.e.a(TSnackbar.this);
|
||||
}
|
||||
SnackbarManager.a().d(TSnackbar.this.h);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void c(View view) {
|
||||
TSnackbar.this.c.a(70, 180);
|
||||
}
|
||||
});
|
||||
a.c();
|
||||
return;
|
||||
}
|
||||
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.top_in);
|
||||
loadAnimation.setInterpolator(AnimationUtils.a);
|
||||
loadAnimation.setDuration(250L);
|
||||
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.12
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
if (TSnackbar.this.e != null) {
|
||||
TSnackbar.this.e.a(TSnackbar.this);
|
||||
}
|
||||
SnackbarManager.a().d(TSnackbar.this.h);
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
});
|
||||
this.c.startAnimation(loadAnimation);
|
||||
}
|
||||
|
||||
public TSnackbar a(CharSequence charSequence) {
|
||||
this.c.getMessageView().setText(charSequence);
|
||||
return this;
|
||||
}
|
||||
|
||||
void a(int i2) {
|
||||
SnackbarManager.a().a(this.h, i2);
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
ViewCompat.k(this.c, r0.getHeight());
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this.c);
|
||||
a.b(0.0f);
|
||||
a.a(AnimationUtils.a);
|
||||
a.a(250L);
|
||||
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.7
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void b(View view) {
|
||||
TSnackbar.this.c();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void c(View view) {
|
||||
TSnackbar.this.c.a(70, 180);
|
||||
}
|
||||
});
|
||||
a.c();
|
||||
return;
|
||||
}
|
||||
Animation loadAnimation = android.view.animation.AnimationUtils.loadAnimation(this.c.getContext(), R.anim.design_snackbar_in);
|
||||
loadAnimation.setInterpolator(AnimationUtils.a);
|
||||
loadAnimation.setDuration(250L);
|
||||
loadAnimation.setAnimationListener(new Animation.AnimationListener() { // from class: com.ubt.jimu.utils.topsnackbar.TSnackbar.8
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
TSnackbar.this.c();
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
|
||||
@Override // android.view.animation.Animation.AnimationListener
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
});
|
||||
this.c.startAnimation(loadAnimation);
|
||||
}
|
||||
}
|
43
sources/com/ubt/jimu/utils/videoUtil/CompressUtil.java
Normal file
43
sources/com/ubt/jimu/utils/videoUtil/CompressUtil.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.ubt.jimu.utils.videoUtil;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.util.Size;
|
||||
import com.ubt.jimu.blockly.feature.audio.AudioParams;
|
||||
import com.ubt.jimu.utils.Md5Utils;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CompressUtil {
|
||||
public static String a(String str, int i) {
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
return "";
|
||||
}
|
||||
String a = a();
|
||||
File file2 = new File(a);
|
||||
if (!file2.exists()) {
|
||||
file2.mkdir();
|
||||
}
|
||||
return a + File.separator + "jimu_ubt_" + Md5Utils.a(file.getName() + i, 8) + ".mp4";
|
||||
}
|
||||
|
||||
public static Size b(String str) {
|
||||
Size c;
|
||||
if ((str.endsWith(".mp4") || str.endsWith(AudioParams.gpp)) && (c = VideoUtils.c(str)) != null && c.getWidth() * c.getHeight() > 921600) {
|
||||
return new Size(1280, 720);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String a() {
|
||||
return Environment.getExternalStorageDirectory() + "/ubt_jimu_photos";
|
||||
}
|
||||
|
||||
public static int a(String str) {
|
||||
int a = VideoUtils.a(str);
|
||||
if (a > 2097152) {
|
||||
return 2097152;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
64
sources/com/ubt/jimu/utils/videoUtil/VideoUtils.java
Normal file
64
sources/com/ubt/jimu/utils/videoUtil/VideoUtils.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package com.ubt.jimu.utils.videoUtil;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.media.ThumbnailUtils;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Size;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class VideoUtils {
|
||||
public static Bitmap a(String str, int i, int i2, int i3) {
|
||||
Bitmap createVideoThumbnail = ThumbnailUtils.createVideoThumbnail(str, i3);
|
||||
return createVideoThumbnail != null ? ThumbnailUtils.extractThumbnail(createVideoThumbnail, i, i2, 2) : createVideoThumbnail;
|
||||
}
|
||||
|
||||
public static double b(String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return 0.0d;
|
||||
}
|
||||
File file = new File(str);
|
||||
LogUtils.c("filePath:" + file);
|
||||
if (file.exists() && file.isFile()) {
|
||||
return (file.length() / 1024.00001d) / 1024.00001d;
|
||||
}
|
||||
return 0.0d;
|
||||
}
|
||||
|
||||
public static Size c(String str) {
|
||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||
mediaMetadataRetriever.setDataSource(str);
|
||||
String extractMetadata = mediaMetadataRetriever.extractMetadata(19);
|
||||
String extractMetadata2 = mediaMetadataRetriever.extractMetadata(18);
|
||||
String extractMetadata3 = mediaMetadataRetriever.extractMetadata(24);
|
||||
int intValue = Integer.valueOf(extractMetadata).intValue();
|
||||
int intValue2 = Integer.valueOf(extractMetadata2).intValue();
|
||||
Integer.valueOf(extractMetadata3).intValue();
|
||||
Size size = new Size(intValue, intValue2);
|
||||
mediaMetadataRetriever.release();
|
||||
return size;
|
||||
}
|
||||
|
||||
public static boolean d(String str) {
|
||||
if (str.endsWith(".avi")) {
|
||||
return true;
|
||||
}
|
||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||
try {
|
||||
mediaMetadataRetriever.setDataSource(str);
|
||||
return mediaMetadataRetriever.getFrameAtTime().getWidth() > mediaMetadataRetriever.getFrameAtTime().getHeight();
|
||||
} catch (IllegalArgumentException unused) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static int a(String str) {
|
||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||
mediaMetadataRetriever.setDataSource(str);
|
||||
String extractMetadata = mediaMetadataRetriever.extractMetadata(20);
|
||||
mediaMetadataRetriever.release();
|
||||
return Integer.valueOf(extractMetadata).intValue();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user