|
|
|
@ -20,6 +20,7 @@ import android.text.TextUtils;
|
|
|
|
|
import android.text.format.Formatter;
|
|
|
|
|
import android.util.Base64;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.Menu;
|
|
|
|
|
import android.view.MenuItem;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.widget.Toast;
|
|
|
|
@ -132,7 +133,6 @@ public class DeviceActivity extends AppCompatActivity {
|
|
|
|
|
AdbKeyPair.generate(priKeyFile, pubKeyFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mAdbKeyPair = AdbKeyPair.read(priKeyFile, pubKeyFile);
|
|
|
|
|
final Context context = getApplicationContext();
|
|
|
|
|
|
|
|
|
@ -150,7 +150,15 @@ public class DeviceActivity extends AppCompatActivity {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mProgressDialog = ProgressDialog.show(this, "", "连接" + mDeviceIp + "中", true, true);
|
|
|
|
|
loadDeviceInfo(context, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void loadDeviceInfo(final Context context, boolean firstConnect) {
|
|
|
|
|
|
|
|
|
|
binding.deviceInfo.setText("");
|
|
|
|
|
|
|
|
|
|
String msg = firstConnect ? "连接" + mDeviceIp + "中" : "刷新数据中";
|
|
|
|
|
mProgressDialog = ProgressDialog.show(this, "", msg, true, true);
|
|
|
|
|
mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCancel(DialogInterface dialogInterface) {
|
|
|
|
@ -158,16 +166,12 @@ public class DeviceActivity extends AppCompatActivity {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
loadDeviceInfo(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void loadDeviceInfo(final Context context) {
|
|
|
|
|
final File fileTmp = new File(getFilesDir(), "tmp");
|
|
|
|
|
if (!fileTmp.exists()) {
|
|
|
|
|
fileTmp.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(new Thread(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
@ -340,9 +344,6 @@ public class DeviceActivity extends AppCompatActivity {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})).start();
|
|
|
|
|
}
|
|
|
|
@ -698,12 +699,22 @@ public class DeviceActivity extends AppCompatActivity {
|
|
|
|
|
stringBuilder.append("<br>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
|
|
// Inflate the menu; this adds items to the action bar if it is present.
|
|
|
|
|
getMenuInflater().inflate(R.menu.device_activity_actions, menu);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
|
case android.R.id.home:
|
|
|
|
|
finish();
|
|
|
|
|
return false;
|
|
|
|
|
case R.id.action_refresh:
|
|
|
|
|
loadDeviceInfo(getApplicationContext(), false);
|
|
|
|
|
return false;
|
|
|
|
|
default:
|
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
|
}
|
|
|
|
|