处理时序

main
Matthew 12 months ago
parent 6e1f87f4cb
commit 3deb614d31

@ -76,7 +76,7 @@ public class CertActivity extends AppCompatActivity {
bres = dsSdk.mcuPowerOffCPR();
try {
Thread.sleep(1000);
Thread.sleep(100);
} catch (Exception ex) {
ex.printStackTrace();
}
@ -86,18 +86,11 @@ public class CertActivity extends AppCompatActivity {
// res = dsSdk.nrsecInit();
// res = dsSdk.nrsecOpen();
String version = MicroPhotoService.querySecVersion();
mTextView = (TextView)findViewById(R.id.textView);
mTextView.setText(R.string.nrsec_version + version);
ActionBar actionBar = getSupportActionBar();
String text = getResources().getString(R.string.nrsec_version);
actionBar.setTitle(actionBar.getTitle().toString() + " " + text + " " + version);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dt = new Date();
text = format.format(dt);
String text = format.format(dt);
mTextView.setText(text);
@ -114,30 +107,21 @@ public class CertActivity extends AppCompatActivity {
setEditText(R.id.uid_end, sharedPreferences.getString("uidEnd", ""));
setSpinnerPosition(R.id.company, sharedPreferences.getInt("company", 0));
{
final Intent intent = getIntent();
if (intent != null) {
if (mCommandThread != null) {
try {
mCommandThread.interrupt();
} catch (Exception ex) {
}
}
mCommandThread = new Thread(new Runnable() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
try {
handleCommand(intent);
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
String version = MicroPhotoService.querySecVersion();
mTextView.setText(R.string.nrsec_version + version);
ActionBar actionBar = getSupportActionBar();
String text = getResources().getString(R.string.nrsec_version);
actionBar.setTitle(actionBar.getTitle().toString() + " " + text + " " + version);
processActivityIntent();
mCommandThread.start();
}
}
}, 1000);
findViewById(R.id.btnGenKeys).setOnClickListener(new View.OnClickListener() {
@Override
@ -262,6 +246,31 @@ public class CertActivity extends AppCompatActivity {
//
}
protected void processActivityIntent() {
final Intent intent = getIntent();
if (intent != null) {
if (mCommandThread != null) {
try {
mCommandThread.interrupt();
} catch (Exception ex) {
}
}
mCommandThread = new Thread(new Runnable() {
@Override
public void run() {
try {
handleCommand(intent);
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
mCommandThread.start();
}
}
protected int getItemData(int viewId) {
Spinner spinnerView = (Spinner) findViewById(viewId);
if (spinnerView != null) {
@ -524,10 +533,13 @@ public class CertActivity extends AppCompatActivity {
@Override
public void run() {
activity.finish();
System.exit(0);
}
});
}
}
mCommandThread = null;
}
protected void ensureDirectoryExisted(String fileName) {
@ -573,6 +585,9 @@ public class CertActivity extends AppCompatActivity {
public void onReceive(Context context, final Intent intent) {
final Intent finalIntent = intent;
CertActivity.this.mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (intent != null) {
if (mCommandThread != null) {
@ -596,5 +611,7 @@ public class CertActivity extends AppCompatActivity {
mCommandThread.start();
}
}
}, 2000);
}
}
}
Loading…
Cancel
Save