Fix: Fixed restart app issue when restoring backup.

This commit is contained in:
HeCodes2Much
2024-12-02 09:09:05 +00:00
parent 3defd8f4b9
commit 011bd02dd5
2 changed files with 4 additions and 5 deletions

View File

@@ -12,11 +12,12 @@ object AppReloader {
val componentName = intent?.component
val mainIntent = Intent.makeRestartActivityTask(componentName)
mainIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
mainIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
// Delay the restart slightly to ensure all current activities are finished
Handler(Looper.getMainLooper()).post {
Handler(Looper.getMainLooper()).postDelayed({
context.startActivity(mainIntent)
Runtime.getRuntime().exit(0)
}
}, 250)
}
}

View File

@@ -391,9 +391,7 @@ class MainActivity : AppCompatActivity() {
}
}
applicationContext.showShortToast(getString(R.string.settings_reload_app_restore))
Handler(Looper.getMainLooper()).postDelayed({
AppReloader.restartApp(applicationContext)
}, 500)
}
Constants.BACKUP_WRITE -> {