修复UI相关的bug

serial
BlueMatthew 1 year ago
parent 63064aa857
commit 2aef7bcc33

@ -5,7 +5,7 @@ plugins {
// 10,00,000 major-minor-build
def AppMajorVersion = 1
def AppMinorVersion = 0
def AppBuildNumber = 48
def AppBuildNumber = 49
def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber
def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber

@ -426,7 +426,7 @@ public class MainActivity extends AppCompatActivity {
}
});
if (!TextUtils.isEmpty(appConfig.cmdid) && !TextUtils.isEmpty(appConfig.server) && appConfig.port != 0) {
if (!MicroPhotoService.isRunning && !TextUtils.isEmpty(appConfig.cmdid) && !TextUtils.isEmpty(appConfig.server) && appConfig.port != 0) {
Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
@ -436,8 +436,10 @@ public class MainActivity extends AppCompatActivity {
}
}
};
handler.postDelayed(runnable, noDelay != 0 ? 100 : 5000);
handler.postDelayed(runnable, noDelay != 0 ? 1000 : 5000);
}
binding.btnStartServ.setEnabled(!MicroPhotoService.isRunning);
binding.btnStopServ.setEnabled(MicroPhotoService.isRunning);
binding.tcpudp.setOnClickListener(new View.OnClickListener() {
@Override
@ -559,9 +561,9 @@ public class MainActivity extends AppCompatActivity {
}
@Override
protected void onStart() {
protected void onResume() {
// call the superclass method first
super.onStart();
super.onResume();
String logFilePath = MicroPhotoContext.buildAppDir(this.getApplicationContext());
logFilePath += "logs/log.txt";
@ -572,9 +574,9 @@ public class MainActivity extends AppCompatActivity {
}
@Override
protected void onStop() {
protected void onPause() {
// call the superclass method first
super.onStop();
super.onPause();
if (mLogFileObserver != null) {
mLogFileObserver.stopWatching();

@ -137,6 +137,8 @@ public class MicroPhotoService extends Service {
private String mModelName = null;
public static boolean isRunning = false;
public MicroPhotoService() {
}
@Override
@ -215,6 +217,7 @@ public class MicroPhotoService extends Service {
if (mNativeHandle != 0) {
uninit(mNativeHandle);
mNativeHandle = 0;
isRunning = false;
}
getApplicationContext().unregisterReceiver(mAlarmReceiver);
@ -686,6 +689,7 @@ public class MicroPhotoService extends Service {
service.mNativeHandle = init(appPath, server, port, cmdid, protocol, networkProtocol, 0);
if (service.mNativeHandle !=0) {
isRunning = true;
service.mCmdid = cmdid;
Date date = new Date();
long nowTs = date.getTime() / 1000;

@ -4,7 +4,7 @@ plugins {
def AppMajorVersion = 1
def AppMinorVersion = 0
def AppBuildNumber = 8
def AppBuildNumber = 9
def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber
def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber

@ -114,7 +114,7 @@
android:enabled="true"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter android:priority="90000">
<intent-filter android:priority="80000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.REBOOT" />

Loading…
Cancel
Save