4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.m4399.gamecenter.plugin.main.controllers.download.diagnose;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import cn.m4399.diag.a.d;
import cn.m4399.diag.a.e;
import cn.m4399.diag.a.f;
import cn.m4399.diag.a.g;
import cn.m4399.diag.a.h;
import cn.m4399.diag.a.i;
import cn.m4399.diag.a.j;
import cn.m4399.diag.a.k;
import cn.m4399.diag.api.Report;
import cn.m4399.diag.api.Summary;
import cn.m4399.diag.api.b;
import cn.m4399.diag.api.c;
import com.dialog.DialogResult;
import com.dialog.c;
import com.dialog.theme.DialogOneButtonTheme;
import com.download.DownloadManager;
import com.download.DownloadModel;
import com.framework.net.ILoadPageEventListener;
import com.framework.utils.ActivityStateUtils;
import com.m4399.gamecenter.plugin.main.R;
import com.m4399.gamecenter.plugin.main.views.LottieImageView;
import com.m4399.support.controllers.BaseFragment;
import com.m4399.support.utils.StatusBarHelper;
import org.json.JSONObject;
import timber.log.Timber;
public class b extends BaseFragment implements c {
public static final int FROM_TYPE_DOWNLOAD = 0;
public static final int FROM_TYPE_SETTING = 1;
private static long asS;
private static String[] asT;
private static String mPackageName;
private View asU;
private TextView asV;
private LottieImageView asW;
private View asX;
private TextView asY;
private Report asZ;
private com.dialog.c ata;
private int mFrom;
private ValueAnimator mValueAnimator;
@Override
public boolean isSupportToolBar() {
return false;
}
@Override
public void initData(Bundle bundle) {
super.initData(bundle);
this.asZ = (Report) bundle.getParcelable("network.diagnose.report");
mPackageName = bundle.getString("network.diagnose.package_name");
this.mFrom = bundle.getInt("network.diagnose.from");
}
public static void oj() {
asS = 0L;
mPackageName = null;
}
@Override
protected int getLayoutID() {
return R.layout.m4399_activity_network_diagnose;
}
@Override
public void initToolBar() {
super.setupNavigationToolBar();
Toolbar toolBar = getToolBar();
StatusBarHelper.fitsToolbarOnBackgroundImage(toolBar);
toolBar.setNavigationIcon(R.drawable.m4399_xml_selector_toolbar_item_back_white);
toolBar.setTitleTextColor(-1);
toolBar.setTitle(R.string.network_diagnose);
toolBar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
b.this.onBackPressed();
}
});
}
@Override
protected void initView(ViewGroup viewGroup, Bundle bundle) {
initToolBar();
if (this.asZ != null) {
ol();
} else {
ok();
}
for (int i : new int[]{R.id.m4399_network_diagnose_result_operation, R.id.m4399_network_diagnosing_operation}) {
this.mainView.findViewById(i).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
b.this.getContext().finish();
}
});
}
}
private void ok() {
this.asU = this.mainView.findViewById(R.id.m4399_network_diagnosing);
this.asU.setVisibility(0);
this.asV = (TextView) this.mainView.findViewById(R.id.m4399_network_diagnose_percent);
this.asW = (LottieImageView) this.mainView.findViewById(R.id.m4399_network_diagnose_animation);
this.asW.setImageAssetsFolder("animation/network_diagnose");
this.asW.setAnimation("animation/network_diagnose/data.json");
this.asW.setLoop(true);
this.asW.playAnimation();
if (asS == 0) {
asS = System.currentTimeMillis();
om();
}
long currentTimeMillis = System.currentTimeMillis() - asS;
if (currentTimeMillis > 20000.0d) {
this.asV.setText(getString(R.string.network_diagnosing_percent, 99, "%"));
return;
}
double d = 100 * currentTimeMillis;
Double.isNaN(d);
this.mValueAnimator = ObjectAnimator.ofInt((int) (d / 20000.0d), 99).setDuration(20000 - currentTimeMillis);
this.mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
b.this.asV.setText(b.this.getString(R.string.network_diagnosing_percent, Integer.valueOf(((Integer) valueAnimator.getAnimatedValue()).intValue()), "%"));
}
});
this.mValueAnimator.start();
}
private void ol() {
View view = this.asU;
if (view != null) {
view.setVisibility(8);
}
ValueAnimator valueAnimator = this.mValueAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
this.asX = this.mainView.findViewById(R.id.m4399_network_diagnose_result);
this.asX.setVisibility(0);
this.asY = (TextView) this.mainView.findViewById(R.id.m4399_network_diagnose_result_desc);
this.asY.setText(a(this.asZ.getSummary(), this.mFrom));
}
public static class AnonymousClass6 {
static final int[] atd = new int[Summary.values().length];
static {
try {
atd[Summary.GOOD.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
atd[Summary.POOR.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
atd[Summary.NO_NETWORK.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
private int a(Summary summary, int i) {
int i2;
int i3 = AnonymousClass6.atd[summary.ordinal()];
if (i3 != 1) {
if (i3 == 2) {
return R.string.network_diagnose_poor;
}
if (i3 != 3) {
return 0;
}
return R.string.network_diagnose_not_network;
}
if (i == 0) {
i2 = R.string.network_diagnose_good_download;
} else {
if (i != 1) {
return 0;
}
i2 = R.string.network_diagnose_good_setting;
}
return i2;
}
@Override
public void onDestroy() {
super.onDestroy();
ValueAnimator valueAnimator = this.mValueAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
com.dialog.c cVar = this.ata;
if (cVar != null) {
cVar.cancel();
}
LottieImageView lottieImageView = this.asW;
if (lottieImageView != null) {
lottieImageView.pauseAnim();
}
}
public void onBackPressed() {
if (this.asZ != null) {
getContext().finish();
return;
}
this.ata = new com.dialog.c(getContext());
this.ata.setDialogOneButtomTheme(DialogOneButtonTheme.Default);
this.ata.setOnDialogOneButtonClickListener(new c.a() {
@Override
public DialogResult onButtonClick() {
b.this.ata.cancel();
if (b.this.asZ == null) {
b.this.getContext().finish();
}
return DialogResult.OK;
}
});
this.ata.show(getString(R.string.network_diagnose_quit), getString(R.string.network_diagnose_quit_tips), getString(R.string.dialog_btn_txt_known));
}
public void om() {
String[] strArr;
DownloadModel downloadInfo = DownloadManager.getInstance().getDownloadInfo(mPackageName);
if (downloadInfo == null) {
strArr = asT;
if (strArr == null) {
final com.m4399.gamecenter.plugin.main.providers.config.b bVar = new com.m4399.gamecenter.plugin.main.providers.config.b();
bVar.loadData(new ILoadPageEventListener() {
@Override
public void onBefore() {
}
@Override
public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
}
@Override
public void onSuccess() {
if (ActivityStateUtils.isDestroy((Activity) b.this.getActivity()) || bVar.isEmpty()) {
return;
}
String[] unused = b.asT = bVar.getHosts();
b.this.om();
}
});
return;
}
} else {
strArr = new String[]{Uri.parse(downloadInfo.getMDownUrl()).getHost()};
}
new cn.m4399.diag.api.b(getContext()).withNotifier(new a(mPackageName, this.mFrom)).diagnose(new b.a(new h(), strArr), new b.a(new e(), strArr), new b.a(new cn.m4399.diag.a.c(), "@114.114.114.114", strArr[0]), new b.a(new d(), strArr), new b.a(new f(), new String[0]), new b.a(new k(), new String[0]), new b.a(new cn.m4399.diag.a.b(), new String[0]), new b.a(new i(), new String[0]), new b.a(new g(), new String[0]), new b.a(new j(), new String[0]), new b.a(new cn.m4399.diag.a.a(), new String[0]));
}
@Override
public void notify(Report report) {
this.asZ = report;
ol();
Timber.i("接收到sdk反馈 " + report, new Object[0]);
}
}