Added restart of app when first setup isn't done
when going back via phone feature, user sees the empty timetable
This commit is contained in:
@@ -189,9 +189,18 @@ fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<Lesso
|
||||
IconButton(
|
||||
onClick = {
|
||||
activity.finish()
|
||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
if (setupDone) {
|
||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
else {
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Icon(
|
||||
@@ -383,11 +392,20 @@ fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<Lesso
|
||||
editor.putInt("breakAmnt", breakAmnt.toInt())
|
||||
editor.apply()
|
||||
activity.finish()
|
||||
//Reopen of activity so values will be updated
|
||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||
//Remove previous StundenplanActivity from activity stack so when going back later it won't exist twice
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
if (setupDone) {
|
||||
//Reopen of activity so values will be updated
|
||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||
//Remove previous StundenplanActivity from activity stack so when going back later it won't exist twice
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
else {
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
|
||||
Reference in New Issue
Block a user