baiduad测试 v0.0.0版本的 MD5 值为:ef50fc8b78044be49b08cff701993fe5
以下内容为反编译后的 t.java 源代码,内容仅作参考
package com.deepe.c.c;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
public class t {
static final float a = Resources.getSystem().getDisplayMetrics().density;
private static com.deepe.c.i.i<String, k> b = new com.deepe.c.i.i<String, k>(20) {
@Override
public int a(String str, k kVar) {
return 1;
}
@Override
public void a(boolean z, String str, k kVar, k kVar2) {
}
};
public static float a(float f) {
return a * f;
}
public static int a(int i) {
return Math.round(a * i);
}
public static final Bitmap a(byte[] bArr, BitmapFactory.Options options) {
try {
Bitmap decodeByteArray = BitmapFactory.decodeByteArray(bArr, 0, bArr.length, options);
if (decodeByteArray == null) {
return null;
}
decodeByteArray.setDensity(160);
return decodeByteArray;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static final k a(String str) {
String a2;
k g;
if (com.deepe.c.i.d.a((CharSequence) str)) {
return null;
}
try {
a2 = com.deepe.c.i.m.a((Object) str);
g = g(a2);
} catch (Exception e) {
e.printStackTrace();
}
if (g != null) {
return g;
}
int indexOf = str.indexOf(44);
if (indexOf < 0) {
return null;
}
String substring = str.substring(0, indexOf);
byte[] b2 = b(str.substring(indexOf + 1).trim());
if (b2 != null) {
int f = f(substring);
if (f == 4) {
g = k.b(b2);
} else if (f == 8) {
g = k.a(b2);
}
if (g != null) {
a(a2, g);
return g;
}
}
Bitmap c = c(b2);
if (c != null) {
k a3 = k.a(c);
a(a2, a3);
return a3;
}
return null;
}
public static String a(Bitmap bitmap) {
String b2 = b(bitmap);
StringBuilder sb = new StringBuilder("data:image/jpeg;base64,");
if (b2 == null) {
b2 = "";
}
sb.append(b2);
return sb.toString();
}
public static final String a(Bitmap bitmap, Bitmap.CompressFormat compressFormat) {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
if (compressFormat == null) {
compressFormat = Bitmap.CompressFormat.JPEG;
}
bitmap.compress(compressFormat, 100, byteArrayOutputStream);
com.deepe.c.i.g.a((Closeable) byteArrayOutputStream);
return b(byteArrayOutputStream.toByteArray());
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
public static final String a(String str, String str2) {
boolean z = true;
Bitmap a2 = ac.a(str, 1);
if (a2 != null) {
File a3 = f.a(new File(str));
if (a3.exists()) {
return a3.getAbsolutePath();
}
File parentFile = a3.getParentFile();
if (parentFile != null && !parentFile.exists()) {
parentFile.mkdirs();
}
String f = com.deepe.c.j.f.f(str2);
if (com.deepe.c.i.d.a((CharSequence) f) || (!"jpg".equals(f) && !"jpeg".equals(f))) {
z = false;
}
try {
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(a3));
a2.compress(z ? Bitmap.CompressFormat.JPEG : Bitmap.CompressFormat.PNG, 100, bufferedOutputStream);
bufferedOutputStream.flush();
bufferedOutputStream.close();
a2.recycle();
} catch (Exception e) {
e.printStackTrace();
}
return a3.getAbsolutePath();
}
return null;
}
public static String a(byte[] bArr) {
String b2 = b(bArr);
StringBuilder sb = new StringBuilder("data:image/jpeg;base64,");
if (b2 == null) {
b2 = "";
}
sb.append(b2);
return sb.toString();
}
private static void a(String str, k kVar) {
b.b(str, kVar);
}
public static final boolean a(Bitmap bitmap, File file) {
try {
FileOutputStream fileOutputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
fileOutputStream.flush();
com.deepe.c.i.g.a((Closeable) fileOutputStream);
bitmap.recycle();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static final String b(Bitmap bitmap) {
return a(bitmap, Bitmap.CompressFormat.JPEG);
}
public static final String b(byte[] bArr) {
try {
return com.deepe.c.i.b.b(bArr, 2);
} catch (Exception unused) {
return null;
}
}
public static final byte[] b(String str) {
try {
return com.deepe.c.i.b.a(str, 2);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static final int c(Bitmap bitmap) {
return Build.VERSION.SDK_INT >= 19 ? bitmap.getAllocationByteCount() : bitmap.getByteCount();
}
public static final Bitmap c(byte[] bArr) {
return a(bArr, (BitmapFactory.Options) null);
}
public static final boolean c(String str) {
return "gif".equals(e(str));
}
public static final int d(byte[] bArr) {
if (bArr == null) {
return 51;
}
char c = (char) bArr[0];
if (c == '<') {
if (bArr.length > 5) {
String lowerCase = new String(bArr, 0, 5).toLowerCase();
if (lowerCase.startsWith("<?xml") || lowerCase.endsWith("<svg")) {
return 4;
}
}
return 51;
} else if (c != 'G') {
if (c == 'I' || c == 'M') {
return 16;
}
if (c != 'R') {
if (c == 137) {
return 2;
}
if (c == 255) {
return 1;
}
} else if (bArr.length < 12) {
return 51;
} else {
String str = new String(bArr, 0, 12);
if (str.startsWith("RIFF") && str.endsWith("WEBP")) {
return 32;
}
}
return 51;
} else {
return 8;
}
}
public static final boolean d(String str) {
return "svg".equals(e(str));
}
public static final String e(String str) {
return com.deepe.c.i.j.c(str);
}
private static int f(String str) {
String str2;
if (com.deepe.c.i.d.a((CharSequence) str)) {
return 51;
}
String[] split = str.split(";");
if (split.length < 2) {
return 51;
}
String[] split2 = split[0].split(":");
if (split2.length >= 2 && (str2 = split2[1]) != null) {
if (str2.contains("gif")) {
return 8;
}
return str2.contains("svg") ? 4 : 51;
}
return 51;
}
private static k g(String str) {
return b.a((com.deepe.c.i.i<String, k>) str);
}
}