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,10 +189,19 @@ fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<Lesso
|
|||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
activity.finish()
|
activity.finish()
|
||||||
|
if (setupDone) {
|
||||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
startActivity(activity, intent, null)
|
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(
|
Icon(
|
||||||
imageVector = Icons.Filled.ArrowBack,
|
imageVector = Icons.Filled.ArrowBack,
|
||||||
@@ -383,11 +392,20 @@ fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<Lesso
|
|||||||
editor.putInt("breakAmnt", breakAmnt.toInt())
|
editor.putInt("breakAmnt", breakAmnt.toInt())
|
||||||
editor.apply()
|
editor.apply()
|
||||||
activity.finish()
|
activity.finish()
|
||||||
|
if (setupDone) {
|
||||||
//Reopen of activity so values will be updated
|
//Reopen of activity so values will be updated
|
||||||
val intent = Intent(activity, StundenplanActivity::class.java)
|
val intent = Intent(activity, StundenplanActivity::class.java)
|
||||||
//Remove previous StundenplanActivity from activity stack so when going back later it won't exist twice
|
//Remove previous StundenplanActivity from activity stack so when going back later it won't exist twice
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
startActivity(activity, intent, null)
|
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
|
modifier = Modifier
|
||||||
.padding(5.dp)
|
.padding(5.dp)
|
||||||
|
|||||||
Reference in New Issue
Block a user