💄 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.net.Uri
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.glance.GlanceId
@ -87,11 +86,18 @@ class CheckInWidget : GlanceAppWidget() {
Column {
Text(
text = resultTierSymbols[checkIn.resultTier],
style = TextStyle(fontSize = 17.sp)
style = TextStyle(
fontSize = 17.sp,
color = GlanceTheme.colors.onSurface
)
)
Text(
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))
@ -102,7 +108,10 @@ class CheckInWidget : GlanceAppWidget() {
ZoneId.systemDefault()
)
.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 = "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) {
Text(
text = data.publisher.nick,
style = TextStyle(fontSize = 15.sp)
style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface)
)
Spacer(modifier = GlanceModifier.width(8.dp))
Text(
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) {
Text(
text = data.body.title,
style = TextStyle(fontSize = 25.sp)
style = TextStyle(fontSize = 19.sp, color = GlanceTheme.colors.onSurface)
)
}
if (data.body.description != null) {
Text(
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 = 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))
@ -126,12 +130,16 @@ class RandomPostWidget : GlanceAppWidget() {
Text(
LocalDateTime.ofInstant(data.createdAt, ZoneId.systemDefault())
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")),
style = TextStyle(fontSize = 13.sp),
style = TextStyle(fontSize = 13.sp, color = GlanceTheme.colors.onSurface),
)
Text(
"#${data.id}",
style = TextStyle(fontSize = 11.sp, fontWeight = FontWeight.Bold),
style = TextStyle(
fontSize = 11.sp,
fontWeight = FontWeight.Bold,
color = GlanceTheme.colors.onSurface
),
)
return@Column;
@ -143,12 +151,16 @@ class RandomPostWidget : GlanceAppWidget() {
horizontalAlignment = Alignment.Horizontal.CenterHorizontally
) {
Text(
text = "Unable to fetch post",
style = TextStyle(fontSize = 17.sp, fontWeight = FontWeight.Bold)
text = "No Recommendations",
style = TextStyle(
fontSize = 17.sp,
fontWeight = FontWeight.Bold,
color = GlanceTheme.colors.onSurface
)
)
Text(
text = "Check your internet connection",
style = TextStyle(fontSize = 15.sp)
text = "Open app to load some posts",
style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface)
)
}
}