Skip to content

Commit 011bd02

Browse files
Fix: Fixed restart app issue when restoring backup.
1 parent 3defd8f commit 011bd02

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/src/main/java/com/github/droidworksstudio/launcher/helper/AppReloader.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ object AppReloader {
1212
val componentName = intent?.component
1313
val mainIntent = Intent.makeRestartActivityTask(componentName)
1414
mainIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
15+
mainIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
1516

1617
// Delay the restart slightly to ensure all current activities are finished
17-
Handler(Looper.getMainLooper()).post {
18+
Handler(Looper.getMainLooper()).postDelayed({
1819
context.startActivity(mainIntent)
1920
Runtime.getRuntime().exit(0)
20-
}
21+
}, 250)
2122
}
2223
}

app/src/main/java/com/github/droidworksstudio/launcher/ui/activities/MainActivity.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,7 @@ class MainActivity : AppCompatActivity() {
391391
}
392392
}
393393
applicationContext.showShortToast(getString(R.string.settings_reload_app_restore))
394-
Handler(Looper.getMainLooper()).postDelayed({
395-
AppReloader.restartApp(applicationContext)
396-
}, 500)
394+
AppReloader.restartApp(applicationContext)
397395
}
398396

399397
Constants.BACKUP_WRITE -> {

0 commit comments

Comments
 (0)