Compare commits

...

2 Commits

Author SHA1 Message Date
matthias
15cadb76c6 Minor appearance adjustments
added scaling with 1.1f(lesson indexes & "Pause") / 0.8f(times)
2024-06-09 13:22:00 +02:00
matthias
41b54f15ea Major Bugfix
fixed removal of lessons
2024-06-09 13:20:31 +02:00
2 changed files with 14 additions and 6 deletions

View File

@@ -39,6 +39,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat.startActivity import androidx.core.content.ContextCompat.startActivity
@@ -212,7 +213,7 @@ fun StundenplanContent(activity: ComponentActivity, loadedLessons: List<List<Les
) )
} }
//Else creation of a Box containing all the information from the LessonData object //Else creation of a Box containing all the information from the LessonData object
else if (dailyLessons != emptyList<LessonData>()) { else if (dailyLessons != emptyList<LessonData>() && dailyLessons.size != extraIndex) {
LessonBox(subject = dailyLessons[extraIndex].subject, teacher = dailyLessons[extraIndex].teacher, room = dailyLessons[extraIndex].room) LessonBox(subject = dailyLessons[extraIndex].subject, teacher = dailyLessons[extraIndex].teacher, room = dailyLessons[extraIndex].room)
//ExtraIndex counted up only here as it does only index the lessons and NOT the breaks //ExtraIndex counted up only here as it does only index the lessons and NOT the breaks
extraIndex++ extraIndex++
@@ -371,7 +372,9 @@ fun InfoColumn(loadedLessons: List<List<LessonData>>, breakAmnt: Int, breaksStar
) { ) {
//"Pause" String instead of indexing //"Pause" String instead of indexing
Text( Text(
modifier = Modifier.align(Alignment.Center), modifier = Modifier
.align(Alignment.Center)
.scale(1.1f),
text = "Pause", text = "Pause",
textDecoration = TextDecoration.Underline, textDecoration = TextDecoration.Underline,
style = MaterialTheme.typography.labelLarge style = MaterialTheme.typography.labelLarge
@@ -380,7 +383,8 @@ fun InfoColumn(loadedLessons: List<List<LessonData>>, breakAmnt: Int, breaksStar
Text( Text(
modifier = Modifier modifier = Modifier
.align(Alignment.BottomCenter) .align(Alignment.BottomCenter)
.padding(3.dp), .padding(3.dp)
.scale(0.8f),
text = formattedBreakTime, text = formattedBreakTime,
style = MaterialTheme.typography.labelMedium style = MaterialTheme.typography.labelMedium
) )
@@ -407,7 +411,9 @@ fun InfoColumn(loadedLessons: List<List<LessonData>>, breakAmnt: Int, breaksStar
) { ) {
//String with the indexing of the lessons //String with the indexing of the lessons
Text( Text(
modifier = Modifier.align(Alignment.Center), modifier = Modifier
.align(Alignment.Center)
.scale(1.1f),
text = "${i + 1 - lessonNegIncrement}:", text = "${i + 1 - lessonNegIncrement}:",
textDecoration = TextDecoration.Underline, textDecoration = TextDecoration.Underline,
style = MaterialTheme.typography.labelLarge style = MaterialTheme.typography.labelLarge
@@ -416,7 +422,8 @@ fun InfoColumn(loadedLessons: List<List<LessonData>>, breakAmnt: Int, breaksStar
Text( Text(
modifier = Modifier modifier = Modifier
.align(Alignment.BottomCenter) .align(Alignment.BottomCenter)
.padding(3.dp), .padding(3.dp)
.scale(0.8f),
text = substringHelper(extraIndex, firstLesson, lessonLength, lessonTimeIncrement), text = substringHelper(extraIndex, firstLesson, lessonLength, lessonTimeIncrement),
style = MaterialTheme.typography.labelMedium style = MaterialTheme.typography.labelMedium
) )

View File

@@ -492,7 +492,7 @@ fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<Lesso
lessons = lessons + LessonData("", "", "") lessons = lessons + LessonData("", "", "")
} }
while (currentLessonAmount.toInt() < lessons.size) { while (currentLessonAmount.toInt() < lessons.size) {
lessons = lessons.drop(1) lessons = lessons.dropLast(1)
} }
lessons.forEachIndexed { index, lessonData -> lessons.forEachIndexed { index, lessonData ->
@@ -555,6 +555,7 @@ fun TimeTableSetupContent(activity: ComponentActivity, loadedLessons: List<Lesso
colors = inputFieldColors, colors = inputFieldColors,
) )
} }
saveLessonsUsage(activity, lessons, state)
} }
//save an empty list into DataStore currentLessonAmount == 0 //save an empty list into DataStore currentLessonAmount == 0
else { else {