fixed colors in MarksSubject and tagged new marks
This commit is contained in:
@@ -20,7 +20,9 @@ import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Adjust
|
||||
import androidx.compose.material.icons.filled.ArrowBackIosNew
|
||||
import androidx.compose.material.icons.filled.AutoAwesome
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Icon
|
||||
@@ -45,6 +47,8 @@ import com.odweta.solon.ui.theme.PastelRed
|
||||
import com.odweta.solon.ui.theme.PastelRedTransparent
|
||||
import com.odweta.solon.ui.theme.PastelYellow
|
||||
import com.odweta.solon.ui.theme.PastelYellowTransparent
|
||||
import java.time.LocalDate
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
enum class MarksShow {
|
||||
All,
|
||||
@@ -183,6 +187,16 @@ fun MarksAll() {
|
||||
Box(modifier = Modifier.height(10.dp))
|
||||
}
|
||||
|
||||
// only add if mark date is not older than one week
|
||||
var subjectContainsNewMark = false
|
||||
for (mark in markList) {
|
||||
if (LocalDate.parse(mark.date, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||
.isAfter(LocalDate.now().minusWeeks(1))
|
||||
) {
|
||||
subjectContainsNewMark = true
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = amoledModifierBackground
|
||||
) {
|
||||
@@ -221,17 +235,30 @@ fun MarksAll() {
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxHeight()
|
||||
.padding(horizontal = 10.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
modifier = Modifier.fillMaxSize().weight(1f),
|
||||
contentAlignment = Alignment.TopStart
|
||||
) {
|
||||
Text(
|
||||
text = marksString,
|
||||
fontSize = 22.sp,
|
||||
color = Color.White
|
||||
)
|
||||
if (subjectContainsNewMark) {
|
||||
Icon(
|
||||
modifier = Modifier.padding(start = 4.dp, top = 4.dp),
|
||||
imageVector = Icons.Default.AutoAwesome,
|
||||
contentDescription = "New marks in subject",
|
||||
tint = Color.White // You can customize the icon color
|
||||
)
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 10.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = marksString,
|
||||
fontSize = 22.sp,
|
||||
color = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,50 +380,62 @@ fun MarksSubject() {
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 5.dp)
|
||||
.background(color = if (settings.useAmoledMode.checked.value) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
contentAlignment = Alignment.TopStart
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 5.dp)
|
||||
.background(color = if (settings.useAmoledMode.checked.value) {
|
||||
Color.Black
|
||||
} else {
|
||||
getAvgColor(
|
||||
Util.avg(marks[subjectToShow]!!)
|
||||
)
|
||||
|
||||
getAvgColor(mark.grade)
|
||||
},
|
||||
shape = RoundedCornerShape(roundedCornerDimen)
|
||||
)
|
||||
.padding(vertical = 10.dp)
|
||||
.clickable {
|
||||
markToShow = mark
|
||||
marksShow.value = MarksShow.Detail
|
||||
}
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(70.dp)
|
||||
.align(Alignment.CenterVertically),
|
||||
contentAlignment = Alignment.Center
|
||||
shape = RoundedCornerShape(roundedCornerDimen)
|
||||
)
|
||||
.padding(vertical = 10.dp)
|
||||
.clickable {
|
||||
markToShow = mark
|
||||
marksShow.value = MarksShow.Detail
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = mark.grade,
|
||||
color = Color.White,
|
||||
fontSize = 30.sp
|
||||
) // grade
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(70.dp)
|
||||
.align(Alignment.CenterVertically),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = mark.grade,
|
||||
color = Color.White,
|
||||
fontSize = 30.sp
|
||||
) // grade
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterVertically)
|
||||
.weight(1f),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Text(
|
||||
text = mark.theme,
|
||||
color = Color.White,
|
||||
fontSize = 20.sp
|
||||
) // theme
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterVertically)
|
||||
.weight(1f),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Text(
|
||||
text = mark.theme,
|
||||
color = Color.White,
|
||||
fontSize = 20.sp
|
||||
) // theme
|
||||
// only add if mark date is not older than one week
|
||||
if (LocalDate.parse(mark.date, DateTimeFormatter.ISO_LOCAL_DATE_TIME).isAfter(LocalDate.now().minusWeeks(1))) {
|
||||
Icon(
|
||||
modifier = Modifier.padding(start = 7.dp, top = 4.dp),
|
||||
imageVector = Icons.Default.AutoAwesome,
|
||||
contentDescription = "A new mark",
|
||||
tint = Color.White // You can customize the icon color
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -486,28 +525,26 @@ fun MarksDetail() {
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
|
||||
Row {
|
||||
//Box(modifier = Modifier.height(70.dp)) {
|
||||
Text(
|
||||
text = markToShow.theme,
|
||||
color = Color.White,
|
||||
textAlign = TextAlign.Center,
|
||||
fontSize = 30.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.border(
|
||||
width = 5.dp,
|
||||
color = PastelYellow,
|
||||
shape = RoundedCornerShape(roundedCornerDimen)
|
||||
)
|
||||
.background(if (settings.useAmoledMode.checked.value) {
|
||||
Color.Black
|
||||
} else {
|
||||
PastelYellowTransparent
|
||||
}
|
||||
)
|
||||
.padding(vertical = 20.dp)
|
||||
) // description
|
||||
//}
|
||||
Text(
|
||||
text = markToShow.theme,
|
||||
color = Color.White,
|
||||
textAlign = TextAlign.Center,
|
||||
fontSize = 30.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.border(
|
||||
width = 5.dp,
|
||||
color = PastelYellow,
|
||||
shape = RoundedCornerShape(roundedCornerDimen)
|
||||
)
|
||||
.background(if (settings.useAmoledMode.checked.value) {
|
||||
Color.Black
|
||||
} else {
|
||||
PastelYellowTransparent
|
||||
}
|
||||
)
|
||||
.padding(vertical = 20.dp)
|
||||
) // description
|
||||
} // description
|
||||
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
|
||||
Reference in New Issue
Block a user