mirror of
https://github.com/kalarina-bit/Matewave.git
synced 2026-11-22 16:16:10 +00:00
Polish the new design
- Add Unbounded (headings) and Manrope (text) fonts, OFL 1.1, listed in Licenses - Bring back the misty forest artwork as a darkened backdrop texture - Add the wave pattern and matewave wordmark on the home screen - Player cards and a lime running clock on game and spectator screens - Fix text overflow in home cards; keep lime for the main action only
This commit is contained in:
@@ -1,39 +1,129 @@
|
||||
package cc.skysparkle.matewave.ui.components
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawWithCache
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.ColorMatrix
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import cc.skysparkle.matewave.R
|
||||
import cc.skysparkle.matewave.ui.theme.AppBackground
|
||||
import cc.skysparkle.matewave.ui.theme.ChessGreen
|
||||
import cc.skysparkle.matewave.ui.theme.Lime
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
/** Near-black backdrop with a faint neon glow at the top and a lime one at the bottom. */
|
||||
private object BackgroundAssetCache {
|
||||
@Volatile private var bitmap: ImageBitmap? = null
|
||||
|
||||
fun cached(): ImageBitmap? = bitmap
|
||||
|
||||
fun load(context: Context): ImageBitmap? {
|
||||
bitmap?.let { return it }
|
||||
synchronized(this) {
|
||||
bitmap?.let { return it }
|
||||
val metrics = context.resources.displayMetrics
|
||||
val target = maxOf(metrics.widthPixels, metrics.heightPixels).coerceAtLeast(1)
|
||||
|
||||
val bounds = BitmapFactory.Options().apply { inJustDecodeBounds = true }
|
||||
BitmapFactory.decodeResource(context.resources, R.drawable.bg_forest, bounds)
|
||||
|
||||
var sample = 1
|
||||
while (maxOf(bounds.outWidth, bounds.outHeight) / sample > target * 2) sample *= 2
|
||||
|
||||
val options = BitmapFactory.Options().apply {
|
||||
inSampleSize = sample
|
||||
inPreferredConfig = android.graphics.Bitmap.Config.RGB_565
|
||||
}
|
||||
val decoded = runCatching {
|
||||
BitmapFactory.decodeResource(context.resources, R.drawable.bg_forest, options)
|
||||
?.asImageBitmap()
|
||||
}.getOrNull()
|
||||
bitmap = decoded
|
||||
return decoded
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Slight green cast so the grey mist matches the accent colours. */
|
||||
private val ForestTint = ColorFilter.colorMatrix(
|
||||
ColorMatrix(
|
||||
floatArrayOf(
|
||||
0.80f, 0f, 0f, 0f, 0f,
|
||||
0f, 0.95f, 0f, 0f, 6f,
|
||||
0f, 0f, 0.85f, 0f, 2f,
|
||||
0f, 0f, 0f, 1f, 0f
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* The misty forest artwork, deeply darkened so it reads as texture: the mist stays
|
||||
* visible behind the headings at the top and fades into near-black lower down.
|
||||
*/
|
||||
@Composable
|
||||
fun AppBackdrop() {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(AppBackground)
|
||||
.drawWithCache {
|
||||
val top = Brush.radialGradient(
|
||||
colors = listOf(ChessGreen.copy(alpha = 0.16f), ChessGreen.copy(alpha = 0f)),
|
||||
center = Offset(size.width * 0.85f, size.height * 0.02f),
|
||||
radius = size.maxDimension * 0.55f
|
||||
)
|
||||
val bottom = Brush.radialGradient(
|
||||
colors = listOf(Lime.copy(alpha = 0.06f), Lime.copy(alpha = 0f)),
|
||||
center = Offset(0f, size.height),
|
||||
radius = size.maxDimension * 0.5f
|
||||
)
|
||||
onDrawBehind {
|
||||
drawRect(top)
|
||||
drawRect(bottom)
|
||||
val context = LocalContext.current
|
||||
var bitmap by remember { mutableStateOf(BackgroundAssetCache.cached()) }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
if (bitmap == null) {
|
||||
bitmap = withContext(Dispatchers.IO) { BackgroundAssetCache.load(context) }
|
||||
}
|
||||
}
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize().background(AppBackground)) {
|
||||
bitmap?.let { image ->
|
||||
Image(
|
||||
bitmap = image,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentScale = ContentScale.Crop,
|
||||
colorFilter = ForestTint
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.drawWithCache {
|
||||
val shade = Brush.verticalGradient(
|
||||
0.00f to AppBackground.copy(alpha = 0.72f),
|
||||
0.30f to AppBackground.copy(alpha = 0.80f),
|
||||
0.60f to AppBackground.copy(alpha = 0.90f),
|
||||
1.00f to AppBackground.copy(alpha = 0.96f)
|
||||
)
|
||||
val glow = Brush.radialGradient(
|
||||
colors = listOf(ChessGreen.copy(alpha = 0.14f), ChessGreen.copy(alpha = 0f)),
|
||||
center = Offset(size.width * 0.9f, 0f),
|
||||
radius = size.maxDimension * 0.5f
|
||||
)
|
||||
val lime = Brush.radialGradient(
|
||||
colors = listOf(Lime.copy(alpha = 0.05f), Lime.copy(alpha = 0f)),
|
||||
center = Offset(0f, size.height),
|
||||
radius = size.maxDimension * 0.45f
|
||||
)
|
||||
onDrawBehind {
|
||||
drawRect(shade)
|
||||
drawRect(glow)
|
||||
drawRect(lime)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package cc.skysparkle.matewave.ui.components
|
||||
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawWithCache
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.StrokeCap
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.sin
|
||||
|
||||
/**
|
||||
* The Matewave signature: thin parallel waves drawn behind the content,
|
||||
* fading towards the bottom of the surface.
|
||||
*/
|
||||
fun Modifier.wavePattern(color: Color, lines: Int = 7): Modifier = drawWithCache {
|
||||
val stroke = Stroke(width = 1.5.dp.toPx(), cap = StrokeCap.Round)
|
||||
val amplitude = 9.dp.toPx()
|
||||
val wavelength = size.width * 0.9f
|
||||
val gap = size.height * 0.55f / lines
|
||||
val step = 4.dp.toPx()
|
||||
val paths = List(lines) { i ->
|
||||
val baseY = gap * (i + 1)
|
||||
val phase = i * 0.55f
|
||||
Path().apply {
|
||||
var x = 0f
|
||||
moveTo(x, baseY + amplitude * sin(phase))
|
||||
while (x <= size.width) {
|
||||
x += step
|
||||
lineTo(x, baseY + amplitude * sin(2f * PI.toFloat() * x / wavelength + phase))
|
||||
}
|
||||
}
|
||||
}
|
||||
onDrawBehind {
|
||||
paths.forEachIndexed { i, path ->
|
||||
drawPath(path, color = color.copy(alpha = color.alpha * (1f - i.toFloat() / lines)), style = stroke)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ import cc.skysparkle.matewave.ui.components.ButtonIcon
|
||||
import cc.skysparkle.matewave.ui.components.GlassButton
|
||||
import cc.skysparkle.matewave.ui.components.GlassScaffold
|
||||
import cc.skysparkle.matewave.ui.components.rememberChatImage
|
||||
import cc.skysparkle.matewave.ui.components.wavePattern
|
||||
import cc.skysparkle.matewave.ui.components.encodeImageForChat
|
||||
import cc.skysparkle.matewave.ui.theme.ChessGreen
|
||||
import cc.skysparkle.matewave.ui.theme.PanelBorder
|
||||
@@ -355,7 +356,7 @@ private fun ProfileHero(
|
||||
0.6f to Surface1.copy(alpha = 0.6f),
|
||||
1.0f to Surface1.copy(alpha = 0.95f)
|
||||
)
|
||||
)
|
||||
).wavePattern(ChessGreen.copy(alpha = 0.12f))
|
||||
)
|
||||
|
||||
Box(
|
||||
@@ -411,7 +412,7 @@ private fun ProfileHero(
|
||||
Text(
|
||||
profile.name,
|
||||
color = ink,
|
||||
style = MaterialTheme.typography.displaySmall,
|
||||
style = MaterialTheme.typography.headlineLarge,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f, fill = false)
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import cc.skysparkle.matewave.ui.theme.ink
|
||||
|
||||
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
|
||||
@@ -461,15 +462,26 @@ private fun PlayerRow(
|
||||
state.opponentProfile?.avatarBase64
|
||||
)
|
||||
}
|
||||
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
// A card per player; the side to move gets a neon outline and ring.
|
||||
val cardShape = RoundedCornerShape(18.dp)
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(cardShape)
|
||||
.background(cc.skysparkle.matewave.ui.theme.Surface1)
|
||||
.border(1.dp, if (active) ChessGreen.copy(alpha = 0.7f) else cc.skysparkle.matewave.ui.theme.PanelBorder, cardShape)
|
||||
.padding(horizontal = 10.dp, vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(8.dp)
|
||||
.size(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(if (active) ChessGreen else ink.copy(alpha = 0.15f))
|
||||
)
|
||||
Spacer(Modifier.width(10.dp))
|
||||
AvatarCircle(base64 = avatar, size = 34.dp)
|
||||
.background(if (active) ChessGreen else Color.Transparent),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
AvatarCircle(base64 = avatar, size = 36.dp)
|
||||
}
|
||||
Spacer(Modifier.width(10.dp))
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
@@ -514,21 +526,27 @@ internal fun BigClock(millis: Long, active: Boolean) {
|
||||
active -> ink
|
||||
else -> ink.copy(alpha = 0.45f)
|
||||
}
|
||||
// The running clock is a lime pill, like the main action; a low clock turns red.
|
||||
val fill = when {
|
||||
low -> Color(0xFFFF6B6B)
|
||||
active -> cc.skysparkle.matewave.ui.theme.Lime
|
||||
else -> ink.copy(alpha = 0.06f)
|
||||
}
|
||||
val textColor = if (active) cc.skysparkle.matewave.ui.theme.OnAccent else color
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(10.dp))
|
||||
.background(if (active) ink.copy(alpha = 0.12f) else Color.Transparent)
|
||||
.padding(horizontal = 12.dp, vertical = 6.dp),
|
||||
.clip(RoundedCornerShape(50))
|
||||
.background(fill)
|
||||
.padding(horizontal = 14.dp, vertical = 6.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
if (totalSeconds >= NO_LIMIT_THRESHOLD_SECONDS) {
|
||||
AppIcon(R.drawable.ic_infinity, size = 28.dp, tint = color)
|
||||
AppIcon(R.drawable.ic_infinity, size = 26.dp, tint = textColor)
|
||||
} else {
|
||||
Text(
|
||||
"%d:%02d".format(totalSeconds / 60, totalSeconds % 60),
|
||||
color = color,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold
|
||||
color = textColor,
|
||||
style = MaterialTheme.typography.titleLarge.copy(fontFeatureSettings = "tnum")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ private data class LicenseEntry(
|
||||
)
|
||||
|
||||
private const val APACHE = "Apache License 2.0"
|
||||
private const val OFL = "SIL Open Font License 1.1"
|
||||
private const val AOSP = "The Android Open Source Project"
|
||||
|
||||
private val LIBRARIES = listOf(
|
||||
@@ -109,6 +110,14 @@ private val ASSETS = listOf(
|
||||
LicenseEntry(
|
||||
"Vector Chess Pieces", "RhosGFX", null, "CC0 1.0",
|
||||
"https://rhosgfx.itch.io/vector-chess-pieces", R.string.licenses_note_pieces
|
||||
),
|
||||
LicenseEntry(
|
||||
"Unbounded", "The Unbounded Project Authors", null, OFL,
|
||||
"https://github.com/googlefonts/unbounded", R.string.licenses_note_fonts
|
||||
),
|
||||
LicenseEntry(
|
||||
"Manrope", "The Manrope Project Authors", null, OFL,
|
||||
"https://github.com/googlefonts/manrope", R.string.licenses_note_fonts
|
||||
)
|
||||
)
|
||||
|
||||
@@ -123,6 +132,7 @@ private val RADIO = listOf(
|
||||
fun LicensesScreen(onBack: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
var showApache by remember { mutableStateOf(false) }
|
||||
var showOfl by remember { mutableStateOf(false) }
|
||||
|
||||
GlassScaffold(title = stringResource(R.string.licenses_title), onBack = onBack) {
|
||||
Text(
|
||||
@@ -143,6 +153,10 @@ fun LicensesScreen(onBack: () -> Unit) {
|
||||
|
||||
SetupSectionLabel(stringResource(R.string.licenses_group_assets))
|
||||
ASSETS.forEach { entry -> LicenseCard(entry) { openUrl(context, entry.url) } }
|
||||
GlassOutlinedButton(onClick = { showOfl = true }, modifier = Modifier.fillMaxWidth()) {
|
||||
ButtonIcon(R.drawable.ic_copyright)
|
||||
Text(stringResource(R.string.licenses_ofl_full), color = ink)
|
||||
}
|
||||
|
||||
SetupSectionLabel(stringResource(R.string.licenses_group_radio))
|
||||
Text(
|
||||
@@ -154,7 +168,10 @@ fun LicensesScreen(onBack: () -> Unit) {
|
||||
}
|
||||
|
||||
if (showApache) {
|
||||
ApacheLicenseDialog(onDismiss = { showApache = false })
|
||||
LicenseTextDialog(APACHE, R.raw.license_apache_2_0, "https://www.apache.org/licenses/LICENSE-2.0") { showApache = false }
|
||||
}
|
||||
if (showOfl) {
|
||||
LicenseTextDialog(OFL, R.raw.license_ofl_1_1, "https://openfontlicense.org") { showOfl = false }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,20 +202,20 @@ private fun LicenseCard(entry: LicenseEntry, onClick: () -> Unit) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ApacheLicenseDialog(onDismiss: () -> Unit) {
|
||||
private fun LicenseTextDialog(title: String, rawRes: Int, fallbackUrl: String, onDismiss: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
val text = remember {
|
||||
val text = remember(rawRes) {
|
||||
runCatching {
|
||||
context.resources.openRawResource(R.raw.license_apache_2_0)
|
||||
context.resources.openRawResource(rawRes)
|
||||
.bufferedReader().use { it.readText() }
|
||||
}.getOrDefault("https://www.apache.org/licenses/LICENSE-2.0")
|
||||
}.getOrDefault(fallbackUrl)
|
||||
.trim()
|
||||
.split(Regex("\n\\s*\n"))
|
||||
.joinToString("\n\n") { paragraph -> paragraph.lines().joinToString(" ") { it.trim() } }
|
||||
}
|
||||
AppDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = APACHE,
|
||||
title = title,
|
||||
actions = { DialogAction(stringResource(R.string.chat_close), onDismiss) }
|
||||
) {
|
||||
Column(modifier = Modifier.fillMaxWidth().heightIn(max = 380.dp).verticalScroll(rememberScrollState())) {
|
||||
|
||||
@@ -48,6 +48,7 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import cc.skysparkle.matewave.R
|
||||
import cc.skysparkle.matewave.stats.Stats
|
||||
import cc.skysparkle.matewave.ui.components.AppBottomBar
|
||||
@@ -58,6 +59,7 @@ import cc.skysparkle.matewave.ui.components.DialogAction
|
||||
import cc.skysparkle.matewave.ui.components.DialogText
|
||||
import cc.skysparkle.matewave.ui.components.SectionCaption
|
||||
import cc.skysparkle.matewave.ui.components.displayName
|
||||
import cc.skysparkle.matewave.ui.components.wavePattern
|
||||
import cc.skysparkle.matewave.ui.theme.ChessGreen
|
||||
import cc.skysparkle.matewave.ui.theme.GlassShape
|
||||
import cc.skysparkle.matewave.ui.theme.HeroTextStyle
|
||||
@@ -106,7 +108,7 @@ fun MainMenuScreen(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.size(44.dp).clip(CircleShape).background(Surface2),
|
||||
modifier = Modifier.size(44.dp).clip(CircleShape).background(ChessGreen),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Image(
|
||||
@@ -115,6 +117,13 @@ fun MainMenuScreen(
|
||||
modifier = Modifier.size(width = 20.dp, height = 29.dp)
|
||||
)
|
||||
}
|
||||
Spacer(Modifier.width(10.dp))
|
||||
Text(
|
||||
"matewave",
|
||||
color = ink,
|
||||
style = MaterialTheme.typography.headlineSmall.copy(fontSize = 17.sp, letterSpacing = (-0.3).sp),
|
||||
maxLines = 1
|
||||
)
|
||||
Spacer(Modifier.weight(1f))
|
||||
// The rating is always in sight.
|
||||
Row(
|
||||
@@ -142,7 +151,7 @@ fun MainMenuScreen(
|
||||
Hero()
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().height(250.dp),
|
||||
modifier = Modifier.fillMaxWidth().height(268.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
AiCard(
|
||||
@@ -238,7 +247,7 @@ private fun Hero() {
|
||||
else -> stringResource(R.string.greeting_night)
|
||||
}
|
||||
Box(modifier = Modifier.fillMaxWidth().padding(top = 8.dp)) {
|
||||
Column(modifier = Modifier.padding(end = 92.dp)) {
|
||||
Column(modifier = Modifier.padding(end = 76.dp)) {
|
||||
Text("$greeting 👋", color = ink.copy(alpha = 0.6f), style = MaterialTheme.typography.bodyLarge)
|
||||
Spacer(Modifier.height(2.dp))
|
||||
Text(
|
||||
@@ -254,7 +263,7 @@ private fun Hero() {
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterEnd)
|
||||
.size(96.dp)
|
||||
.size(88.dp)
|
||||
.rotate(-14f)
|
||||
)
|
||||
}
|
||||
@@ -267,6 +276,7 @@ private fun AiCard(subtitle: String, modifier: Modifier = Modifier, onClick: ()
|
||||
modifier = modifier
|
||||
.clip(GlassShape)
|
||||
.background(ChessGreen)
|
||||
.wavePattern(OnAccent.copy(alpha = 0.16f))
|
||||
.clickable(onClick = onClick)
|
||||
) {
|
||||
Image(
|
||||
@@ -284,23 +294,18 @@ private fun AiCard(subtitle: String, modifier: Modifier = Modifier, onClick: ()
|
||||
Text(
|
||||
stringResource(R.string.mode_ai_title),
|
||||
color = OnAccent,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
style = MaterialTheme.typography.headlineSmall.copy(fontSize = 19.sp, lineHeight = 24.sp),
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
subtitle,
|
||||
color = OnAccent.copy(alpha = 0.7f),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
ArrowBubble(fill = OnAccent, tint = ChessGreen)
|
||||
}
|
||||
Text(
|
||||
subtitle,
|
||||
color = OnAccent.copy(alpha = 0.7f),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,7 +337,7 @@ private fun SmallModeCard(
|
||||
ArrowBubble(fill = Surface2, tint = ink)
|
||||
}
|
||||
Spacer(Modifier.weight(1f))
|
||||
Text(title, color = ink, style = MaterialTheme.typography.titleMedium, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
Text(title, color = ink, style = MaterialTheme.typography.titleMedium, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
Text(subtitle, color = ink.copy(alpha = 0.55f), style = MaterialTheme.typography.bodySmall, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
@@ -368,7 +373,7 @@ private fun ContinueCard(info: ResumeInfo, modifier: Modifier = Modifier, onClic
|
||||
stringResource(R.string.continue_game_title),
|
||||
color = OnAccent,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
maxLines = 1,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Text(details, color = OnAccent.copy(alpha = 0.7f), style = MaterialTheme.typography.bodySmall, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
@@ -399,7 +404,7 @@ private fun LearnCard(
|
||||
.height(148.dp)
|
||||
.clip(GlassShape)
|
||||
.background(Surface1)
|
||||
.border(1.dp, if (highlighted) Lime.copy(alpha = 0.7f) else PanelBorder, GlassShape)
|
||||
.border(1.dp, if (highlighted) ChessGreen.copy(alpha = 0.7f) else PanelBorder, GlassShape)
|
||||
.clickable(onClick = onClick)
|
||||
.padding(14.dp)
|
||||
) {
|
||||
@@ -407,7 +412,7 @@ private fun LearnCard(
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.clip(RoundedCornerShape(14.dp))
|
||||
.background(if (highlighted) Lime else Surface2),
|
||||
.background(if (highlighted) ChessGreen else Surface2),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
AppIcon(iconRes, size = 22.dp, tint = if (highlighted) OnAccent else ChessGreen)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cc.skysparkle.matewave.ui.screens
|
||||
|
||||
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
|
||||
@@ -223,15 +224,25 @@ private fun SpectatorPlayerRow(
|
||||
val avatar = remember(player.id) {
|
||||
if (player.id.isEmpty()) null else FriendsStore.list().firstOrNull { it.userId == player.id }?.avatarBase64
|
||||
}
|
||||
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
val cardShape = androidx.compose.foundation.shape.RoundedCornerShape(18.dp)
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(cardShape)
|
||||
.background(cc.skysparkle.matewave.ui.theme.Surface1)
|
||||
.border(1.dp, if (active) ChessGreen.copy(alpha = 0.7f) else cc.skysparkle.matewave.ui.theme.PanelBorder, cardShape)
|
||||
.padding(horizontal = 10.dp, vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(8.dp)
|
||||
.size(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(if (active) ChessGreen else ink.copy(alpha = 0.15f))
|
||||
)
|
||||
Spacer(Modifier.width(10.dp))
|
||||
AvatarCircle(base64 = avatar, size = 34.dp)
|
||||
.background(if (active) ChessGreen else androidx.compose.ui.graphics.Color.Transparent),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
AvatarCircle(base64 = avatar, size = 36.dp)
|
||||
}
|
||||
Spacer(Modifier.width(10.dp))
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
|
||||
@@ -9,7 +9,10 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import cc.skysparkle.matewave.R
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
/** Neon green: the brand accent for highlights, selected states and progress. */
|
||||
@@ -41,33 +44,52 @@ private val DarkScheme = darkColorScheme(
|
||||
surfaceVariant = Surface2
|
||||
)
|
||||
|
||||
private val base = Typography()
|
||||
|
||||
/** Heavy, tightly set headings like the mockups; body text stays the system default. */
|
||||
private val AppTypography = Typography(
|
||||
displayLarge = base.displayLarge.copy(fontWeight = FontWeight.ExtraBold, letterSpacing = (-1.5).sp),
|
||||
displayMedium = base.displayMedium.copy(fontWeight = FontWeight.ExtraBold, letterSpacing = (-1.2).sp),
|
||||
displaySmall = base.displaySmall.copy(fontWeight = FontWeight.ExtraBold, letterSpacing = (-0.8).sp),
|
||||
headlineLarge = base.headlineLarge.copy(fontWeight = FontWeight.Bold, letterSpacing = (-0.6).sp),
|
||||
headlineMedium = base.headlineMedium.copy(fontWeight = FontWeight.Bold, letterSpacing = (-0.5).sp),
|
||||
headlineSmall = base.headlineSmall.copy(fontWeight = FontWeight.Bold, letterSpacing = (-0.3).sp),
|
||||
titleLarge = base.titleLarge.copy(fontWeight = FontWeight.Bold, letterSpacing = (-0.2).sp),
|
||||
titleMedium = base.titleMedium.copy(fontWeight = FontWeight.SemiBold),
|
||||
titleSmall = base.titleSmall.copy(fontWeight = FontWeight.SemiBold),
|
||||
bodyLarge = base.bodyLarge,
|
||||
bodyMedium = base.bodyMedium,
|
||||
bodySmall = base.bodySmall,
|
||||
labelLarge = base.labelLarge.copy(fontWeight = FontWeight.SemiBold),
|
||||
labelMedium = base.labelMedium.copy(fontWeight = FontWeight.SemiBold, letterSpacing = 0.6.sp),
|
||||
labelSmall = base.labelSmall.copy(fontWeight = FontWeight.Medium)
|
||||
/** Wide display face for the big headings: the brand voice of the app. */
|
||||
val DisplayFont = FontFamily(
|
||||
Font(R.font.unbounded_semibold, FontWeight.SemiBold),
|
||||
Font(R.font.unbounded_extrabold, FontWeight.ExtraBold)
|
||||
)
|
||||
|
||||
/** Large hero heading on the home and profile screens. */
|
||||
/** Text face for everything else. Characters it lacks (CJK, symbols) fall back to the system font. */
|
||||
val TextFont = FontFamily(
|
||||
Font(R.font.manrope_regular, FontWeight.Normal),
|
||||
Font(R.font.manrope_medium, FontWeight.Medium),
|
||||
Font(R.font.manrope_semibold, FontWeight.SemiBold),
|
||||
Font(R.font.manrope_bold, FontWeight.Bold)
|
||||
)
|
||||
|
||||
private val base = Typography()
|
||||
|
||||
private fun TextStyle.display(weight: FontWeight, tracking: Double) =
|
||||
copy(fontFamily = DisplayFont, fontWeight = weight, letterSpacing = tracking.sp)
|
||||
|
||||
private fun TextStyle.text(weight: FontWeight) = copy(fontFamily = TextFont, fontWeight = weight)
|
||||
|
||||
private val AppTypography = Typography(
|
||||
displayLarge = base.displayLarge.display(FontWeight.ExtraBold, -1.5),
|
||||
displayMedium = base.displayMedium.display(FontWeight.ExtraBold, -1.2),
|
||||
displaySmall = base.displaySmall.display(FontWeight.ExtraBold, -0.8),
|
||||
headlineLarge = base.headlineLarge.display(FontWeight.ExtraBold, -0.8),
|
||||
headlineMedium = base.headlineMedium.display(FontWeight.ExtraBold, -0.6),
|
||||
headlineSmall = base.headlineSmall.copy(fontSize = 21.sp, lineHeight = 28.sp).display(FontWeight.SemiBold, -0.4),
|
||||
titleLarge = base.titleLarge.text(FontWeight.Bold),
|
||||
titleMedium = base.titleMedium.text(FontWeight.Bold),
|
||||
titleSmall = base.titleSmall.text(FontWeight.Bold),
|
||||
bodyLarge = base.bodyLarge.text(FontWeight.Medium),
|
||||
bodyMedium = base.bodyMedium.text(FontWeight.Medium),
|
||||
bodySmall = base.bodySmall.text(FontWeight.Medium),
|
||||
labelLarge = base.labelLarge.text(FontWeight.Bold),
|
||||
labelMedium = base.labelMedium.text(FontWeight.Bold).copy(letterSpacing = 1.sp),
|
||||
labelSmall = base.labelSmall.text(FontWeight.SemiBold)
|
||||
)
|
||||
|
||||
/** Large hero heading on the home screen. */
|
||||
val HeroTextStyle = TextStyle(
|
||||
fontSize = 52.sp,
|
||||
lineHeight = 52.sp,
|
||||
fontFamily = DisplayFont,
|
||||
fontSize = 46.sp,
|
||||
lineHeight = 50.sp,
|
||||
fontWeight = FontWeight.ExtraBold,
|
||||
letterSpacing = (-2).sp
|
||||
letterSpacing = (-1.5).sp
|
||||
)
|
||||
|
||||
/** The app has a single dark theme; system bars are set up in MainActivity. */
|
||||
|
||||
Reference in New Issue
Block a user