换机精灵 v2.5.2版本的 MD5 值为:469dcb6202646d6ec40973ea20c8c14b
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.cx.launcher.cloud.f;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import com.cx.huanji.MyApplication;
import com.cx.huanji.R;
import com.cx.huanji.h.be;
import com.umeng.socialize.common.SocializeConstants;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class a {
private static final float f3179a = Resources.getSystem().getDisplayMetrics().density;
private static final Canvas f3180b = new Canvas();
public static int a(int i) {
return Math.round(i * f3179a);
}
public static Bitmap a(int i, int i2, Bitmap.Config config, int i3) {
try {
return Bitmap.createBitmap(i, i2, config);
} catch (OutOfMemoryError e) {
e.printStackTrace();
if (i3 <= 0) {
return null;
}
System.gc();
return a(i, i2, config, i3 - 1);
}
}
public static Bitmap a(View view) {
Drawable drawable;
if ((view instanceof ImageView) && (drawable = ((ImageView) view).getDrawable()) != null && (drawable instanceof BitmapDrawable)) {
return ((BitmapDrawable) drawable).getBitmap();
}
view.clearFocus();
Bitmap a2 = a(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888, 1);
if (a2 == null) {
return a2;
}
synchronized (f3180b) {
Canvas canvas = f3180b;
canvas.setBitmap(a2);
view.draw(canvas);
canvas.setBitmap(null);
}
return a2;
}
public static String a(long j) {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(j));
}
public static String a(Context context) {
return com.cx.base.d.a.a(context) + "/huanji/" + File.separator + "cloudBackup";
}
public static String a(com.cx.launcher.cloud.b.a.a aVar) {
return aVar.f3034c;
}
public static String a(com.cx.launcher.cloud.c.d dVar) {
return "http://yun.goyihu.com/cloud/api/V1.0/backup/calls/" + dVar.w();
}
public static String a(com.cx.launcher.cloud.c.g gVar) {
return gVar.f1083c;
}
public static String a(File file) {
InputStreamReader inputStreamReader;
FileInputStream fileInputStream;
Throwable th;
InputStreamReader inputStreamReader2;
String str = null;
if (file.exists()) {
StringBuffer stringBuffer = new StringBuffer();
try {
try {
fileInputStream = new FileInputStream(file);
} catch (Throwable th2) {
th = th2;
}
try {
inputStreamReader2 = new InputStreamReader(fileInputStream, "UTF-8");
try {
BufferedReader bufferedReader = new BufferedReader(inputStreamReader2);
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
stringBuffer.append(readLine);
}
str = stringBuffer.toString();
if (inputStreamReader2 != null) {
try {
inputStreamReader2.close();
} catch (IOException e) {
com.cx.tools.e.a.a("CloudUtils", "", e);
}
}
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e2) {
com.cx.tools.e.a.a("CloudUtils", "", e2);
}
}
} catch (IOException e3) {
e = e3;
com.cx.tools.e.a.a("CloudUtils", "", e);
if (inputStreamReader2 != null) {
try {
inputStreamReader2.close();
} catch (IOException e4) {
com.cx.tools.e.a.a("CloudUtils", "", e4);
}
}
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e5) {
com.cx.tools.e.a.a("CloudUtils", "", e5);
}
}
return str;
}
} catch (IOException e6) {
e = e6;
inputStreamReader2 = null;
} catch (Throwable th3) {
inputStreamReader = null;
th = th3;
if (inputStreamReader != null) {
try {
inputStreamReader.close();
} catch (IOException e7) {
com.cx.tools.e.a.a("CloudUtils", "", e7);
}
}
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e8) {
com.cx.tools.e.a.a("CloudUtils", "", e8);
}
}
throw th;
}
} catch (IOException e9) {
e = e9;
inputStreamReader2 = null;
fileInputStream = null;
} catch (Throwable th4) {
inputStreamReader = null;
fileInputStream = null;
th = th4;
}
}
return str;
}
public static String a(String str) {
try {
return com.cx.tools.i.a.c(MyApplication.f.toString(), str);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
public static List a(List list) {
if (list == null) {
return null;
}
HashMap hashMap = new HashMap();
ArrayList arrayList = new ArrayList();
arrayList.addAll(list);
int size = arrayList.size();
for (int i = 0; i < size; i++) {
com.cx.launcher.cloud.c.d dVar = (com.cx.launcher.cloud.c.d) arrayList.get(i);
a(hashMap, dVar);
List y = dVar.y();
if (y != null && y.size() > 0) {
int size2 = y.size();
for (int i2 = 0; i2 < size2; i2++) {
a(hashMap, (com.cx.launcher.cloud.c.d) y.get(i2));
}
}
}
a(hashMap);
return arrayList;
}
public static void a(Context context, int i) {
String string = context.getResources().getString(R.string.cloud_request_error);
if (i == 111) {
string = context.getResources().getString(R.string.cloud_resource_not_found);
} else if (i == 99) {
string = context.getResources().getString(R.string.launcher_failure_request_timeout);
} else if (i == 98 || i == 97) {
string = context.getResources().getString(R.string.launcher_failure_net_exception);
} else if (i == 204) {
string = context.getResources().getString(R.string.cloud_backup_content_null);
}
Toast.makeText(context, string, 0).show();
}
public static void a(Context context, String str, int i) {
SharedPreferences.Editor edit = context.getSharedPreferences("cloud_backup", 4).edit();
edit.putInt(str, i);
edit.commit();
}
public static void a(Context context, String str, long j) {
SharedPreferences.Editor edit = context.getSharedPreferences("cloud_backup", 4).edit();
edit.putLong(str, j);
edit.commit();
}
public static void a(Context context, String str, String str2) {
SharedPreferences.Editor edit = context.getSharedPreferences("cloud_backup", 4).edit();
edit.putString(str, str2);
edit.commit();
}
public static void a(File file, String str) {
String a2;
FileOutputStream fileOutputStream;
FileOutputStream fileOutputStream2 = null;
try {
try {
a2 = com.cx.tools.i.a.a(MyApplication.f.toString(), str);
com.cx.tools.e.a.c("CloudUtils", "Path:" + file.getAbsolutePath());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
fileOutputStream = new FileOutputStream(file);
} catch (Throwable th) {
th = th;
}
} catch (Exception e) {
e = e;
}
try {
fileOutputStream.write(a2.getBytes());
fileOutputStream.flush();
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
} catch (Exception e3) {
e = e3;
fileOutputStream2 = fileOutputStream;
e.printStackTrace();
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException e4) {
e4.printStackTrace();
}
}
} catch (Throwable th2) {
th = th2;
fileOutputStream2 = fileOutputStream;
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
throw th;
}
}
public static void a(Map map) {
if (map != null) {
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
List list = (List) ((Map.Entry) it.next()).getValue();
if (list.size() > 1) {
int size = list.size();
for (int i = 0; i < size; i++) {
com.cx.launcher.cloud.c.d dVar = (com.cx.launcher.cloud.c.d) list.get(i);
dVar.p(dVar.s() + SocializeConstants.OP_DIVIDER_MINUS + (i + 1));
}
}
}
}
}
public static void a(Map map, com.cx.launcher.cloud.c.d dVar) {
if (map.containsKey(dVar.s())) {
((List) map.get(dVar.s())).add(dVar);
return;
}
ArrayList arrayList = new ArrayList();
arrayList.add(dVar);
map.put(dVar.s(), arrayList);
}
public static boolean a(Context context, String str) {
SharedPreferences.Editor edit = context.getSharedPreferences("cloud_backup", 4).edit();
edit.remove(str);
return edit.commit();
}
public static int b(Context context, String str, int i) {
return context.getSharedPreferences("cloud_backup", 4).getInt(str, i);
}
public static long b(Context context, String str, long j) {
return context.getSharedPreferences("cloud_backup", 4).getLong(str, j);
}
public static String b(Context context) {
return a(context) + File.separator + "download" + File.separator;
}
public static String b(Context context, String str, String str2) {
return context.getSharedPreferences("cloud_backup", 4).getString(str, str2);
}
public static String b(com.cx.launcher.cloud.c.d dVar) {
return "http://yun.goyihu.com/cloud/api/V1.0/backup/contacts/" + dVar.w();
}
public static boolean b(String str) {
if (!be.a(str)) {
try {
JSONObject jSONObject = new JSONObject(str);
JSONObject optJSONObject = jSONObject.optJSONObject("data");
if (jSONObject.optInt("code") == 200) {
if (optJSONObject.optInt("result") == 1) {
return true;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return false;
}
public static String c(com.cx.launcher.cloud.c.d dVar) {
return "http://yun.goyihu.com/cloud/api/V1.0/backup/smss/" + dVar.w();
}
}