mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Improve Gadgetbridge restart
- Close the database - Ensure we go back to the start activity
This commit is contained in:
@@ -212,6 +212,14 @@ public class GBApplication extends Application {
|
||||
LocalBroadcastManager.getInstance(context).sendBroadcast(quitIntent);
|
||||
GBApplication.deviceService().quit();
|
||||
|
||||
if (lockHandler != null) {
|
||||
try {
|
||||
lockHandler.closeDb();
|
||||
} catch (final Exception e) {
|
||||
GB.log("Failed to close DB before restart", GB.ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
final Intent startActivity = new Intent(context, ControlCenterv2.class);
|
||||
final PendingIntent pendingIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
|
||||
+2
-2
@@ -125,11 +125,11 @@ public class BackupRestoreProgressActivity extends AbstractGBActivity {
|
||||
.setTitle(R.string.backup_restore_restart_title)
|
||||
.setMessage(message.toString())
|
||||
.setOnCancelListener((dialog -> {
|
||||
finish();
|
||||
finishAffinity();
|
||||
GBApplication.restart();
|
||||
}))
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||
finish();
|
||||
finishAffinity();
|
||||
GBApplication.restart();
|
||||
}).show();
|
||||
break;
|
||||
|
||||
+1
@@ -85,6 +85,7 @@ class DatabaseDebugFragment : AbstractDebugFragment() {
|
||||
Toast.LENGTH_SHORT,
|
||||
GB.INFO
|
||||
)
|
||||
requireActivity().finishAffinity()
|
||||
GBApplication.restart()
|
||||
} else {
|
||||
GB.toast(
|
||||
|
||||
Reference in New Issue
Block a user