Stundenplan commit for meeting
Setup most definitely done Display still has some issues
This commit is contained in:
@@ -2,9 +2,11 @@ package com.schoolapp.cleverclass
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.drawable.Icon
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@@ -13,6 +15,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.outlined.Edit
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
@@ -29,15 +32,17 @@ import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import com.schoolapp.cleverclass.LessonStoreManager.getLessons
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private val listOfDays = listOf("mon", "tue", "wed", "thu", "fri", "sat", "sun")
|
||||
private val listOfDays = listOf("Mo", "Di", "Mi", "Do", "Fr")
|
||||
private val lessonGrabberIndex = 0
|
||||
|
||||
class StundenplanActivity : ComponentActivity() {
|
||||
@@ -89,6 +94,21 @@ fun StundenplanContent(activity: ComponentActivity){
|
||||
)
|
||||
}
|
||||
},
|
||||
actions ={
|
||||
IconButton(onClick = {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "TimeSetup")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Edit,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(28.dp),
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
@@ -101,9 +121,9 @@ fun StundenplanContent(activity: ComponentActivity){
|
||||
}
|
||||
|
||||
data class LessonData(
|
||||
val subject: String,
|
||||
val teacher: String,
|
||||
val room: String
|
||||
var subject: String,
|
||||
var teacher: String,
|
||||
var room: String
|
||||
)
|
||||
|
||||
@Composable
|
||||
@@ -116,8 +136,8 @@ fun Day(day: String) {
|
||||
lessons = savedLessons.toMutableList()
|
||||
}
|
||||
}
|
||||
lessons.forEach() {
|
||||
Lesson(subject = it.subject, teacher = it.teacher, room = it.room)
|
||||
lessons.forEach() {lessonData ->
|
||||
Lesson(subject = lessonData.subject, teacher = lessonData.teacher, room = lessonData.room)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +148,8 @@ fun Lesson(subject: String, teacher: String, room: String) {
|
||||
.size(200.dp, 100.dp)
|
||||
.padding(3.dp)
|
||||
) {
|
||||
Text(modifier = Modifier.align(Alignment.Center),
|
||||
Text(
|
||||
modifier = Modifier.align(Alignment.Center),
|
||||
text = "$subject\n@$room\n/w$teacher")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,8 @@ import android.icu.text.DecimalFormat
|
||||
import android.icu.text.DecimalFormatSymbols
|
||||
import android.icu.util.Calendar
|
||||
import android.os.Bundle
|
||||
import android.widget.TimePicker
|
||||
import android.widget.Toast
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
@@ -47,51 +44,74 @@ import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.currentCompositionLocalContext
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.schoolapp.cleverclass.ui.theme.CleverClassTheme
|
||||
import com.schoolapp.cleverclass.ui.theme.InputPrimaryColor
|
||||
import com.schoolapp.cleverclass.ui.theme.InputSecondaryColor
|
||||
import org.intellij.lang.annotations.JdkConstants.CalendarMonth
|
||||
import android.text.format.DateFormat
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material.icons.outlined.Edit
|
||||
import androidx.compose.material.ripple.LocalRippleTheme
|
||||
import androidx.compose.material.ripple.RippleAlpha
|
||||
import androidx.compose.material.ripple.RippleTheme
|
||||
import androidx.compose.material3.FilledTonalButton
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.ui.focus.focusModifier
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import java.util.Locale
|
||||
import android.app.Activity
|
||||
import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.Tab
|
||||
import androidx.compose.material3.TabRow
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import com.schoolapp.cleverclass.PSEActivity
|
||||
import kotlinx.coroutines.selects.select
|
||||
import com.schoolapp.cleverclass.LessonStoreManager.getLessons
|
||||
import com.schoolapp.cleverclass.LessonStoreManager.saveLessons
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
private lateinit var activityType : String
|
||||
private lateinit var activityState : String
|
||||
private val listOfDays = listOf("Mo", "Di", "Mi", "Do", "Fr")
|
||||
|
||||
private class CustomRippleTheme : RippleTheme {
|
||||
@Composable
|
||||
override fun defaultColor(): Color = Color.Unspecified
|
||||
|
||||
@Composable
|
||||
override fun rippleAlpha(): RippleAlpha = RippleAlpha(
|
||||
draggedAlpha = 0f,
|
||||
focusedAlpha = 0f,
|
||||
hoveredAlpha = 0f,
|
||||
pressedAlpha = 0f
|
||||
)
|
||||
}
|
||||
|
||||
class TimeTableSetupActivity : ComponentActivity() {
|
||||
companion object{
|
||||
const val TYPE_KEY = "type_key"
|
||||
const val STATE_KEY = "state_key"
|
||||
}
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
activityType = intent.getStringExtra(TYPE_KEY).toString()
|
||||
activityState = intent.getStringExtra(STATE_KEY).toString()
|
||||
|
||||
var lessons = listOf<LessonData>()
|
||||
|
||||
if (activityType == "DaySetup") {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
getLessons(this@TimeTableSetupActivity, listOfDays[activityState.toInt()]).collect { savedLessons ->
|
||||
lessons = savedLessons.toList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setContent {
|
||||
CleverClassTheme {
|
||||
@@ -99,7 +119,7 @@ class TimeTableSetupActivity : ComponentActivity() {
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
TimeTableSetupContent(activity = this)
|
||||
TimeTableSetupContent(activity = this, lessons)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +130,7 @@ class TimeTableSetupActivity : ComponentActivity() {
|
||||
// Content of TimeTableSetup
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<LessonData>){
|
||||
val inputFieldColors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
textColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
||||
@@ -148,8 +168,11 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
var showDeleteConfirmation by remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
|
||||
val listOfDays = listOf("Mo", "Di", "Mi", "Do", "Fr")
|
||||
|
||||
var lessons by remember {
|
||||
mutableStateOf(loadedLessons)
|
||||
}
|
||||
|
||||
|
||||
Column {
|
||||
TopAppBar(
|
||||
@@ -191,7 +214,14 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
|
||||
IconButton(onClick = { showInfo = !showInfo }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Info,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
if (activityType == "Settings")
|
||||
IconButton(onClick = { showDeleteConfirmation = !showDeleteConfirmation }) {
|
||||
Icon(
|
||||
@@ -201,14 +231,6 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
else if (activityType == "TimeSetup")
|
||||
IconButton(onClick = { showInfo = !showInfo }) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Info,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
@@ -237,7 +259,9 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
symbols.decimalSeparator = ':'
|
||||
val decimalFormat = DecimalFormat("00.00", symbols)
|
||||
|
||||
Text(decimalFormat.format(firstLesson) + " Uhr ")
|
||||
Text(
|
||||
text = decimalFormat.format(firstLesson) + " Uhr ",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer)
|
||||
|
||||
Icon(imageVector = Icons.Outlined.Edit, contentDescription = null)
|
||||
}
|
||||
@@ -247,11 +271,7 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
OutlinedTextField(
|
||||
value = lessonLength,
|
||||
onValueChange = { lessonLength = it },
|
||||
label = {
|
||||
Text(
|
||||
text = "Länge einer Schulstunde in min"
|
||||
)
|
||||
},
|
||||
label = { Text(text = "Länge einer Schulstunde in min") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
@@ -265,11 +285,7 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
OutlinedTextField(
|
||||
value = breakAmnt,
|
||||
onValueChange = { breakAmnt = it},
|
||||
label = {
|
||||
Text(
|
||||
text = "Anzahl der Pausen"
|
||||
)
|
||||
},
|
||||
label = { Text(text = "Anzahl der Pausen") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
@@ -278,7 +294,7 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword)
|
||||
)
|
||||
|
||||
if (breakAmnt != "0" && breakAmnt != "") {
|
||||
if (breakAmnt != "") {
|
||||
for (i in 0 until breakAmnt.toInt()) {
|
||||
var currentBrakeStartTime by remember{
|
||||
mutableStateOf(sharedPreferences.getFloat("Brake${i}StartTime", 0.0f))
|
||||
@@ -312,7 +328,11 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
symbols.decimalSeparator = ':'
|
||||
val decimalFormat = DecimalFormat("00.00", symbols)
|
||||
|
||||
Text(decimalFormat.format(currentBrakeStartTime) + " Uhr ")
|
||||
Text(
|
||||
text = decimalFormat.format(currentBrakeStartTime) + " Uhr ",
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
|
||||
Icon(imageVector = Icons.Outlined.Edit, contentDescription = null)
|
||||
}
|
||||
@@ -324,11 +344,7 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
onValueChange = {
|
||||
currentBrakeLength = it
|
||||
editor.putInt("Brake${i}Length", currentBrakeLength.toInt())},
|
||||
label = {
|
||||
Text(
|
||||
text = "Länge der ${i + 1}. Pause in min"
|
||||
)
|
||||
},
|
||||
label = { Text(text = "Länge der ${i + 1}. Pause in min") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
@@ -351,7 +367,7 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = "Abbrechen",
|
||||
text = "Zurück",
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
@@ -364,16 +380,12 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
Button(
|
||||
onClick = {
|
||||
editor.putInt("lessonLength", lessonLength.toInt())
|
||||
if (breakAmnt == "0") {
|
||||
editor.putInt("breakAmnt", -1)
|
||||
}
|
||||
else {
|
||||
editor.putInt("breakAmnt", breakAmnt.toInt())
|
||||
}
|
||||
editor.putInt("breakAmnt", breakAmnt.toInt())
|
||||
editor.apply()
|
||||
activity.finish()
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "DaySetup")
|
||||
putExtra(TimeTableSetupActivity.STATE_KEY, "0")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
},
|
||||
@@ -390,59 +402,153 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
}
|
||||
else if (activityType == "DaySetup") {
|
||||
var state by remember {
|
||||
mutableStateOf(0)
|
||||
mutableStateOf(activityState.toInt())
|
||||
}
|
||||
|
||||
TabRow(selectedTabIndex = state,
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer) {
|
||||
for (day in listOfDays) {
|
||||
Tab(selected = false,
|
||||
onClick = {
|
||||
state = listOfDays.indexOf(day) },
|
||||
modifier = Modifier.padding(5.dp),
|
||||
) {
|
||||
Text(
|
||||
text = day,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
var currentLessonAmount by remember {
|
||||
mutableStateOf(sharedPreferences.getInt("lessonAmount${listOfDays[state]}", 0).toString())
|
||||
}
|
||||
|
||||
CompositionLocalProvider(LocalRippleTheme provides CustomRippleTheme()) {
|
||||
TabRow(selectedTabIndex = state,
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer) {
|
||||
for (day in listOfDays) {
|
||||
Tab(selected = false,
|
||||
onClick = {},
|
||||
modifier = Modifier.padding(5.dp)
|
||||
) {
|
||||
Text(
|
||||
text = day,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
sharedPreferences.getInt("AnzahlStunden${day}", 0)
|
||||
}
|
||||
}
|
||||
when (state) {
|
||||
0 -> {
|
||||
Text(text = "Montag")
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
OutlinedTextField(
|
||||
value = currentLessonAmount,
|
||||
onValueChange = {
|
||||
currentLessonAmount = it
|
||||
if (currentLessonAmount == "") {
|
||||
editor.putInt("lessonAmount${listOfDays[state]}", 0)
|
||||
}
|
||||
else {
|
||||
editor.putInt("lessonAmount${listOfDays[state]}", currentLessonAmount.toInt())
|
||||
}
|
||||
},
|
||||
label = { Text(text = "Anzahl der Schulstunden (${listOfDays[state]})") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword)
|
||||
)
|
||||
|
||||
if (currentLessonAmount != "") {
|
||||
for (i in lessons.size until currentLessonAmount.toInt()) {
|
||||
lessons = lessons + LessonData("", "", "")
|
||||
}
|
||||
1 -> {
|
||||
Text(text = "Dienstag")
|
||||
while (currentLessonAmount.toInt() < lessons.size) {
|
||||
lessons = lessons.drop(1)
|
||||
}
|
||||
2 -> {
|
||||
Text(text = "Mittwoch")
|
||||
}
|
||||
3 -> {
|
||||
Text(text = "Donnerstag")
|
||||
}
|
||||
4 -> {
|
||||
Text(text = "Freitag")
|
||||
}
|
||||
}
|
||||
Row () {
|
||||
Text(
|
||||
text = "Setup beendet? ",
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
lessons.forEachIndexed() { index, lessonData ->
|
||||
var currentSubject by remember {
|
||||
mutableStateOf(lessonData.subject)
|
||||
}
|
||||
var currentTeacher by remember {
|
||||
mutableStateOf(lessonData.teacher)
|
||||
}
|
||||
var currentRoom by remember {
|
||||
mutableStateOf(lessonData.room)
|
||||
}
|
||||
OutlinedTextField(
|
||||
value = currentSubject,
|
||||
onValueChange = {
|
||||
currentSubject = it
|
||||
lessonData.subject = it
|
||||
saveLessonsUsage(activity, lessons, state)
|
||||
},
|
||||
label = { Text(text = "Fach der ${index + 1}. Stunde") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
)
|
||||
Checkbox(checked = setupDone, onCheckedChange = {setupDone = !setupDone})
|
||||
OutlinedTextField(
|
||||
value = currentTeacher,
|
||||
onValueChange = {
|
||||
currentTeacher = it
|
||||
lessonData.teacher = it
|
||||
saveLessonsUsage(activity, lessons, state)
|
||||
},
|
||||
label = { Text(text = "Lehrer der ${index + 1}. Stunde") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = currentRoom,
|
||||
onValueChange = {
|
||||
currentRoom = it
|
||||
lessonData.room = it
|
||||
saveLessonsUsage(activity, lessons, state)
|
||||
},
|
||||
label = { Text(text = "Raum der ${index + 1}. Stunde") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
shape = RoundedCornerShape(20),
|
||||
textStyle = MaterialTheme.typography.labelMedium,
|
||||
colors = inputFieldColors,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
if (state == 4) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(2.dp)
|
||||
.fillMaxWidth()
|
||||
.background(color = MaterialTheme.colorScheme.onPrimaryContainer)
|
||||
)
|
||||
|
||||
Row () {
|
||||
Text(
|
||||
text = "Ertes Setup beendet?",
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
Checkbox(checked = setupDone, onCheckedChange = {setupDone = !setupDone})
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
FilledTonalButton(
|
||||
onClick = {
|
||||
activity.finish()
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "TimeSetup")
|
||||
if (state == 0) {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "TimeSetup")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
else {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "DaySetup")
|
||||
putExtra(TimeTableSetupActivity.STATE_KEY, "${state - 1}")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
@@ -461,16 +567,25 @@ fun TimeTableSetupContent(activity: ComponentActivity){
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
editor.putBoolean("setupDone", setupDone)
|
||||
editor.apply()
|
||||
activity.finish()
|
||||
if (state != 4) {
|
||||
val intent = Intent(activity, TimeTableSetupActivity::class.java).apply {
|
||||
putExtra(TimeTableSetupActivity.TYPE_KEY, "DaySetup")
|
||||
putExtra(TimeTableSetupActivity.STATE_KEY, "${state + 1}")
|
||||
}
|
||||
startActivity(activity, intent, null)
|
||||
}
|
||||
else {
|
||||
editor.putBoolean("setupDone", setupDone)
|
||||
}
|
||||
editor.apply()
|
||||
},
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = "Speichern",
|
||||
text = "Weiter",
|
||||
style = MaterialTheme.typography.labelMedium
|
||||
)
|
||||
}
|
||||
@@ -548,4 +663,10 @@ fun TestButton(text: String, onClick: ()-> Unit){
|
||||
Button(onClick = onClick,) {
|
||||
Text(text = text)
|
||||
}
|
||||
}
|
||||
|
||||
fun saveLessonsUsage(context: Context, lessons: List<LessonData>, int: Int) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
saveLessons(context, lessons, listOfDays[int])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user