中建乐购 v3.2.2版本的 MD5 值为:0553721e6bc6ba8dd67004696a555b81
以下内容为反编译后的 t.java 源代码,内容仅作参考
package com.shopex.westore.util;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.shopex.westore.AgentApplication;
import com.zjsjtz.ecstore.R;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.http.HttpHost;
public class t {
private Activity f10552a;
private Dialog f10555d;
private Dialog f10556e;
private ProgressBar f10558g;
private TextView f10559h;
private StringBuffer f10560i;
private int f10563l;
private Thread f10564m;
private String f10553b = "有最新的软件包哦,亲快下载吧~";
private String f10554c = "http://121.15.220.150/dd.myapp.com/16891/40836342DD941D45EAD1A696BB4246FC.apk?mkey=558cc303d06518cf&f=d488&fsname=com.beautymiracle.androidclient_1.2.7_20150605.apk&asr=8eff&p=.apk";
private final String f10557f = e.Z + "UpdateRelease.apk";
private final int f10561j = 1;
private final int f10562k = 2;
private boolean f10565n = false;
private Handler f10566o = new Handler() {
@Override
public void handleMessage(Message message) {
switch (message.what) {
case 1:
t.this.f10558g.setProgress(t.this.f10563l);
t.this.f10559h.setText(t.this.f10560i.toString());
return;
case 2:
t.this.f10556e.dismiss();
t.this.b();
return;
default:
return;
}
}
};
private Runnable f10567p = new Runnable() {
@Override
public void run() {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(t.this.f10554c).openConnection();
httpURLConnection.connect();
int contentLength = httpURLConnection.getContentLength();
InputStream inputStream = httpURLConnection.getInputStream();
File file = new File(e.Z);
if (!file.exists()) {
file.mkdir();
}
FileOutputStream fileOutputStream = new FileOutputStream(new File(t.this.f10557f));
byte[] bArr = new byte[1024];
int i2 = 0;
while (true) {
int read = inputStream.read(bArr);
i2 += read;
t.this.f10563l = (int) ((i2 / contentLength) * 100.0f);
t.this.f10560i.setLength(0);
StringBuffer stringBuffer = t.this.f10560i;
stringBuffer.append(i2 / 1024);
stringBuffer.append("k/");
stringBuffer.append(contentLength / 1024);
stringBuffer.append("k");
t.this.f10566o.sendEmptyMessage(1);
if (read <= 0) {
t.this.f10566o.sendEmptyMessage(2);
break;
}
fileOutputStream.write(bArr, 0, read);
if (t.this.f10565n) {
break;
}
}
fileOutputStream.close();
inputStream.close();
} catch (MalformedURLException e2) {
e2.printStackTrace();
} catch (IOException e3) {
e3.printStackTrace();
}
}
};
public t(Activity activity) {
this.f10552a = activity;
}
public void a(String str, boolean z2, String str2) {
if (TextUtils.isEmpty(str) || !str.contains(HttpHost.DEFAULT_SCHEME_NAME)) {
return;
}
this.f10554c = str;
if (!TextUtils.isEmpty(str2)) {
this.f10553b = str2;
}
a(z2);
}
private void a(final boolean z2) {
if (!z2) {
this.f10555d = fd.o.a((Context) this.f10552a, this.f10553b, "", "确定", (View.OnClickListener) null, new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t.this.f10555d != null) {
t.this.f10555d.dismiss();
}
t.this.b(z2);
}
}, false, (View.OnClickListener) null);
this.f10555d.setCancelable(true);
return;
}
this.f10555d = fd.o.a((Context) this.f10552a, this.f10553b, "以后再说", "确定", (View.OnClickListener) null, new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t.this.f10555d != null) {
t.this.f10555d.dismiss();
}
t.this.b(z2);
}
}, false, (View.OnClickListener) null);
}
public void b(boolean z2) {
this.f10556e = new Dialog(this.f10552a, R.style.Theme_dialog);
View inflate = LayoutInflater.from(this.f10552a).inflate(R.layout.progress, (ViewGroup) null);
this.f10558g = (ProgressBar) inflate.findViewById(R.id.progress);
this.f10559h = (TextView) inflate.findViewById(R.id.text_progress);
this.f10560i = new StringBuffer();
this.f10556e.setContentView(inflate);
this.f10556e.setCancelable(false);
this.f10556e.show();
a();
}
private void a() {
this.f10564m = new Thread(this.f10567p);
this.f10564m.start();
}
public void b() {
File file = new File(this.f10557f);
if (file.exists()) {
Intent intent = new Intent("android.intent.action.VIEW");
if (Build.VERSION.SDK_INT >= 24) {
intent.setFlags(1);
intent.setDataAndType(FileProvider.a(AgentApplication.i(), "com.zjsjtz.ecstore.fileprovider", file), "application/vnd.android.package-archive");
} else {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
intent.setFlags(268435456);
}
this.f10552a.startActivity(intent);
this.f10552a.finish();
}
}
}