优化体验

main
Matthew 1 year ago
parent 48aeff77ef
commit d9a966e3a9

@ -38,6 +38,7 @@ public class CertActivity extends AppCompatActivity {
private static long AUTO_CLOSE_TIMEOUT = 200; private static long AUTO_CLOSE_TIMEOUT = 200;
private Handler mHandler = null; private Handler mHandler = null;
TextView mTextView = null;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -60,19 +61,18 @@ public class CertActivity extends AppCompatActivity {
String version = MicroPhotoService.querySecVersion(); String version = MicroPhotoService.querySecVersion();
TextView textView = (TextView)findViewById(R.id.textView); mTextView = (TextView)findViewById(R.id.textView);
textView.setText(R.string.nrsec_version + version); mTextView.setText(R.string.nrsec_version + version);
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
String text = getResources().getString(R.string.nrsec_version); String text = getResources().getString(R.string.nrsec_version);
actionBar.setTitle(actionBar.getTitle().toString() + " " + text + " " + version); actionBar.setTitle(actionBar.getTitle().toString() + " " + text + " " + version);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dt = new Date(); Date dt = new Date();
text = format.format(dt); text = format.format(dt);
((TextView) findViewById(R.id.textView)).setText(text); mTextView.setText(text);
mHandler = new Handler(); mHandler = new Handler();
@ -338,13 +338,29 @@ public class CertActivity extends AppCompatActivity {
f = new File(path); f = new File(path);
f = new File(f, "progress.txt"); f = new File(f, "progress.txt");
writeTextFile(f.getAbsolutePath(), Integer.toString(idx - startIdx + 1)); writeTextFile(f.getAbsolutePath(), Integer.toString(idx - startIdx + 1));
final String fullSn = sn + idxStr;
mHandler.post(new Runnable() {
@Override
public void run() {
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
Date dt = new Date();
mTextView.setText(format.format(dt) + " " + fullSn);
}
});
} }
f = new File(path); f = new File(path);
f = new File(f, "log.txt"); File dest = new File(f, "log.txt");
f = new File(f, "log");
writeTextFile(f.getAbsolutePath(), logs.toString()); writeTextFile(f.getAbsolutePath(), logs.toString());
try {
Files.move(f.toPath(), dest.toPath());
} catch (Exception ex) {
} }
}
final Activity activity = this; final Activity activity = this;
mHandler.postDelayed(new Runnable() { mHandler.postDelayed(new Runnable() {

@ -11,6 +11,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TextView" android:text="TextView"
android:textSize="32sp"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"

Loading…
Cancel
Save