made the AMOLED mode work
This commit is contained in:
@@ -46,6 +46,7 @@ import com.odweta.solon.ui.theme.PastelRed
|
|||||||
import com.odweta.solon.ui.theme.PastelRedTransparent
|
import com.odweta.solon.ui.theme.PastelRedTransparent
|
||||||
import com.odweta.solon.ui.theme.PastelYellow
|
import com.odweta.solon.ui.theme.PastelYellow
|
||||||
import com.odweta.solon.ui.theme.PastelYellowTransparent
|
import com.odweta.solon.ui.theme.PastelYellowTransparent
|
||||||
|
import kotlin.math.round
|
||||||
|
|
||||||
enum class MarksShow {
|
enum class MarksShow {
|
||||||
All,
|
All,
|
||||||
@@ -114,6 +115,64 @@ fun MarksAll() {
|
|||||||
.verticalScroll(scrollState)
|
.verticalScroll(scrollState)
|
||||||
) {
|
) {
|
||||||
for ((subject, markList) in marks) {
|
for ((subject, markList) in marks) {
|
||||||
|
val amoledModifier = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Modifier
|
||||||
|
.width(150.dp)
|
||||||
|
.fillMaxHeight()
|
||||||
|
.border(
|
||||||
|
width = borderWidthDimen,
|
||||||
|
color = getAvgColor(Util.avg(markList), true), // decide on the color (transparent)
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
.width(150.dp)
|
||||||
|
.fillMaxHeight()
|
||||||
|
.background(
|
||||||
|
color = getAvgColor(Util.avg(markList)), // decide on the color (not transparent)
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val amoledModifierBackground = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(70.dp)
|
||||||
|
.border(
|
||||||
|
width = borderWidthDimen,
|
||||||
|
color = getAvgColor(Util.avg(markList), true), // decide on the color (transparent)
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
|
.clickable {
|
||||||
|
marksShow.value = MarksShow.Subject
|
||||||
|
subjectToShow = subject
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(70.dp)
|
||||||
|
.background(
|
||||||
|
color = getAvgColor(Util.avg(markList)), // decide on the color (transparent)
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
|
.clickable {
|
||||||
|
marksShow.value = MarksShow.Subject
|
||||||
|
subjectToShow = subject
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val amoledSpacerModifier = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Modifier
|
||||||
|
.width(10.dp)
|
||||||
|
.fillMaxHeight()
|
||||||
|
.background(getAvgColor(Util.avg(markList)))
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
.width(10.dp)
|
||||||
|
.fillMaxHeight()
|
||||||
|
.background(Color.Black)
|
||||||
|
}
|
||||||
|
|
||||||
var marksString = ""
|
var marksString = ""
|
||||||
for (m in 0 until markList.size-1) {
|
for (m in 0 until markList.size-1) {
|
||||||
if (markList[m].grade in "0123456789") {
|
if (markList[m].grade in "0123456789") {
|
||||||
@@ -127,26 +186,10 @@ fun MarksAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = amoledModifierBackground
|
||||||
.fillMaxWidth()
|
|
||||||
.height(70.dp)
|
|
||||||
.background(
|
|
||||||
color = getAvgColor(Util.avg(markList)), // decide on the color (transparent)
|
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
|
||||||
)
|
|
||||||
.clickable {
|
|
||||||
marksShow.value = MarksShow.Subject
|
|
||||||
subjectToShow = subject
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = amoledModifier,
|
||||||
.width(150.dp)
|
|
||||||
.fillMaxHeight()
|
|
||||||
.background(
|
|
||||||
color = getAvgColor(Util.avg(markList)), // decide on the color (not transparent)
|
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
|
||||||
),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Center
|
horizontalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
@@ -161,10 +204,7 @@ fun MarksAll() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = amoledSpacerModifier
|
||||||
.width(10.dp)
|
|
||||||
.fillMaxHeight()
|
|
||||||
.background(Color.Black)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val currAvg = Util.avg(markList).replace(".", ",")
|
val currAvg = Util.avg(markList).replace(".", ",")
|
||||||
@@ -257,10 +297,14 @@ fun MarksSubject() {
|
|||||||
),
|
),
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.background(
|
.background(color = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Color.Black
|
||||||
|
} else {
|
||||||
getAvgColor(
|
getAvgColor(
|
||||||
Util.avg(marks[subjectToShow]!!)
|
Util.avg(marks[subjectToShow]!!)
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.padding(vertical = 15.dp),
|
.padding(vertical = 15.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
@@ -281,7 +325,6 @@ fun MarksSubject() {
|
|||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
|
||||||
//Box(modifier = Modifier.height(100.dp)) {
|
|
||||||
Text(
|
Text(
|
||||||
text = subjectNameMap[subjectToShow]!!,
|
text = subjectNameMap[subjectToShow]!!,
|
||||||
color = Color.White,
|
color = Color.White,
|
||||||
@@ -294,10 +337,15 @@ fun MarksSubject() {
|
|||||||
color = PastelYellow,
|
color = PastelYellow,
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.background(PastelYellowTransparent)
|
.background(color = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Color.Black
|
||||||
|
} else {
|
||||||
|
PastelYellowTransparent
|
||||||
|
},
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
.padding(vertical = 20.dp)
|
.padding(vertical = 20.dp)
|
||||||
) // subject
|
) // subject
|
||||||
//}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
|
||||||
@@ -311,8 +359,14 @@ fun MarksSubject() {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 5.dp)
|
.padding(horizontal = 5.dp)
|
||||||
.background(
|
.background(color = if (settingsData.useAmoledMode.checked.value) {
|
||||||
color = getAvgColor(mark.grade),
|
Color.Black
|
||||||
|
} else {
|
||||||
|
getAvgColor(
|
||||||
|
Util.avg(marks[subjectToShow]!!)
|
||||||
|
)
|
||||||
|
|
||||||
|
},
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.padding(vertical = 10.dp)
|
.padding(vertical = 10.dp)
|
||||||
@@ -411,9 +465,13 @@ fun MarksDetail() {
|
|||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.background(
|
.background(
|
||||||
|
if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Color.Black
|
||||||
|
} else {
|
||||||
getAvgColor(
|
getAvgColor(
|
||||||
Util.avg(marks[subjectToShow]!!)
|
Util.avg(marks[subjectToShow]!!)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.padding(vertical = 15.dp),
|
.padding(vertical = 15.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
@@ -443,7 +501,12 @@ fun MarksDetail() {
|
|||||||
color = PastelYellow,
|
color = PastelYellow,
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.background(PastelYellowTransparent)
|
.background(if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Color.Black
|
||||||
|
} else {
|
||||||
|
PastelYellowTransparent
|
||||||
|
}
|
||||||
|
)
|
||||||
.padding(vertical = 20.dp)
|
.padding(vertical = 20.dp)
|
||||||
) // description
|
) // description
|
||||||
//}
|
//}
|
||||||
@@ -456,7 +519,11 @@ fun MarksDetail() {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 5.dp)
|
.padding(horizontal = 5.dp)
|
||||||
.background(
|
.background(
|
||||||
color = PastelYellowTransparent,
|
color = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Color.Black
|
||||||
|
} else {
|
||||||
|
PastelYellowTransparent
|
||||||
|
},
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.padding(vertical = 20.dp, horizontal = 10.dp)
|
.padding(vertical = 20.dp, horizontal = 10.dp)
|
||||||
@@ -495,7 +562,11 @@ fun MarksDetail() {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 5.dp)
|
.padding(horizontal = 5.dp)
|
||||||
.background(
|
.background(
|
||||||
color = PastelYellowTransparent,
|
color = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Color.Black
|
||||||
|
} else {
|
||||||
|
PastelYellowTransparent
|
||||||
|
},
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
.padding(vertical = 20.dp, horizontal = 10.dp)
|
.padding(vertical = 20.dp, horizontal = 10.dp)
|
||||||
|
|||||||
@@ -170,17 +170,28 @@ fun subjectModifier(d: Day, s: Subject, lectureNumber: Int): Modifier {
|
|||||||
currentLectureNumber = lectureNumber
|
currentLectureNumber = lectureNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
val m = Modifier
|
val m = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(70.dp)
|
||||||
|
.border(
|
||||||
|
width = borderWidthDimen,
|
||||||
|
color = getSubjectColor(s, false), // decide on the color (transparent)
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(70.dp)
|
.height(70.dp)
|
||||||
.background(
|
.background(
|
||||||
color = getSubjectColor(s, true), // decide on the color (transparent)
|
color = getSubjectColor(s, true), // decide on the color (transparent)
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return if (lectureNumber == currentLectureNumber && dateParsed == todayDate) {
|
return if (lectureNumber == currentLectureNumber && dateParsed == todayDate) {
|
||||||
m.border(
|
m.border(
|
||||||
width = 5.dp,
|
width = borderWidthDimen,
|
||||||
color = getSubjectColor(s, false),
|
color = getSubjectColor(s, false),
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
)
|
)
|
||||||
@@ -220,6 +231,31 @@ private fun DayScreen(day: Day) {
|
|||||||
.verticalScroll(scrollState)
|
.verticalScroll(scrollState)
|
||||||
) {
|
) {
|
||||||
for (subject in day.subjects) {
|
for (subject in day.subjects) {
|
||||||
|
val amoledModifier = if (settingsData.useAmoledMode.checked.value) {
|
||||||
|
Modifier
|
||||||
|
.width(50.dp)
|
||||||
|
.fillMaxHeight()
|
||||||
|
.border(
|
||||||
|
width = borderWidthDimen,
|
||||||
|
color = getSubjectColor(
|
||||||
|
subject,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
.width(50.dp)
|
||||||
|
.fillMaxHeight()
|
||||||
|
.background(
|
||||||
|
color = getSubjectColor(
|
||||||
|
subject,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (day.subjects.indexOf(subject) > 0) {
|
if (day.subjects.indexOf(subject) > 0) {
|
||||||
Box(modifier = Modifier.height(10.dp)) {
|
Box(modifier = Modifier.height(10.dp)) {
|
||||||
if (subject.name == day.subjects[day.subjects.indexOf(subject) - 1].name) {
|
if (subject.name == day.subjects[day.subjects.indexOf(subject) - 1].name) {
|
||||||
@@ -241,16 +277,7 @@ private fun DayScreen(day: Day) {
|
|||||||
) {
|
) {
|
||||||
if (subject.substitute != "2") {
|
if (subject.substitute != "2") {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = amoledModifier,
|
||||||
.width(50.dp)
|
|
||||||
.fillMaxHeight()
|
|
||||||
.background(
|
|
||||||
color = getSubjectColor(
|
|
||||||
subject,
|
|
||||||
true
|
|
||||||
), // decide on the color (not transparent)
|
|
||||||
shape = RoundedCornerShape(roundedCornerDimen)
|
|
||||||
),
|
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
Reference in New Issue
Block a user