💄 Optimize android widget color

This commit is contained in:
LittleSheep 2024-12-21 23:36:34 +08:00
parent b50191970e
commit 35dc7f4392
2 changed files with 37 additions and 16 deletions

View File

@ -1,7 +1,6 @@
import android.content.Context import android.content.Context
import android.net.Uri import android.net.Uri
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.glance.GlanceId import androidx.glance.GlanceId
@ -87,11 +86,18 @@ class CheckInWidget : GlanceAppWidget() {
Column { Column {
Text( Text(
text = resultTierSymbols[checkIn.resultTier], text = resultTierSymbols[checkIn.resultTier],
style = TextStyle(fontSize = 17.sp) style = TextStyle(
fontSize = 17.sp,
color = GlanceTheme.colors.onSurface
)
) )
Text( Text(
text = "+${checkIn.resultExperience} EXP", text = "+${checkIn.resultExperience} EXP",
style = TextStyle(fontSize = 13.sp, fontFamily = FontFamily.Monospace) style = TextStyle(
fontSize = 13.sp,
fontFamily = FontFamily.Monospace,
color = GlanceTheme.colors.onSurface
)
) )
} }
Spacer(modifier = GlanceModifier.height(8.dp)) Spacer(modifier = GlanceModifier.height(8.dp))
@ -102,7 +108,10 @@ class CheckInWidget : GlanceAppWidget() {
ZoneId.systemDefault() ZoneId.systemDefault()
) )
.format(dateFormatter), .format(dateFormatter),
style = TextStyle(fontSize = 11.sp) style = TextStyle(
fontSize = 11.sp,
color = GlanceTheme.colors.onSurface
)
) )
} }
@ -112,7 +121,7 @@ class CheckInWidget : GlanceAppWidget() {
Text( Text(
text = "You haven't checked in today", text = "You haven't checked in today",
style = TextStyle(fontSize = 15.sp) style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface)
) )
} }
} }

View File

@ -87,12 +87,16 @@ class RandomPostWidget : GlanceAppWidget() {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
Text( Text(
text = data.publisher.nick, text = data.publisher.nick,
style = TextStyle(fontSize = 15.sp) style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface)
) )
Spacer(modifier = GlanceModifier.width(8.dp)) Spacer(modifier = GlanceModifier.width(8.dp))
Text( Text(
text = "@${data.publisher.name}", text = "@${data.publisher.name}",
style = TextStyle(fontSize = 13.sp, fontFamily = FontFamily.Monospace) style = TextStyle(
fontSize = 13.sp,
fontFamily = FontFamily.Monospace,
color = GlanceTheme.colors.onSurface
)
) )
} }
@ -101,13 +105,13 @@ class RandomPostWidget : GlanceAppWidget() {
if (data.body.title != null) { if (data.body.title != null) {
Text( Text(
text = data.body.title, text = data.body.title,
style = TextStyle(fontSize = 25.sp) style = TextStyle(fontSize = 19.sp, color = GlanceTheme.colors.onSurface)
) )
} }
if (data.body.description != null) { if (data.body.description != null) {
Text( Text(
text = data.body.description, text = data.body.description,
style = TextStyle(fontSize = 19.sp) style = TextStyle(fontSize = 17.sp, color = GlanceTheme.colors.onSurface)
) )
} }
@ -117,7 +121,7 @@ class RandomPostWidget : GlanceAppWidget() {
Text( Text(
text = data.body.content ?: "No content", text = data.body.content ?: "No content",
style = TextStyle(fontSize = 15.sp), style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface),
) )
Spacer(modifier = GlanceModifier.height(8.dp)) Spacer(modifier = GlanceModifier.height(8.dp))
@ -126,12 +130,16 @@ class RandomPostWidget : GlanceAppWidget() {
Text( Text(
LocalDateTime.ofInstant(data.createdAt, ZoneId.systemDefault()) LocalDateTime.ofInstant(data.createdAt, ZoneId.systemDefault())
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")), .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")),
style = TextStyle(fontSize = 13.sp), style = TextStyle(fontSize = 13.sp, color = GlanceTheme.colors.onSurface),
) )
Text( Text(
"#${data.id}", "#${data.id}",
style = TextStyle(fontSize = 11.sp, fontWeight = FontWeight.Bold), style = TextStyle(
fontSize = 11.sp,
fontWeight = FontWeight.Bold,
color = GlanceTheme.colors.onSurface
),
) )
return@Column; return@Column;
@ -143,12 +151,16 @@ class RandomPostWidget : GlanceAppWidget() {
horizontalAlignment = Alignment.Horizontal.CenterHorizontally horizontalAlignment = Alignment.Horizontal.CenterHorizontally
) { ) {
Text( Text(
text = "Unable to fetch post", text = "No Recommendations",
style = TextStyle(fontSize = 17.sp, fontWeight = FontWeight.Bold) style = TextStyle(
fontSize = 17.sp,
fontWeight = FontWeight.Bold,
color = GlanceTheme.colors.onSurface
)
) )
Text( Text(
text = "Check your internet connection", text = "Open app to load some posts",
style = TextStyle(fontSize = 15.sp) style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface)
) )
} }
} }