思特奇智慧酒店云平台 v0.0.5版本的 MD5 值为:dedb172bb322639d79d7e0e26262fb5c
以下内容为反编译后的 NetCheckActivity.java 源代码,内容仅作参考
package com.sitech.oncon.app.conf;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.sitech.core.util.Log;
import com.sitech.oncon.R;
import com.sitech.oncon.activity.BaseActivity;
import java.io.IOException;
import java.io.Serializable;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
public class NetCheckActivity extends BaseActivity {
public TextView a;
public TextView c;
public TextView d;
public ProgressBar e;
public HttpURLConnection m;
public int f = 1;
public int g = 5;
public Map<Integer, Boolean> h = new HashMap();
public long i = 0;
public long j = 0;
public boolean k = false;
public URL l = null;
public Handler n = new b();
public class a extends Thread {
public a() {
}
@Override
public void run() {
super.run();
NetCheckActivity.this.n.sendEmptyMessage(1);
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (NetCheckActivity.this.v()) {
NetCheckActivity.this.h.remove(1);
NetCheckActivity.this.h.put(1, true);
Log.d("123第一步有网络权限");
NetCheckActivity.this.n.sendEmptyMessage(2);
try {
Thread.sleep(1000L);
} catch (InterruptedException e2) {
e2.printStackTrace();
}
if (NetCheckActivity.this.r()) {
NetCheckActivity.this.h.remove(2);
NetCheckActivity.this.h.put(2, true);
Log.d("123第二步有网络");
NetCheckActivity.this.n.sendEmptyMessage(3);
try {
Thread.sleep(1000L);
} catch (InterruptedException e3) {
e3.printStackTrace();
}
if (NetCheckActivity.this.t()) {
NetCheckActivity.this.h.remove(3);
NetCheckActivity.this.h.put(3, true);
Log.d("123第三步连接服务器正常");
NetCheckActivity.this.n.sendEmptyMessage(4);
try {
Thread.sleep(1000L);
} catch (InterruptedException e4) {
e4.printStackTrace();
}
if (NetCheckActivity.this.w()) {
NetCheckActivity.this.h.remove(4);
NetCheckActivity.this.h.put(4, true);
Log.d("123第四步域名解析正常" + NetCheckActivity.this.i);
NetCheckActivity.this.n.sendEmptyMessage(5);
try {
Thread.sleep(1000L);
} catch (InterruptedException e5) {
e5.printStackTrace();
}
if (!NetCheckActivity.this.u()) {
NetCheckActivity.this.y();
return;
}
Log.d("123第五步服务器联通正常" + NetCheckActivity.this.j);
NetCheckActivity.this.h.remove(5);
NetCheckActivity.this.h.put(5, true);
NetCheckActivity.this.y();
return;
}
NetCheckActivity.this.y();
return;
}
NetCheckActivity.this.y();
return;
}
NetCheckActivity.this.y();
return;
}
NetCheckActivity.this.y();
}
}
public class b extends Handler {
public b() {
}
@Override
public void handleMessage(@NonNull Message message) {
super.handleMessage(message);
int i = message.what;
if (i == 1) {
TextView textView = NetCheckActivity.this.a;
textView.setText("正在检测(1/" + NetCheckActivity.this.g + ")");
NetCheckActivity.this.c.setText("正在检测网络权限");
} else if (i == 2) {
TextView textView2 = NetCheckActivity.this.a;
textView2.setText("正在检测(2/" + NetCheckActivity.this.g + ")");
NetCheckActivity.this.c.setText("正在检测网络是否可用");
} else if (i == 3) {
TextView textView3 = NetCheckActivity.this.a;
textView3.setText("正在检测(3/" + NetCheckActivity.this.g + ")");
NetCheckActivity.this.c.setText("正在检测连接服务器是否正常");
} else if (i == 4) {
TextView textView4 = NetCheckActivity.this.a;
textView4.setText("正在检测(4/" + NetCheckActivity.this.g + ")");
NetCheckActivity.this.c.setText("正在检测域名解析耗时");
} else if (i != 5) {
} else {
TextView textView5 = NetCheckActivity.this.a;
textView5.setText("正在检测(5/" + NetCheckActivity.this.g + ")");
NetCheckActivity.this.c.setText("正在检测连接耗时");
}
}
}
private void s() {
new a().start();
}
public boolean t() {
HttpURLConnection httpURLConnection;
try {
try {
try {
this.l = new URL("http://jk.teamshub.com");
this.m = (HttpURLConnection) this.l.openConnection();
this.m.setConnectTimeout(5000);
Log.d("服务器返回码" + this.m.getResponseCode());
if (this.m.getResponseCode() == 200) {
HttpURLConnection httpURLConnection2 = this.m;
if (httpURLConnection2 != null) {
httpURLConnection2.disconnect();
}
return true;
}
HttpURLConnection httpURLConnection3 = this.m;
if (httpURLConnection3 != null) {
httpURLConnection3.disconnect();
}
return false;
} catch (MalformedURLException e) {
e.printStackTrace();
httpURLConnection = this.m;
}
} catch (IOException e2) {
e2.printStackTrace();
httpURLConnection = this.m;
}
} catch (Throwable th) {
HttpURLConnection httpURLConnection4 = this.m;
if (httpURLConnection4 != null) {
httpURLConnection4.disconnect();
}
throw th;
}
}
public boolean u() {
long currentTimeMillis = System.currentTimeMillis();
if (new gn1(this).z(bf1.L().b()) != null) {
this.j = System.currentTimeMillis() - currentTimeMillis;
return true;
}
return false;
}
public boolean v() {
return ((ConnectivityManager) getSystemService("connectivity")).getActiveNetworkInfo() != null;
}
public boolean w() {
try {
long currentTimeMillis = System.currentTimeMillis();
if (TextUtils.isEmpty(InetAddress.getByName("jk.teamshub.com").getHostAddress())) {
return false;
}
this.i = System.currentTimeMillis() - currentTimeMillis;
return true;
} catch (UnknownHostException e) {
e.printStackTrace();
return false;
}
}
private void x() {
this.a = (TextView) findViewById(R.id.txt_state);
this.c = (TextView) findViewById(R.id.txt_check_tips);
findViewById(R.id.btn).setOnClickListener(this);
this.d = (TextView) findViewById(R.id.start);
this.e = (ProgressBar) findViewById(R.id.mprogressBar);
}
public void y() {
Intent intent = new Intent(this, NetCheckReslutActivity.class);
intent.putExtra("map", (Serializable) this.h);
intent.putExtra("jxtime", this.i);
intent.putExtra("ljtime", this.j);
startActivity(intent);
finish();
}
@Override
public void onClick(View view) {
super.onClick(view);
int id2 = view.getId();
if (id2 == R.id.common_title_TV_left) {
finish();
return;
}
int i = R.id.btn;
if (id2 == i) {
findViewById(i).setClickable(false);
this.d.setVisibility(8);
this.e.setVisibility(0);
s();
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_net_check);
this.k = getIntent().getBooleanExtra("checknow", false);
this.h.put(1, false);
this.h.put(2, false);
this.h.put(3, false);
this.h.put(4, false);
this.h.put(5, false);
x();
if (this.k) {
findViewById(R.id.btn).setClickable(false);
this.d.setVisibility(8);
this.e.setVisibility(0);
s();
}
}
public boolean r() {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo == null) {
return false;
}
return activeNetworkInfo.isAvailable();
}
}