quality of life fixes

made the toolbar font size adaptively large relative to the user's name length, shrunk down the height of subjects and marks and made back gestures work properly - not close the app but show the previous screen
This commit is contained in:
Odweta
2024-11-08 18:09:55 +01:00
parent 8a4956e6c6
commit d3197111c3
9 changed files with 324 additions and 259 deletions
@@ -1,5 +1,6 @@
package com.odweta.solon
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@@ -36,6 +37,11 @@ import java.time.format.TextStyle
@Composable
fun AboutScreen(modifier: Modifier = Modifier) {
// handle the back gesture (back swipe form side or back button on bottom android navbar)
BackHandler {
isShowing.value = IsShowing.Menu
}
Column(
modifier = Modifier
.fillMaxSize(),
@@ -60,13 +66,13 @@ fun AboutScreen(modifier: Modifier = Modifier) {
shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow
)
.width(100.dp)
.height(100.dp)
.width(70.dp)
.height(70.dp)
) {
Icon(
imageVector = Icons.Default.ArrowBackIosNew, // Replace with your desired icon
imageVector = Icons.Default.ArrowBackIosNew,
contentDescription = "Back icon",
modifier = Modifier.size(35.dp) // Adjust size if needed
modifier = Modifier.size(40.dp)
)
}
}
@@ -15,6 +15,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.core.view.WindowCompat
import com.odweta.solon.ui.theme.SolonTheme
import kotlin.math.sign
+152 -124
View File
@@ -1,5 +1,6 @@
package com.odweta.solon
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@@ -37,6 +38,8 @@ import androidx.compose.ui.unit.sp
import com.odweta.solon.ui.theme.PastelGreen
import com.odweta.solon.ui.theme.PastelGreenTransparent
import com.odweta.solon.ui.theme.PastelOrange
import com.odweta.solon.ui.theme.PastelOrangeDark
import com.odweta.solon.ui.theme.PastelOrangeDarkTransparent
import com.odweta.solon.ui.theme.PastelOrangeTransparent
import com.odweta.solon.ui.theme.PastelRed
import com.odweta.solon.ui.theme.PastelRedTransparent
@@ -63,25 +66,31 @@ fun MarksScreen() {
}
private fun getAvgColor(avg: String, isBorder: Boolean = false): Color {
val aux = avg.replace(",", ".").toFloat().toInt()
return if (aux in 1..<2) {
val aux = avg.replace(",", ".").toFloat()
return if (aux in 1f..<1.5f) {
if (isBorder) {
PastelGreen
} else {
PastelGreenTransparent
}
} else if (aux in 2..<3) {
} else if (aux in 1.5f..<2.5f) {
if (isBorder) {
PastelYellow
} else {
PastelYellowTransparent
}
} else if (aux in 3..<4) {
} else if (aux in 2.5f..<3.5f) {
if (isBorder) {
PastelOrange
} else {
PastelOrangeTransparent
}
} else if (aux in 3.5f..<4.5f) {
if (isBorder) {
PastelOrangeDark
} else {
PastelOrangeDarkTransparent
}
} else {
if (isBorder) {
PastelRed
@@ -119,7 +128,7 @@ fun MarksAll() {
Row(
modifier = Modifier
.fillMaxWidth()
.height(100.dp)
.height(70.dp)
.background(
color = getAvgColor(Util.avg(markList)), // decide on the color (transparent)
shape = RoundedCornerShape(roundedCornerDimen)
@@ -131,7 +140,7 @@ fun MarksAll() {
) {
Row(
modifier = Modifier
.width(210.dp)
.width(150.dp)
.fillMaxHeight()
.background(
color = getAvgColor(Util.avg(markList)), // decide on the color (not transparent)
@@ -142,12 +151,12 @@ fun MarksAll() {
) {
Text(
text = subject.uppercase(),
fontSize = 35.sp,
fontSize = 30.sp,
color = Color.White,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
modifier = Modifier
.width(100.dp)
.width(70.dp)
)
Box(
@@ -159,18 +168,19 @@ fun MarksAll() {
Text(
text = Util.avg(markList).replace(".", ","),
fontSize = 30.sp,
fontSize = 28.sp,
color = Color.White,
textAlign = TextAlign.Center,
modifier = Modifier
.width(100.dp)
.width(70.dp)
)
}
Box(
modifier = Modifier
.weight(1f)
.fillMaxHeight(),
.fillMaxHeight()
.padding(horizontal = 10.dp),
contentAlignment = Alignment.Center
) {
Text(
@@ -186,6 +196,11 @@ fun MarksAll() {
@Composable
fun MarksSubject() {
// handle the back gesture (back swipe form side or back button on bottom android navbar)
BackHandler {
marksShow.value = MarksShow.All
}
val scrollState = rememberScrollState()
Column(
@@ -195,33 +210,67 @@ fun MarksSubject() {
.fillMaxWidth()
.padding(horizontal = 5.dp)
) {
Button(
onClick = {
marksShow.value = MarksShow.All
},
colors = ButtonDefaults.buttonColors(
contentColor = Color.White,
containerColor = Color.Black
),
modifier = Modifier
.border(
width = 5.dp,
shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow
)
.width(100.dp)
.height(100.dp)
Row(
modifier = Modifier.fillMaxWidth()
) {
Icon(
imageVector = Icons.Default.ArrowBackIosNew, // Replace with your desired icon
contentDescription = "Back icon",
modifier = Modifier.size(35.dp) // Adjust size if needed
)
Button(
onClick = {
marksShow.value = MarksShow.All
},
colors = ButtonDefaults.buttonColors(
contentColor = Color.White,
containerColor = Color.Black
),
modifier = Modifier
.border(
width = 5.dp,
shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow
)
.width(70.dp)
.height(70.dp)
) {
Icon(
imageVector = Icons.Default.ArrowBackIosNew,
contentDescription = "Back icon",
modifier = Modifier.size(40.dp)
)
}
Box(modifier = Modifier.weight(1f))
Box(
modifier = Modifier
.width(70.dp)
.height(70.dp)
.border(
width = 5.dp,
color = getAvgColor(
Util.avg(marks[subjectToShow]!!),
true
),
shape = RoundedCornerShape(roundedCornerDimen)
)
.background(
getAvgColor(
Util.avg(marks[subjectToShow]!!)
)
)
.padding(vertical = 15.dp),
contentAlignment = Alignment.Center
) {
Text(
text = Util.avg(marks[subjectToShow]!!).replace(".", ","),
color = Color.White,
textAlign = TextAlign.Center,
fontSize = 25.sp
) // average
}
}
Spacer(modifier = Modifier.height(20.dp))
Box(modifier = Modifier.height(100.dp)) {
//Box(modifier = Modifier.height(100.dp)) {
Text(
text = subjectNameMap[subjectToShow]!!,
color = Color.White,
@@ -237,36 +286,7 @@ fun MarksSubject() {
.background(PastelYellowTransparent)
.padding(vertical = 20.dp)
) // subject
}
Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center
) {
Text(
text = Util.avg(marks[subjectToShow]!!).replace(".", ","),
color = Color.White,
textAlign = TextAlign.Center,
fontSize = 30.sp,
modifier = Modifier
.width(100.dp)
.height(100.dp)
.border(
width = 5.dp,
color = getAvgColor(
Util.avg(marks[subjectToShow]!!),
true
),
shape = RoundedCornerShape(roundedCornerDimen)
)
.background(
getAvgColor(
Util.avg(marks[subjectToShow]!!)
)
)
.padding(vertical = 32.5.dp)
) // average
}
//}
Spacer(modifier = Modifier.height(20.dp))
@@ -284,7 +304,7 @@ fun MarksSubject() {
color = getAvgColor(mark.grade),
shape = RoundedCornerShape(roundedCornerDimen)
)
.padding(vertical = 20.dp)
.padding(vertical = 10.dp)
.clickable {
markToShow = mark
marksShow.value = MarksShow.Detail
@@ -292,7 +312,7 @@ fun MarksSubject() {
) {
Box(
modifier = Modifier
.width(100.dp)
.width(70.dp)
.align(Alignment.CenterVertically),
contentAlignment = Alignment.Center
) {
@@ -312,7 +332,7 @@ fun MarksSubject() {
Text(
text = mark.theme,
color = Color.White,
fontSize = 23.sp
fontSize = 20.sp
) // theme
}
}
@@ -323,6 +343,11 @@ fun MarksSubject() {
@Composable
fun MarksDetail() {
// handle the back gesture (back swipe form side or back button on bottom android navbar)
BackHandler {
marksShow.value = MarksShow.Subject
}
val scrollState = rememberScrollState()
Column(
@@ -333,34 +358,68 @@ fun MarksDetail() {
.padding(horizontal = 5.dp)
.verticalScroll(scrollState)
) {
Button(
onClick = {
marksShow.value = MarksShow.Subject
},
colors = ButtonDefaults.buttonColors(
contentColor = Color.White,
containerColor = Color.Black
),
modifier = Modifier
.border(
width = 5.dp,
shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow
)
.width(100.dp)
.height(100.dp)
Row(
modifier = Modifier.fillMaxWidth()
) {
Icon(
imageVector = Icons.Default.ArrowBackIosNew, // Replace with your desired icon
contentDescription = "Back icon",
modifier = Modifier.size(35.dp) // Adjust size if needed
)
Button(
onClick = {
marksShow.value = MarksShow.Subject
},
colors = ButtonDefaults.buttonColors(
contentColor = Color.White,
containerColor = Color.Black
),
modifier = Modifier
.border(
width = 5.dp,
shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow
)
.width(70.dp)
.height(70.dp)
) {
Icon(
imageVector = Icons.Default.ArrowBackIosNew,
contentDescription = "Back icon",
modifier = Modifier.size(40.dp)
)
}
Box(modifier = Modifier.weight(1f))
Box(
modifier = Modifier
.width(70.dp)
.height(70.dp)
.border(
width = 5.dp,
color = getAvgColor(
Util.avg(marks[subjectToShow]!!),
true
),
shape = RoundedCornerShape(roundedCornerDimen)
)
.background(
getAvgColor(
Util.avg(marks[subjectToShow]!!)
)
)
.padding(vertical = 15.dp),
contentAlignment = Alignment.Center
) {
Text(
text = markToShow.grade,
color = Color.White,
textAlign = TextAlign.Center,
fontSize = 25.sp
) // average
}
}
Spacer(modifier = Modifier.height(20.dp))
Row {
Box(modifier = Modifier.height(100.dp)) {
//Box(modifier = Modifier.height(70.dp)) {
Text(
text = markToShow.theme,
color = Color.White,
@@ -376,40 +435,9 @@ fun MarksDetail() {
.background(PastelYellowTransparent)
.padding(vertical = 20.dp)
) // description
}
//}
} // description
Row {
Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center
) {
Text(
text = markToShow.grade,
color = Color.White,
textAlign = TextAlign.Center,
fontSize = 35.sp,
modifier = Modifier
.width(100.dp)
.height(100.dp)
.border(
width = 5.dp,
color = getAvgColor(
Util.avg(mutableListOf(markToShow)),
true
),
shape = RoundedCornerShape(roundedCornerDimen)
)
.background(
getAvgColor(
Util.avg(mutableListOf(markToShow))
)
)
.padding(vertical = 32.5.dp)
) // average
}
} // grade
Spacer(modifier = Modifier.height(20.dp))
Row(
@@ -431,7 +459,7 @@ fun MarksDetail() {
Text(
text = "Váha:",
color = Color.White,
fontSize = 30.sp
fontSize = 20.sp
)
}
@@ -444,7 +472,7 @@ fun MarksDetail() {
Text(
text = markToShow.weight.replace(".", ","),
color = Color.White,
fontSize = 23.sp
fontSize = 20.sp
)
}
} // weight
@@ -470,7 +498,7 @@ fun MarksDetail() {
Text(
text = "Datum:",
color = Color.White,
fontSize = 30.sp
fontSize = 20.sp
)
}
@@ -489,7 +517,7 @@ fun MarksDetail() {
Text(
text = date,
color = Color.White,
fontSize = 23.sp
fontSize = 20.sp
)
}
} // date
@@ -112,7 +112,7 @@ fun MenuScreen(modifier: Modifier = Modifier) {
Text("Ne")
}
}
) // TODO: THEME DIALOG
)
}
Button(onClick = {
@@ -2,20 +2,20 @@ package com.odweta.solon
import android.content.Context
import android.widget.Toast
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
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.Visibility
import androidx.compose.material.icons.filled.VisibilityOff
@@ -106,112 +106,112 @@ fun signInButtonCallback(ctx: Context, coscope: CoroutineScope, buttonText: Stri
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SignInScreen() {
// handle the back gesture (back swipe form side or back button on bottom android navbar)
BackHandler {
screenToShow.value = Screen.Main
}
var usernameText by remember { mutableStateOf("") }
var passwordText by remember { mutableStateOf("") }
val ctx = LocalContext.current
val coscope = rememberCoroutineScope()
var isPasswordVisible by remember { mutableStateOf(false) } // State for visibility toggle
val visualTransformation = if (isPasswordVisible) VisualTransformation.None else PasswordVisualTransformation()
val scrollState = rememberScrollState()
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
Column(
modifier = Modifier
.fillMaxWidth()
.background(Color.Black)
.imePadding(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Column(
// TODO: squishable sign in layout
Image(
painter = painterResource(R.drawable.solon_just_yellow),
contentDescription = "Solon logo",
modifier = Modifier.size(200.dp)
)
TextField(
value = usernameText,
onValueChange = { input -> usernameText = input },
modifier = Modifier
.fillMaxSize()
.background(Color.Black)
.verticalScroll(scrollState),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Image(
painter = painterResource(R.drawable.solon_just_yellow),
contentDescription = "Solon logo",
modifier = Modifier.size(230.dp)
)
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
roundedCornerDimen))
.width(230.dp),
colors = TextFieldDefaults.colors(
focusedTextColor = Color.White, // White text
unfocusedTextColor = Color.White, // White text when not focused
focusedContainerColor = Color.Black, // Black background when focused
unfocusedContainerColor = Color.Black, // Black background when not focused
cursorColor = PastelYellow, // Yellow cursor
focusedIndicatorColor = Color.Black, // Yellow border when focused
unfocusedIndicatorColor = Color.Black // Yellow border when not focused
),
)
TextField(
value = usernameText,
onValueChange = { input -> usernameText = input },
modifier = Modifier
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
roundedCornerDimen))
.width(230.dp),
colors = TextFieldDefaults.colors(
focusedTextColor = Color.White, // White text
unfocusedTextColor = Color.White, // White text when not focused
focusedContainerColor = Color.Black, // Black background when focused
unfocusedContainerColor = Color.Black, // Black background when not focused
cursorColor = PastelYellow, // Yellow cursor
focusedIndicatorColor = Color.Black, // Yellow border when focused
unfocusedIndicatorColor = Color.Black // Yellow border when not focused
),
)
Spacer(modifier = Modifier.height(20.dp))
Spacer(modifier = Modifier.height(20.dp))
TextField(
value = passwordText,
onValueChange = { input -> passwordText = input },
visualTransformation = visualTransformation,
modifier = Modifier
.width(230.dp)
.border(
width = 5.dp,
color = PastelYellow,
shape = RoundedCornerShape(
roundedCornerDimen
)
),
colors = TextFieldDefaults.colors(
focusedTextColor = Color.White, // White text
unfocusedTextColor = Color.White, // White text when not focused
focusedContainerColor = Color.Black, // Black background when focused
unfocusedContainerColor = Color.Black, // Black background when not focused
cursorColor = PastelYellow, // Yellow cursor
focusedIndicatorColor = Color.Black, // Yellow border when focused
unfocusedIndicatorColor = Color.Black // Yellow border when not focused
),
trailingIcon = {
// Toggle button for showing/hiding password
IconButton(onClick = { isPasswordVisible = !isPasswordVisible }) {
Icon(
imageVector = if (isPasswordVisible) Icons.Filled.Visibility else Icons.Filled.VisibilityOff,
contentDescription = if (isPasswordVisible) "Hide password" else "Show password",
tint = Color.Gray // You can customize the icon color
)
}
}
)
Spacer(modifier = Modifier.height(20.dp))
Button(
onClick = {
signInButtonCallback(ctx, coscope, buttonText.value, usernameText, passwordText)
},
colors = ButtonDefaults.buttonColors(
contentColor = Color.White,
containerColor = Color.Black
),
modifier = Modifier
.border(
width = 5.dp,
shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow
TextField(
value = passwordText,
onValueChange = { input -> passwordText = input },
visualTransformation = visualTransformation,
modifier = Modifier
.width(230.dp)
.border(
width = 5.dp,
color = PastelYellow,
shape = RoundedCornerShape(
roundedCornerDimen
)
.width(230.dp)
) {
Text(
text = buttonText.value,
fontSize = 23.sp
)
),
colors = TextFieldDefaults.colors(
focusedTextColor = Color.White, // White text
unfocusedTextColor = Color.White, // White text when not focused
focusedContainerColor = Color.Black, // Black background when focused
unfocusedContainerColor = Color.Black, // Black background when not focused
cursorColor = PastelYellow, // Yellow cursor
focusedIndicatorColor = Color.Black, // Yellow border when focused
unfocusedIndicatorColor = Color.Black // Yellow border when not focused
),
trailingIcon = {
// Toggle button for showing/hiding password
IconButton(onClick = { isPasswordVisible = !isPasswordVisible }) {
Icon(
imageVector = if (isPasswordVisible) Icons.Filled.Visibility else Icons.Filled.VisibilityOff,
contentDescription = if (isPasswordVisible) "Hide password" else "Show password",
tint = Color.Gray // You can customize the icon color
)
}
}
)
Spacer(modifier = Modifier.height(20.dp))
Button(
onClick = {
signInButtonCallback(ctx, coscope, buttonText.value, usernameText, passwordText)
},
colors = ButtonDefaults.buttonColors(
contentColor = Color.White,
containerColor = Color.Black
),
modifier = Modifier
.border(
width = 5.dp,
shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow
)
.width(230.dp)
) {
Text(
text = buttonText.value,
fontSize = 23.sp
)
}
}
}
@@ -29,6 +29,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.odweta.solon.ui.theme.PastelGreen
@@ -95,11 +96,9 @@ fun subjectModifier(d: Day, s: Subject, lectureNumber: Int): Modifier {
month = "0$month"
}
d.date = "$day. $month."
val dayFormatter = DateTimeFormatter.ofPattern("dd. MM. yyyy")
val hourFormatter = DateTimeFormatter.ofPattern("HH:mm:ss")
val dateParsed = LocalDate.parse(d.date + " " + LocalDate.now().year, dayFormatter)
val dateParsed = LocalDate.parse("$day. $month." + " " + LocalDate.now().year, dayFormatter)
val startTimeParsed = LocalTime.parse(s.start + ":00", hourFormatter)
val endTimeParsed = LocalTime.parse(s.end + ":00", hourFormatter)
@@ -110,27 +109,22 @@ fun subjectModifier(d: Day, s: Subject, lectureNumber: Int): Modifier {
currentLectureNumber = lectureNumber
}
val m = Modifier
.fillMaxWidth()
.height(70.dp)
.background(
color = getSubjectColor(s, true), // decide on the color (transparent)
shape = RoundedCornerShape(roundedCornerDimen)
)
return if (lectureNumber == currentLectureNumber && dateParsed == todayDate) {
Modifier
.fillMaxWidth()
.height(100.dp)
.background(
color = getSubjectColor(s, true), // decide on the color (transparent)
shape = RoundedCornerShape(roundedCornerDimen)
)
.border(
width = 5.dp,
color = getSubjectColor(s, false),
shape = RoundedCornerShape(roundedCornerDimen)
)
m.border(
width = 5.dp,
color = getSubjectColor(s, false),
shape = RoundedCornerShape(roundedCornerDimen)
)
} else {
Modifier
.fillMaxWidth()
.height(100.dp)
.background(
color = getSubjectColor(s, true), // decide on the color (transparent)
shape = RoundedCornerShape(roundedCornerDimen)
)
m
}
}
@@ -150,7 +144,7 @@ private fun DayScreen(day: Day) {
Text(
text = "${day.name} ${day.date}",
color = Color.White,
fontSize = 30.sp,
fontSize = 26.sp,
fontWeight = FontWeight.Bold,
fontStyle = FontStyle.Italic
)
@@ -249,7 +243,8 @@ private fun DayScreen(day: Day) {
.padding(vertical = 5.dp),
contentAlignment = Alignment.Center
) {
if (!Parsing.userIsParent()) {
// add this to the 'Svoboda' mode maybe later; for now, it is left out
/*if (!Parsing.userIsParent()) {
if (
subject.teacher == "Jindřich Svoboda" &&
studentClass == "5. G"
@@ -260,7 +255,7 @@ private fun DayScreen(day: Day) {
modifier = Modifier.fillMaxSize()
)
}
}
}*/
}
if (subject.substitute != "2") {
@@ -278,11 +273,15 @@ private fun DayScreen(day: Day) {
)
if (!subject.free) {
Text(
text = subject.teacher,
color = Color.White,
fontSize = 12.sp
)
Box (
contentAlignment = Alignment.BottomEnd
) {
Text(
text = subject.teacher,
color = Color.White,
fontSize = 12.sp
)
}
}
}
}
@@ -1,15 +1,44 @@
package com.odweta.solon
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@Composable
fun ToolbarScreen() {
Text(
text = toolbarText.value,
fontSize = 25.sp,
color = Color.White
)
// make the font size adaptive relative to the length of the user's name
var toolbarTextSizeAdaptive by remember { mutableStateOf(25.sp) }
if (toolbarText.value.length > 28) {
toolbarTextSizeAdaptive = 20.sp
}
if (toolbarText.value.length > 32) {
toolbarTextSizeAdaptive = 16.sp
}
if (toolbarText.value.length > 40) {
toolbarTextSizeAdaptive = 12.sp
}
if (toolbarText.value.length > 45) {
toolbarTextSizeAdaptive = 10.sp
}
Box(modifier = Modifier.padding(10.dp)) {
Text(
text = toolbarText.value,
fontSize = toolbarTextSizeAdaptive,
color = Color.White
)
}
}
@@ -19,11 +19,13 @@ val White = Color(0xFFFFFFFF)
val Transparent = Color(0x00000000)
val PastelRed = Color(0xFFFF6666)
val PastelOrangeDark = Color(0xFFDC6421)
val PastelGreen = Color(0xFF00CC99)
val PastelOrange = Color(0xFFFF9933)
val PastelYellow = Color(0xFFFFCC33)
val PastelRedTransparent = Color(0x50FF6666)
val PastelOrangeDarkTransparent = Color(0x50DC6421)
val PastelGreenTransparent = Color(0x5000CC99)
val PastelOrangeTransparent = Color(0x50FF9933)
val PastelYellowTransparent = Color(0x50FFCC33)
+1 -1
View File
@@ -1,6 +1,6 @@
[versions]
accompanistCoil = "0.30.1"
agp = "8.7.1"
agp = "8.7.2"
coilCompose = "2.4.0"
glide = "4.16.0"
kotlin = "2.0.0"