redesign app
This commit is contained in:
9 files changed
+1040
-257
No files matched your search
@@ -3,6 +3,7 @@ package net.rodakot.remaining.ui
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@@ -19,6 +20,7 @@ import androidx.compose.runtime.collectAsState
|
|||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||||
import androidx.compose.ui.unit.LayoutDirection
|
import androidx.compose.ui.unit.LayoutDirection
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -50,7 +52,10 @@ fun RemainingApp(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scaffold(snackbarHost = { SnackbarHost(snackbarHostState) }) { outerPadding ->
|
Scaffold(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
|
snackbarHost = { SnackbarHost(snackbarHostState) }
|
||||||
|
) { outerPadding ->
|
||||||
NavHost(
|
NavHost(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
startDestination = Route.Dashboard,
|
startDestination = Route.Dashboard,
|
||||||
@@ -107,11 +112,13 @@ fun RemainingApp(
|
|||||||
state.action.captcha?.let { captcha ->
|
state.action.captcha?.let { captcha ->
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = viewModel::dismissCaptcha,
|
onDismissRequest = viewModel::dismissCaptcha,
|
||||||
title = { Text("TCI captcha") },
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||||
|
title = { Text("TCI captcha required") },
|
||||||
text = {
|
text = {
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
"Enter the captcha shown by TCI. This signs in the saved account session.",
|
"Enter the code shown by TCI to refresh this saved account session.",
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
CaptchaImage(
|
CaptchaImage(
|
||||||
|
|||||||
@@ -1,15 +1,25 @@
|
|||||||
package net.rodakot.remaining.ui.components
|
package net.rodakot.remaining.ui.components
|
||||||
|
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
|
import androidx.compose.foundation.BorderStroke
|
||||||
|
import androidx.compose.foundation.Canvas
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.BoxScope
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.LinearProgressIndicator
|
import androidx.compose.material3.LinearProgressIndicator
|
||||||
@@ -20,36 +30,149 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.geometry.Offset
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.StrokeCap
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
|
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
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.dp
|
||||||
import net.rodakot.remaining.domain.AccountStatus
|
import net.rodakot.remaining.domain.AccountStatus
|
||||||
|
import net.rodakot.remaining.domain.ServiceType
|
||||||
import java.text.DateFormat
|
import java.text.DateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun StatusChip(status: AccountStatus, modifier: Modifier = Modifier) {
|
fun RemainingBackground(
|
||||||
val color = when (status) {
|
modifier: Modifier = Modifier,
|
||||||
AccountStatus.ACTIVE -> Color(0xFF3DDC84)
|
content: @Composable BoxScope.() -> Unit
|
||||||
AccountStatus.REFRESHING -> Color(0xFF64B5F6)
|
) {
|
||||||
AccountStatus.CAPTCHA_REQUIRED -> Color(0xFFFFC857)
|
val colorScheme = MaterialTheme.colorScheme
|
||||||
AccountStatus.NEEDS_AUTH -> Color(0xFFFF9F1C)
|
Box(
|
||||||
AccountStatus.ERROR -> Color(0xFFFF5A5F)
|
modifier = modifier
|
||||||
AccountStatus.DISABLED -> MaterialTheme.colorScheme.outline
|
.fillMaxSize()
|
||||||
|
.background(
|
||||||
|
Brush.verticalGradient(
|
||||||
|
listOf(
|
||||||
|
colorScheme.background,
|
||||||
|
colorScheme.surfaceContainerLow,
|
||||||
|
colorScheme.background
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Canvas(modifier = Modifier.fillMaxSize()) {
|
||||||
|
drawRect(
|
||||||
|
brush = Brush.linearGradient(
|
||||||
|
colors = listOf(
|
||||||
|
colorScheme.primary.copy(alpha = 0.18f),
|
||||||
|
Color.Transparent,
|
||||||
|
colorScheme.secondary.copy(alpha = 0.12f)
|
||||||
|
),
|
||||||
|
start = Offset.Zero,
|
||||||
|
end = Offset(size.width, size.height)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
drawLine(
|
||||||
|
color = colorScheme.primary.copy(alpha = 0.16f),
|
||||||
|
start = Offset(0f, size.height * 0.18f),
|
||||||
|
end = Offset(size.width, size.height * 0.04f),
|
||||||
|
strokeWidth = 2.dp.toPx()
|
||||||
|
)
|
||||||
|
drawLine(
|
||||||
|
color = colorScheme.secondary.copy(alpha = 0.10f),
|
||||||
|
start = Offset(0f, size.height * 0.88f),
|
||||||
|
end = Offset(size.width, size.height * 0.72f),
|
||||||
|
strokeWidth = 2.dp.toPx()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
content()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ModernPanel(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
contentPadding: PaddingValues = PaddingValues(16.dp),
|
||||||
|
content: @Composable ColumnScope.() -> Unit
|
||||||
|
) {
|
||||||
|
Surface(
|
||||||
|
modifier = modifier,
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = MaterialTheme.colorScheme.surfaceContainer.copy(alpha = 0.92f),
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.55f)),
|
||||||
|
shadowElevation = 0.dp,
|
||||||
|
tonalElevation = 0.dp
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.padding(contentPadding),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SectionHeader(
|
||||||
|
title: String,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
subtitle: String? = null
|
||||||
|
) {
|
||||||
|
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(3.dp)) {
|
||||||
|
Text(title, style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
||||||
|
subtitle?.let {
|
||||||
|
Text(
|
||||||
|
it,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ServiceBadge(
|
||||||
|
serviceType: ServiceType,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
label: String = serviceType.shortName
|
||||||
|
) {
|
||||||
|
val color = serviceType.accentColor()
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
color = color.copy(alpha = 0.16f),
|
color = color.copy(alpha = 0.16f),
|
||||||
contentColor = color,
|
contentColor = color,
|
||||||
shape = RoundedCornerShape(8.dp)
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
border = BorderStroke(1.dp, color.copy(alpha = 0.30f))
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = label,
|
||||||
|
style = MaterialTheme.typography.labelMedium,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
modifier = Modifier.padding(horizontal = 10.dp, vertical = 6.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun StatusChip(status: AccountStatus, modifier: Modifier = Modifier) {
|
||||||
|
val color = status.accentColor()
|
||||||
|
Surface(
|
||||||
|
modifier = modifier,
|
||||||
|
color = color.copy(alpha = 0.16f),
|
||||||
|
contentColor = color,
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
border = BorderStroke(1.dp, color.copy(alpha = 0.30f))
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = status.displayName,
|
text = status.displayName,
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
fontWeight = FontWeight.SemiBold,
|
fontWeight = FontWeight.Bold,
|
||||||
modifier = Modifier.padding(horizontal = 10.dp, vertical = 5.dp)
|
modifier = Modifier.padding(horizontal = 10.dp, vertical = 6.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,20 +185,10 @@ fun UsageBar(
|
|||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val progress = remember(remainingBytes, totalBytes) {
|
val progress = remember(remainingBytes, totalBytes) {
|
||||||
if (remainingBytes == null || totalBytes == null || totalBytes <= 0L) {
|
remainingProgress(remainingBytes, totalBytes)
|
||||||
null
|
|
||||||
} else {
|
|
||||||
(remainingBytes.toFloat() / totalBytes.toFloat()).coerceIn(0f, 1f)
|
|
||||||
}
|
}
|
||||||
}
|
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(7.dp)) {
|
||||||
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
QuotaBar(progress = progress)
|
||||||
LinearProgressIndicator(
|
|
||||||
progress = { progress ?: 0.62f },
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(8.dp),
|
|
||||||
trackColor = MaterialTheme.colorScheme.surfaceVariant
|
|
||||||
)
|
|
||||||
Text(
|
Text(
|
||||||
text = totalDisplay?.let { "Total $it" } ?: "Total quota not reported",
|
text = totalDisplay?.let { "Total $it" } ?: "Total quota not reported",
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
@@ -85,15 +198,103 @@ fun UsageBar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MetricPill(label: String, value: String, modifier: Modifier = Modifier) {
|
fun QuotaBar(progress: Float?, modifier: Modifier = Modifier) {
|
||||||
|
val colorScheme = MaterialTheme.colorScheme
|
||||||
|
val shape = RoundedCornerShape(8.dp)
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.background(MaterialTheme.colorScheme.surfaceVariant, RoundedCornerShape(8.dp))
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 12.dp, vertical = 10.dp)
|
.height(10.dp)
|
||||||
|
.clip(shape)
|
||||||
|
.background(colorScheme.surfaceContainerHighest.copy(alpha = 0.70f))
|
||||||
|
.border(1.dp, colorScheme.outlineVariant.copy(alpha = 0.35f), shape)
|
||||||
) {
|
) {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
if (progress != null) {
|
||||||
Text(label, color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.labelSmall)
|
Box(
|
||||||
Text(value, fontWeight = FontWeight.SemiBold, style = MaterialTheme.typography.titleSmall)
|
modifier = Modifier
|
||||||
|
.fillMaxHeight()
|
||||||
|
.fillMaxWidth(progress)
|
||||||
|
.background(
|
||||||
|
Brush.horizontalGradient(
|
||||||
|
listOf(colorScheme.primary, colorScheme.secondary)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LinearProgressIndicator(
|
||||||
|
progress = { 0.28f },
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
color = colorScheme.outline,
|
||||||
|
trackColor = Color.Transparent
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MetricPill(label: String, value: String, modifier: Modifier = Modifier) {
|
||||||
|
Surface(
|
||||||
|
modifier = modifier,
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = MaterialTheme.colorScheme.surfaceContainerHighest.copy(alpha = 0.60f),
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.45f))
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.padding(horizontal = 12.dp, vertical = 11.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(3.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.labelSmall
|
||||||
|
)
|
||||||
|
Text(value, fontWeight = FontWeight.Bold, style = MaterialTheme.typography.titleSmall)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun QuotaRing(
|
||||||
|
progress: Float?,
|
||||||
|
label: String,
|
||||||
|
value: String,
|
||||||
|
modifier: Modifier = Modifier.size(156.dp),
|
||||||
|
accent: Color = MaterialTheme.colorScheme.primary
|
||||||
|
) {
|
||||||
|
val trackColor = MaterialTheme.colorScheme.surfaceContainerHighest
|
||||||
|
Box(modifier = modifier, contentAlignment = Alignment.Center) {
|
||||||
|
Canvas(modifier = Modifier.fillMaxSize()) {
|
||||||
|
val stroke = Stroke(width = 13.dp.toPx(), cap = StrokeCap.Round)
|
||||||
|
drawArc(
|
||||||
|
color = trackColor,
|
||||||
|
startAngle = 135f,
|
||||||
|
sweepAngle = 270f,
|
||||||
|
useCenter = false,
|
||||||
|
style = stroke
|
||||||
|
)
|
||||||
|
drawArc(
|
||||||
|
brush = Brush.sweepGradient(listOf(accent, Color(0xFF8EEBFF), accent)),
|
||||||
|
startAngle = 135f,
|
||||||
|
sweepAngle = 270f * (progress ?: 0.64f),
|
||||||
|
useCenter = false,
|
||||||
|
style = stroke
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style = MaterialTheme.typography.titleLarge,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.labelMedium,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,8 +323,19 @@ fun InfoRow(label: String, value: String, modifier: Modifier = Modifier) {
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Text(label, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
Text(
|
||||||
Text(value, fontWeight = FontWeight.Medium)
|
label,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.size(16.dp))
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
textAlign = TextAlign.End,
|
||||||
|
modifier = Modifier.weight(1f, fill = false)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,3 +344,22 @@ fun Long?.formatTimestamp(): String =
|
|||||||
DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.US)
|
DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.US)
|
||||||
.format(Date(it))
|
.format(Date(it))
|
||||||
} ?: "Never"
|
} ?: "Never"
|
||||||
|
|
||||||
|
fun remainingProgress(remainingBytes: Long?, totalBytes: Long?): Float? =
|
||||||
|
if (remainingBytes == null || totalBytes == null || totalBytes <= 0L) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
(remainingBytes.toFloat() / totalBytes.toFloat()).coerceIn(0f, 1f)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ServiceType.accentColor(): Color = Color(accentArgb)
|
||||||
|
|
||||||
|
fun AccountStatus.accentColor(): Color =
|
||||||
|
when (this) {
|
||||||
|
AccountStatus.ACTIVE -> Color(0xFF56E39F)
|
||||||
|
AccountStatus.REFRESHING -> Color(0xFF8EEBFF)
|
||||||
|
AccountStatus.CAPTCHA_REQUIRED -> Color(0xFFFFD166)
|
||||||
|
AccountStatus.NEEDS_AUTH -> Color(0xFFFF8A65)
|
||||||
|
AccountStatus.ERROR -> Color(0xFFFF6B7A)
|
||||||
|
AccountStatus.DISABLED -> Color(0xFF93A39A)
|
||||||
|
}
|
||||||
@@ -1,12 +1,18 @@
|
|||||||
package net.rodakot.remaining.ui.screens
|
package net.rodakot.remaining.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.foundation.BorderStroke
|
||||||
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
@@ -15,8 +21,6 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
|||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material.icons.filled.Refresh
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FilterChip
|
import androidx.compose.material3.FilterChip
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -25,26 +29,41 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import net.rodakot.remaining.data.AccountDetail
|
import net.rodakot.remaining.data.AccountDetail
|
||||||
import net.rodakot.remaining.data.AccountSummary
|
import net.rodakot.remaining.data.AccountSummary
|
||||||
import net.rodakot.remaining.data.UsagePackageEntity
|
import net.rodakot.remaining.data.UsagePackageEntity
|
||||||
import net.rodakot.remaining.domain.AccountStatus
|
import net.rodakot.remaining.domain.AccountStatus
|
||||||
import net.rodakot.remaining.domain.RefreshInterval
|
import net.rodakot.remaining.domain.RefreshInterval
|
||||||
|
import net.rodakot.remaining.domain.asTrafficDisplay
|
||||||
import net.rodakot.remaining.ui.components.InfoRow
|
import net.rodakot.remaining.ui.components.InfoRow
|
||||||
|
import net.rodakot.remaining.ui.components.MetricPill
|
||||||
|
import net.rodakot.remaining.ui.components.ModernPanel
|
||||||
|
import net.rodakot.remaining.ui.components.QuotaRing
|
||||||
|
import net.rodakot.remaining.ui.components.RemainingBackground
|
||||||
|
import net.rodakot.remaining.ui.components.SectionHeader
|
||||||
|
import net.rodakot.remaining.ui.components.ServiceBadge
|
||||||
import net.rodakot.remaining.ui.components.StatusChip
|
import net.rodakot.remaining.ui.components.StatusChip
|
||||||
import net.rodakot.remaining.ui.components.UsageBar
|
import net.rodakot.remaining.ui.components.UsageBar
|
||||||
|
import net.rodakot.remaining.ui.components.accentColor
|
||||||
import net.rodakot.remaining.ui.components.formatTimestamp
|
import net.rodakot.remaining.ui.components.formatTimestamp
|
||||||
|
import net.rodakot.remaining.ui.components.remainingProgress
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -58,10 +77,29 @@ fun AccountDetailScreen(
|
|||||||
onDelete: (String) -> Unit
|
onDelete: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
val account = detail?.summary
|
val account = detail?.summary
|
||||||
|
RemainingBackground {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text(account?.displayName ?: "Account") },
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
|
scrolledContainerColor = Color.Transparent
|
||||||
|
),
|
||||||
|
title = {
|
||||||
|
Column {
|
||||||
|
Text(account?.displayName ?: "Account", maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||||
|
account?.let {
|
||||||
|
Text(
|
||||||
|
it.serviceType.displayName,
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
||||||
@@ -77,7 +115,7 @@ fun AccountDetailScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
if (account == null) {
|
if (detail == null) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -85,19 +123,27 @@ fun AccountDetailScreen(
|
|||||||
.padding(24.dp),
|
.padding(24.dp),
|
||||||
verticalArrangement = Arrangement.Center
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
|
ModernPanel(modifier = Modifier.fillMaxWidth()) {
|
||||||
Text("Account not found", style = MaterialTheme.typography.titleLarge)
|
Text("Account not found", style = MaterialTheme.typography.titleLarge)
|
||||||
|
Text(
|
||||||
|
"This account may have been removed.",
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
val currentAccount = detail.summary
|
||||||
AccountDetailContent(
|
AccountDetailContent(
|
||||||
modifier = Modifier.padding(padding),
|
modifier = Modifier.padding(padding),
|
||||||
detail = detail,
|
detail = detail,
|
||||||
busy = busy,
|
busy = busy,
|
||||||
onRefresh = { onRefresh(account.id) },
|
onRefresh = { onRefresh(currentAccount.id) },
|
||||||
onPrepareCaptcha = { onPrepareCaptcha(account.id) },
|
onPrepareCaptcha = { onPrepareCaptcha(currentAccount.id) },
|
||||||
onSaveSettings = onSaveSettings
|
onSaveSettings = onSaveSettings
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -112,69 +158,51 @@ private fun AccountDetailContent(
|
|||||||
val account = detail.summary
|
val account = detail.summary
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = modifier.fillMaxSize(),
|
modifier = modifier.fillMaxSize(),
|
||||||
contentPadding = PaddingValues(16.dp),
|
contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 24.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(14.dp)
|
verticalArrangement = Arrangement.spacedBy(14.dp)
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
Card(
|
AccountHero(
|
||||||
shape = RoundedCornerShape(8.dp),
|
account = account,
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)
|
busy = busy,
|
||||||
) {
|
onRefresh = onRefresh,
|
||||||
Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(14.dp)) {
|
onPrepareCaptcha = onPrepareCaptcha
|
||||||
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
|
)
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
|
||||||
Text(account.serviceType.displayName, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
|
||||||
Text(account.remainingDisplay, style = MaterialTheme.typography.headlineMedium, fontWeight = FontWeight.Bold)
|
|
||||||
}
|
}
|
||||||
StatusChip(account.status)
|
item {
|
||||||
}
|
ModernPanel {
|
||||||
UsageBar(account.remainingBytes, account.totalBytes, account.totalDisplay)
|
SectionHeader(
|
||||||
account.lastErrorMessage?.let {
|
title = "Refresh health",
|
||||||
Text(it, color = MaterialTheme.colorScheme.error)
|
subtitle = "The timestamps below show scheduler state and last successful data capture."
|
||||||
|
)
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
|
MetricPill("Interval", account.refreshInterval.displayName, Modifier.weight(1f))
|
||||||
|
MetricPill("Next", account.nextRefreshAt.formatTimestamp(), Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
InfoRow("Login", account.loginIdentifier)
|
InfoRow("Login", account.loginIdentifier)
|
||||||
InfoRow("Refresh interval", account.refreshInterval.displayName)
|
|
||||||
account.expiresAtText?.let { InfoRow("Package expiry", it) }
|
account.expiresAtText?.let { InfoRow("Package expiry", it) }
|
||||||
InfoRow("Last refresh", account.lastRefreshAt.formatTimestamp())
|
InfoRow("Last refresh", account.lastRefreshAt.formatTimestamp())
|
||||||
InfoRow("Last success", account.lastSuccessAt.formatTimestamp())
|
InfoRow("Last success", account.lastSuccessAt.formatTimestamp())
|
||||||
InfoRow("Next refresh", account.nextRefreshAt.formatTimestamp())
|
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
|
||||||
Button(
|
|
||||||
onClick = onRefresh,
|
|
||||||
enabled = !busy && account.enabled,
|
|
||||||
modifier = Modifier.weight(1f)
|
|
||||||
) {
|
|
||||||
Icon(Icons.Default.Refresh, contentDescription = null)
|
|
||||||
Text(if (busy) "Refreshing" else "Refresh", modifier = Modifier.padding(start = 8.dp))
|
|
||||||
}
|
|
||||||
if (account.status == AccountStatus.CAPTCHA_REQUIRED) {
|
|
||||||
OutlinedButton(
|
|
||||||
onClick = onPrepareCaptcha,
|
|
||||||
enabled = !busy,
|
|
||||||
modifier = Modifier.weight(1f)
|
|
||||||
) {
|
|
||||||
Text("Captcha")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item {
|
item {
|
||||||
AccountSettingsCard(account, onSaveSettings)
|
AccountSettingsPanel(account, onSaveSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
Text("Packages", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
SectionHeader(
|
||||||
|
title = "Packages",
|
||||||
|
subtitle = if (detail.packages.isEmpty()) "No package details reported yet." else "${detail.packages.size} package record${if (detail.packages.size == 1) "" else "s"}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if (detail.packages.isEmpty()) {
|
if (detail.packages.isEmpty()) {
|
||||||
item {
|
item {
|
||||||
|
ModernPanel {
|
||||||
Text(
|
Text(
|
||||||
"No package details reported yet.",
|
"Refresh this account to import package-level usage data.",
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
items(detail.packages, key = { it.id }) { item ->
|
items(detail.packages, key = { it.id }) { item ->
|
||||||
PackageRow(item)
|
PackageRow(item)
|
||||||
@@ -183,9 +211,105 @@ private fun AccountDetailContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun AccountHero(
|
||||||
|
account: AccountSummary,
|
||||||
|
busy: Boolean,
|
||||||
|
onRefresh: () -> Unit,
|
||||||
|
onPrepareCaptcha: () -> Unit
|
||||||
|
) {
|
||||||
|
val accent = account.serviceType.accentColor()
|
||||||
|
val progress = remainingProgress(account.remainingBytes, account.totalBytes)
|
||||||
|
Surface(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = Color.Transparent,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
|
border = BorderStroke(1.dp, accent.copy(alpha = 0.35f))
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.background(
|
||||||
|
Brush.linearGradient(
|
||||||
|
listOf(
|
||||||
|
accent.copy(alpha = 0.24f),
|
||||||
|
MaterialTheme.colorScheme.surfaceContainer.copy(alpha = 0.94f),
|
||||||
|
MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.45f)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.padding(18.dp)
|
||||||
|
) {
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
|
Row(verticalAlignment = Alignment.Top, modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
ServiceBadge(account.serviceType)
|
||||||
|
StatusChip(if (busy) AccountStatus.REFRESHING else account.status)
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
account.remainingDisplay,
|
||||||
|
style = MaterialTheme.typography.displaySmall,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
"Available balance for ${account.displayName}",
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.width(12.dp))
|
||||||
|
QuotaRing(
|
||||||
|
progress = progress,
|
||||||
|
value = account.remainingDisplay,
|
||||||
|
label = "remaining",
|
||||||
|
accent = accent,
|
||||||
|
modifier = Modifier.size(132.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
UsageBar(
|
||||||
|
remainingBytes = account.remainingBytes,
|
||||||
|
totalBytes = account.totalBytes,
|
||||||
|
totalDisplay = account.totalDisplay
|
||||||
|
)
|
||||||
|
account.lastErrorMessage?.let {
|
||||||
|
Surface(
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = MaterialTheme.colorScheme.error.copy(alpha = 0.12f),
|
||||||
|
contentColor = MaterialTheme.colorScheme.error,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(it, modifier = Modifier.padding(10.dp), style = MaterialTheme.typography.bodySmall)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
|
Button(
|
||||||
|
onClick = onRefresh,
|
||||||
|
enabled = !busy && account.enabled,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Icon(Icons.Default.Refresh, contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
|
Text(if (busy) "Refreshing" else "Refresh now", modifier = Modifier.padding(start = 8.dp))
|
||||||
|
}
|
||||||
|
if (account.status == AccountStatus.CAPTCHA_REQUIRED) {
|
||||||
|
OutlinedButton(
|
||||||
|
onClick = onPrepareCaptcha,
|
||||||
|
enabled = !busy,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Text("Solve captcha")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
private fun AccountSettingsCard(
|
private fun AccountSettingsPanel(
|
||||||
account: AccountSummary,
|
account: AccountSummary,
|
||||||
onSaveSettings: (AccountSummary, RefreshInterval, Boolean, Long, Int, Boolean) -> Unit
|
onSaveSettings: (AccountSummary, RefreshInterval, Boolean, Long, Int, Boolean) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -195,20 +319,24 @@ private fun AccountSettingsCard(
|
|||||||
var thresholdMb by rememberSaveable(account.id) { mutableStateOf(account.lowDataThresholdMb.toString()) }
|
var thresholdMb by rememberSaveable(account.id) { mutableStateOf(account.lowDataThresholdMb.toString()) }
|
||||||
var expiryDays by rememberSaveable(account.id) { mutableStateOf(account.expiryThresholdDays.toString()) }
|
var expiryDays by rememberSaveable(account.id) { mutableStateOf(account.expiryThresholdDays.toString()) }
|
||||||
|
|
||||||
Card(
|
ModernPanel {
|
||||||
shape = RoundedCornerShape(8.dp),
|
SectionHeader(
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)
|
title = "Automation",
|
||||||
) {
|
subtitle = "Tune background refresh and warning thresholds for this account."
|
||||||
Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(14.dp)) {
|
)
|
||||||
Text("Account settings", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
ToggleRow(
|
||||||
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
|
title = "Account enabled",
|
||||||
Column(Modifier.weight(1f)) {
|
description = "Pause refreshes without deleting credentials.",
|
||||||
Text("Enabled", fontWeight = FontWeight.Medium)
|
checked = enabled,
|
||||||
Text("Background refresh is paused when disabled.", color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodySmall)
|
onCheckedChange = { enabled = it }
|
||||||
}
|
)
|
||||||
Switch(checked = enabled, onCheckedChange = { enabled = it })
|
ToggleRow(
|
||||||
}
|
title = "Alerts",
|
||||||
Text("Refresh interval", fontWeight = FontWeight.Medium)
|
description = "Notify for low data, expiry, captcha, and failed refreshes.",
|
||||||
|
checked = alertsEnabled,
|
||||||
|
onCheckedChange = { alertsEnabled = it }
|
||||||
|
)
|
||||||
|
Text("Refresh interval", fontWeight = FontWeight.SemiBold)
|
||||||
RefreshInterval.entries.chunked(2).forEach { rowOptions ->
|
RefreshInterval.entries.chunked(2).forEach { rowOptions ->
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
|
||||||
rowOptions.forEach { option ->
|
rowOptions.forEach { option ->
|
||||||
@@ -221,28 +349,26 @@ private fun AccountSettingsCard(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (rowOptions.size == 1) {
|
if (rowOptions.size == 1) {
|
||||||
Column(Modifier.weight(1f)) {}
|
Spacer(Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
Text("Alerts", fontWeight = FontWeight.Medium)
|
|
||||||
Switch(checked = alertsEnabled, onCheckedChange = { alertsEnabled = it })
|
|
||||||
}
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = thresholdMb,
|
value = thresholdMb,
|
||||||
onValueChange = { thresholdMb = it.filter(Char::isDigit) },
|
onValueChange = { thresholdMb = it.filter(Char::isDigit) },
|
||||||
label = { Text("Low data threshold (MB)") },
|
label = { Text("Low data MB") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.weight(1f)
|
||||||
)
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = expiryDays,
|
value = expiryDays,
|
||||||
onValueChange = { expiryDays = it.filter(Char::isDigit) },
|
onValueChange = { expiryDays = it.filter(Char::isDigit) },
|
||||||
label = { Text("Expiry warning threshold (days)") },
|
label = { Text("Expiry days") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.weight(1f)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
Button(
|
Button(
|
||||||
onClick = {
|
onClick = {
|
||||||
onSaveSettings(
|
onSaveSettings(
|
||||||
@@ -256,30 +382,63 @@ private fun AccountSettingsCard(
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Text("Save settings")
|
Text("Save automation")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PackageRow(item: UsagePackageEntity) {
|
private fun ToggleRow(
|
||||||
Card(
|
title: String,
|
||||||
shape = RoundedCornerShape(8.dp),
|
description: String,
|
||||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow)
|
checked: Boolean,
|
||||||
|
onCheckedChange: (Boolean) -> Unit
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Column(Modifier.padding(14.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||||
Text(item.name, fontWeight = FontWeight.SemiBold)
|
Text(title, fontWeight = FontWeight.SemiBold)
|
||||||
Text(item.remainingDisplay, style = MaterialTheme.typography.titleMedium)
|
Text(
|
||||||
item.expiresAtText?.let {
|
description,
|
||||||
Text("Expires: $it", color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodySmall)
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Switch(checked = checked, onCheckedChange = onCheckedChange)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun PackageRow(item: UsagePackageEntity) {
|
||||||
|
ModernPanel(contentPadding = PaddingValues(14.dp)) {
|
||||||
|
Row(verticalAlignment = Alignment.Top, modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||||
|
Text(item.name, fontWeight = FontWeight.Bold, style = MaterialTheme.typography.titleMedium)
|
||||||
|
Text(item.remainingDisplay, style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.Bold)
|
||||||
}
|
}
|
||||||
item.statusText?.let {
|
item.statusText?.let {
|
||||||
Text(it, color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodySmall)
|
Surface(
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = MaterialTheme.colorScheme.surfaceContainerHighest,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
) {
|
||||||
|
Text(it, style = MaterialTheme.typography.labelSmall, modifier = Modifier.padding(horizontal = 9.dp, vertical = 6.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UsageBar(
|
||||||
|
remainingBytes = item.remainingBytes,
|
||||||
|
totalBytes = item.totalBytes,
|
||||||
|
totalDisplay = item.totalBytes?.asTrafficDisplay()
|
||||||
|
)
|
||||||
|
item.expiresAtText?.let {
|
||||||
|
InfoRow("Expires", it)
|
||||||
}
|
}
|
||||||
item.detail?.takeIf { it.isNotBlank() }?.let {
|
item.detail?.takeIf { it.isNotBlank() }?.let {
|
||||||
Text(it, color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodySmall)
|
Text(it, color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodySmall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
package net.rodakot.remaining.ui.screens
|
package net.rodakot.remaining.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.foundation.BorderStroke
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
@@ -22,15 +27,19 @@ import androidx.compose.material3.IconButton
|
|||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||||
import androidx.compose.ui.text.input.VisualTransformation
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
@@ -38,6 +47,11 @@ import androidx.compose.ui.unit.dp
|
|||||||
import net.rodakot.remaining.data.CreateAccountRequest
|
import net.rodakot.remaining.data.CreateAccountRequest
|
||||||
import net.rodakot.remaining.domain.RefreshInterval
|
import net.rodakot.remaining.domain.RefreshInterval
|
||||||
import net.rodakot.remaining.domain.ServiceType
|
import net.rodakot.remaining.domain.ServiceType
|
||||||
|
import net.rodakot.remaining.ui.components.ModernPanel
|
||||||
|
import net.rodakot.remaining.ui.components.RemainingBackground
|
||||||
|
import net.rodakot.remaining.ui.components.SectionHeader
|
||||||
|
import net.rodakot.remaining.ui.components.ServiceBadge
|
||||||
|
import net.rodakot.remaining.ui.components.accentColor
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -60,16 +74,62 @@ fun AddAccountScreen(
|
|||||||
var expiryDays by rememberSaveable { mutableStateOf("3") }
|
var expiryDays by rememberSaveable { mutableStateOf("3") }
|
||||||
val canSave = username.isNotBlank() && password.isNotBlank() && !saving
|
val canSave = username.isNotBlank() && password.isNotBlank() && !saving
|
||||||
|
|
||||||
|
RemainingBackground {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Add account") },
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
|
scrolledContainerColor = Color.Transparent
|
||||||
|
),
|
||||||
|
title = {
|
||||||
|
Column {
|
||||||
|
Text("Connect account", fontWeight = FontWeight.Bold)
|
||||||
|
Text(
|
||||||
|
service.displayName,
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
bottomBar = {
|
||||||
|
Surface(
|
||||||
|
color = MaterialTheme.colorScheme.surfaceContainer.copy(alpha = 0.94f),
|
||||||
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.50f))
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
onCreateAccount(
|
||||||
|
CreateAccountRequest(
|
||||||
|
serviceType = service,
|
||||||
|
displayName = displayName.trim(),
|
||||||
|
loginIdentifier = username.trim(),
|
||||||
|
password = password,
|
||||||
|
refreshIntervalMinutes = interval.minutes,
|
||||||
|
alertsEnabled = alertsEnabled,
|
||||||
|
lowDataThresholdMb = thresholdMb.toLongOrNull()?.coerceAtLeast(1) ?: 1024,
|
||||||
|
expiryThresholdDays = expiryDays.toIntOrNull()?.coerceAtLeast(1) ?: 3
|
||||||
|
)
|
||||||
|
)
|
||||||
|
onBack()
|
||||||
|
},
|
||||||
|
enabled = canSave,
|
||||||
|
contentPadding = PaddingValues(vertical = 14.dp),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(16.dp)
|
||||||
|
) {
|
||||||
|
Text(if (saving) "Saving" else "Save and start tracking")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
Column(
|
Column(
|
||||||
@@ -77,40 +137,39 @@ fun AddAccountScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding)
|
.padding(padding)
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
.padding(16.dp),
|
.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 24.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(18.dp)
|
verticalArrangement = Arrangement.spacedBy(14.dp)
|
||||||
) {
|
) {
|
||||||
SectionTitle("Service")
|
ModernPanel {
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
|
SectionHeader(
|
||||||
|
title = "Choose service",
|
||||||
|
subtitle = "Each provider keeps its own login method and refresh behavior."
|
||||||
|
)
|
||||||
ServiceType.entries.forEach { option ->
|
ServiceType.entries.forEach { option ->
|
||||||
FilterChip(
|
ServiceOption(
|
||||||
|
option = option,
|
||||||
selected = service == option,
|
selected = service == option,
|
||||||
onClick = { service = option },
|
onSelected = { service = option }
|
||||||
label = { Text(option.shortName) },
|
|
||||||
shape = RoundedCornerShape(8.dp)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text(
|
|
||||||
text = when (service) {
|
|
||||||
ServiceType.MCI -> "Use your My MCI phone number and password."
|
|
||||||
ServiceType.JAHAN_NAMA -> "Use your Webotel/Jahan Nama username and password."
|
|
||||||
ServiceType.TCI -> "TCI needs a manual captcha after the account is saved."
|
|
||||||
},
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
|
|
||||||
SectionTitle("Credentials")
|
ModernPanel {
|
||||||
|
SectionHeader(
|
||||||
|
title = "Credentials",
|
||||||
|
subtitle = service.helperText()
|
||||||
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = displayName,
|
value = displayName,
|
||||||
onValueChange = { displayName = it },
|
onValueChange = { displayName = it },
|
||||||
label = { Text("Display name") },
|
label = { Text("Display name") },
|
||||||
|
placeholder = { Text("${service.shortName} home line") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = username,
|
value = username,
|
||||||
onValueChange = { username = it.trim() },
|
onValueChange = { username = it },
|
||||||
label = { Text(if (service == ServiceType.MCI) "Phone number" else "Username") },
|
label = { Text(if (service == ServiceType.MCI) "Phone number" else "Username") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
@@ -131,74 +190,105 @@ fun AddAccountScreen(
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
SectionTitle("Refresh")
|
ModernPanel {
|
||||||
|
SectionHeader(
|
||||||
|
title = "Refresh rhythm",
|
||||||
|
subtitle = "Shorter intervals update faster and use more background work."
|
||||||
|
)
|
||||||
PresetChips(
|
PresetChips(
|
||||||
options = RefreshInterval.entries,
|
options = RefreshInterval.entries,
|
||||||
selected = interval,
|
selected = interval,
|
||||||
label = { it.displayName },
|
label = { it.displayName },
|
||||||
onSelected = { interval = it }
|
onSelected = { interval = it }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
SectionTitle("Alerts")
|
ModernPanel {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
SectionHeader(
|
||||||
Text("Enable account alerts", fontWeight = FontWeight.Medium)
|
title = "Alerts",
|
||||||
Text(
|
subtitle = "Low data, failed refreshes, and captcha requests.",
|
||||||
"Low data, failed refreshes, and captcha requests",
|
modifier = Modifier.weight(1f)
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
style = MaterialTheme.typography.bodySmall
|
|
||||||
)
|
)
|
||||||
}
|
|
||||||
Switch(checked = alertsEnabled, onCheckedChange = { alertsEnabled = it })
|
Switch(checked = alertsEnabled, onCheckedChange = { alertsEnabled = it })
|
||||||
}
|
}
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = thresholdMb,
|
value = thresholdMb,
|
||||||
onValueChange = { thresholdMb = it.filter(Char::isDigit) },
|
onValueChange = { thresholdMb = it.filter(Char::isDigit) },
|
||||||
label = { Text("Low data threshold (MB)") },
|
label = { Text("Low data MB") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.weight(1f)
|
||||||
)
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = expiryDays,
|
value = expiryDays,
|
||||||
onValueChange = { expiryDays = it.filter(Char::isDigit) },
|
onValueChange = { expiryDays = it.filter(Char::isDigit) },
|
||||||
label = { Text("Expiry warning threshold (days)") },
|
label = { Text("Expiry days") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.weight(1f)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
Button(
|
}
|
||||||
onClick = {
|
|
||||||
onCreateAccount(
|
|
||||||
CreateAccountRequest(
|
|
||||||
serviceType = service,
|
|
||||||
displayName = displayName.trim(),
|
|
||||||
loginIdentifier = username.trim(),
|
|
||||||
password = password,
|
|
||||||
refreshIntervalMinutes = interval.minutes,
|
|
||||||
alertsEnabled = alertsEnabled,
|
|
||||||
lowDataThresholdMb = thresholdMb.toLongOrNull()?.coerceAtLeast(1) ?: 1024,
|
|
||||||
expiryThresholdDays = expiryDays.toIntOrNull()?.coerceAtLeast(1) ?: 3
|
|
||||||
)
|
|
||||||
)
|
|
||||||
onBack()
|
|
||||||
},
|
|
||||||
enabled = canSave,
|
|
||||||
contentPadding = PaddingValues(vertical = 14.dp),
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
) {
|
|
||||||
Text(if (saving) "Saving" else "Save account")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SectionTitle(text: String) {
|
private fun ServiceOption(
|
||||||
Text(text, style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
option: ServiceType,
|
||||||
|
selected: Boolean,
|
||||||
|
onSelected: () -> Unit
|
||||||
|
) {
|
||||||
|
val accent = option.accentColor()
|
||||||
|
Surface(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clickable(onClick = onSelected),
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = if (selected) accent.copy(alpha = 0.16f) else MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = 0.62f),
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
|
border = BorderStroke(
|
||||||
|
1.dp,
|
||||||
|
if (selected) accent.copy(alpha = 0.72f) else MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.50f)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(13.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
ServiceBadge(option)
|
||||||
|
Spacer(modifier = Modifier.width(12.dp))
|
||||||
|
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||||
|
Text(option.displayName, fontWeight = FontWeight.Bold)
|
||||||
|
Text(
|
||||||
|
option.helperText(),
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (selected) {
|
||||||
|
Surface(
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = accent,
|
||||||
|
contentColor = Color.White
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
"Selected",
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
modifier = Modifier.padding(horizontal = 8.dp, vertical = 5.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -222,9 +312,16 @@ private fun <T> PresetChips(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (rowOptions.size == 1) {
|
if (rowOptions.size == 1) {
|
||||||
Column(modifier = Modifier.weight(1f)) {}
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun ServiceType.helperText(): String =
|
||||||
|
when (this) {
|
||||||
|
ServiceType.MCI -> "Use your My MCI phone number and password."
|
||||||
|
ServiceType.JAHAN_NAMA -> "Use your Webotel/Jahan Nama username and password."
|
||||||
|
ServiceType.TCI -> "TCI needs a manual captcha after the account is saved."
|
||||||
|
}
|
||||||
@@ -1,13 +1,19 @@
|
|||||||
package net.rodakot.remaining.ui.screens
|
package net.rodakot.remaining.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.foundation.BorderStroke
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
@@ -25,22 +31,35 @@ import androidx.compose.material3.IconButton
|
|||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import net.rodakot.remaining.data.AccountSummary
|
import net.rodakot.remaining.data.AccountSummary
|
||||||
import net.rodakot.remaining.domain.AccountStatus
|
import net.rodakot.remaining.domain.AccountStatus
|
||||||
import net.rodakot.remaining.domain.asTrafficDisplay
|
import net.rodakot.remaining.domain.asTrafficDisplay
|
||||||
import net.rodakot.remaining.ui.RemainingUiState
|
import net.rodakot.remaining.ui.RemainingUiState
|
||||||
import net.rodakot.remaining.ui.components.MetricPill
|
import net.rodakot.remaining.ui.components.MetricPill
|
||||||
|
import net.rodakot.remaining.ui.components.ModernPanel
|
||||||
|
import net.rodakot.remaining.ui.components.QuotaBar
|
||||||
|
import net.rodakot.remaining.ui.components.QuotaRing
|
||||||
|
import net.rodakot.remaining.ui.components.RemainingBackground
|
||||||
|
import net.rodakot.remaining.ui.components.SectionHeader
|
||||||
|
import net.rodakot.remaining.ui.components.ServiceBadge
|
||||||
import net.rodakot.remaining.ui.components.StatusChip
|
import net.rodakot.remaining.ui.components.StatusChip
|
||||||
import net.rodakot.remaining.ui.components.UsageBar
|
import net.rodakot.remaining.ui.components.UsageBar
|
||||||
|
import net.rodakot.remaining.ui.components.accentColor
|
||||||
import net.rodakot.remaining.ui.components.formatTimestamp
|
import net.rodakot.remaining.ui.components.formatTimestamp
|
||||||
|
import net.rodakot.remaining.ui.components.remainingProgress
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -52,14 +71,20 @@ fun DashboardScreen(
|
|||||||
onPrepareCaptcha: (String) -> Unit,
|
onPrepareCaptcha: (String) -> Unit,
|
||||||
onOpenSettings: () -> Unit
|
onOpenSettings: () -> Unit
|
||||||
) {
|
) {
|
||||||
|
RemainingBackground {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
|
scrolledContainerColor = Color.Transparent
|
||||||
|
),
|
||||||
title = {
|
title = {
|
||||||
Column {
|
Column {
|
||||||
Text("Remaining", fontWeight = FontWeight.Bold)
|
Text("Remaining", fontWeight = FontWeight.Bold)
|
||||||
Text(
|
Text(
|
||||||
"Usage across all accounts",
|
"${state.accounts.size} connected account${if (state.accounts.size == 1) "" else "s"}",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
@@ -88,12 +113,19 @@ fun DashboardScreen(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding),
|
.padding(padding),
|
||||||
contentPadding = PaddingValues(16.dp),
|
contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 24.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(14.dp)
|
verticalArrangement = Arrangement.spacedBy(14.dp)
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
OverviewCard(accounts = state.accounts)
|
OverviewCard(accounts = state.accounts)
|
||||||
}
|
}
|
||||||
|
item {
|
||||||
|
SectionHeader(
|
||||||
|
title = "Accounts",
|
||||||
|
subtitle = "Tap an account for packages, refresh settings, and history.",
|
||||||
|
modifier = Modifier.padding(top = 4.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
items(state.accounts, key = { it.id }) { account ->
|
items(state.accounts, key = { it.id }) { account ->
|
||||||
AccountCard(
|
AccountCard(
|
||||||
account = account,
|
account = account,
|
||||||
@@ -106,75 +138,124 @@ fun DashboardScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun EmptyDashboard(modifier: Modifier = Modifier, onAddAccount: () -> Unit) {
|
private fun EmptyDashboard(modifier: Modifier = Modifier, onAddAccount: () -> Unit) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier.padding(24.dp),
|
modifier = modifier.padding(24.dp),
|
||||||
verticalArrangement = Arrangement.Center
|
verticalArrangement = Arrangement.Center,
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
|
ModernPanel(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
contentPadding = PaddingValues(22.dp)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(18.dp),
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
QuotaRing(progress = null, label = "dashboard", value = "Ready")
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
Text(
|
Text(
|
||||||
"Track every service account in one dashboard.",
|
"Your usage command center",
|
||||||
style = MaterialTheme.typography.headlineSmall,
|
style = MaterialTheme.typography.headlineSmall,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
"Add MCI, Jahan Nama/Webotel, or TCI accounts, then choose how often each one refreshes.",
|
"Connect MCI, Webotel, or TCI and the app will keep quota, refresh health, and alerts in one clean view.",
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
modifier = Modifier.padding(top = 10.dp, bottom = 22.dp)
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
modifier = Modifier.padding(top = 8.dp)
|
||||||
)
|
)
|
||||||
Button(onClick = onAddAccount) {
|
}
|
||||||
|
Button(onClick = onAddAccount, modifier = Modifier.fillMaxWidth()) {
|
||||||
Icon(Icons.Default.Add, contentDescription = null)
|
Icon(Icons.Default.Add, contentDescription = null)
|
||||||
Text("Add account", modifier = Modifier.padding(start = 8.dp))
|
Text("Connect first account", modifier = Modifier.padding(start = 8.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun OverviewCard(accounts: List<AccountSummary>) {
|
private fun OverviewCard(accounts: List<AccountSummary>) {
|
||||||
val totalRemaining = remember(accounts) {
|
val knownRemaining = remember(accounts) { accounts.mapNotNull { it.remainingBytes } }
|
||||||
accounts.mapNotNull { it.remainingBytes }.sum()
|
val totalRemaining = remember(knownRemaining) { knownRemaining.takeIf { it.isNotEmpty() }?.sum() }
|
||||||
}
|
val knownTotal = remember(accounts) { accounts.mapNotNull { it.totalBytes } }
|
||||||
|
val totalQuota = remember(knownTotal) { knownTotal.takeIf { it.isNotEmpty() }?.sum() }
|
||||||
val issueCount = accounts.count {
|
val issueCount = accounts.count {
|
||||||
it.status == AccountStatus.ERROR ||
|
it.status == AccountStatus.ERROR ||
|
||||||
it.status == AccountStatus.CAPTCHA_REQUIRED ||
|
it.status == AccountStatus.CAPTCHA_REQUIRED ||
|
||||||
it.status == AccountStatus.NEEDS_AUTH
|
it.status == AccountStatus.NEEDS_AUTH
|
||||||
}
|
}
|
||||||
|
val activeCount = accounts.count { it.status == AccountStatus.ACTIVE }
|
||||||
val nextRefresh = accounts.mapNotNull { it.nextRefreshAt }.minOrNull()
|
val nextRefresh = accounts.mapNotNull { it.nextRefreshAt }.minOrNull()
|
||||||
|
val progress = remainingProgress(totalRemaining, totalQuota)
|
||||||
|
|
||||||
Column(
|
Surface(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = Color.Transparent,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.30f))
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
|
||||||
.background(
|
.background(
|
||||||
Brush.linearGradient(
|
Brush.linearGradient(
|
||||||
colors = listOf(
|
listOf(
|
||||||
MaterialTheme.colorScheme.primaryContainer,
|
MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.88f),
|
||||||
MaterialTheme.colorScheme.secondaryContainer
|
MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.70f),
|
||||||
|
MaterialTheme.colorScheme.surfaceContainer.copy(alpha = 0.94f)
|
||||||
)
|
)
|
||||||
),
|
|
||||||
RoundedCornerShape(8.dp)
|
|
||||||
)
|
)
|
||||||
.padding(16.dp),
|
)
|
||||||
verticalArrangement = Arrangement.spacedBy(14.dp)
|
.padding(18.dp)
|
||||||
) {
|
) {
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
Text(
|
Text(
|
||||||
"Dashboard",
|
"Live quota",
|
||||||
style = MaterialTheme.typography.titleLarge,
|
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
|
style = MaterialTheme.typography.labelLarge
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
totalRemaining?.asTrafficDisplay() ?: "Unknown",
|
||||||
|
style = MaterialTheme.typography.displaySmall,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
color = MaterialTheme.colorScheme.onPrimaryContainer
|
color = MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
)
|
)
|
||||||
|
Text(
|
||||||
|
"Remaining across every connected service",
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
|
QuotaRing(
|
||||||
|
progress = progress,
|
||||||
|
value = totalRemaining?.asTrafficDisplay() ?: "--",
|
||||||
|
label = "left"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
QuotaBar(progress = progress)
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
MetricPill("Remaining", totalRemaining.asTrafficDisplay(), Modifier.weight(1f))
|
MetricPill("Active", activeCount.toString(), Modifier.weight(1f))
|
||||||
MetricPill("Accounts", accounts.size.toString(), Modifier.weight(1f))
|
MetricPill("Needs action", issueCount.toString(), Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
MetricPill("Needs action", issueCount.toString(), Modifier.weight(1f))
|
MetricPill("Accounts", accounts.size.toString(), Modifier.weight(1f))
|
||||||
MetricPill("Next refresh", nextRefresh.formatTimestamp(), Modifier.weight(1f))
|
MetricPill("Next refresh", nextRefresh.formatTimestamp(), Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun AccountCard(
|
private fun AccountCard(
|
||||||
account: AccountSummary,
|
account: AccountSummary,
|
||||||
@@ -183,54 +264,115 @@ private fun AccountCard(
|
|||||||
onRefresh: () -> Unit,
|
onRefresh: () -> Unit,
|
||||||
onPrepareCaptcha: () -> Unit
|
onPrepareCaptcha: () -> Unit
|
||||||
) {
|
) {
|
||||||
|
val accent = account.serviceType.accentColor()
|
||||||
Card(
|
Card(
|
||||||
onClick = onOpen,
|
onClick = onOpen,
|
||||||
shape = RoundedCornerShape(8.dp),
|
shape = RoundedCornerShape(8.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = CardDefaults.cardColors(
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainer
|
containerColor = MaterialTheme.colorScheme.surfaceContainer.copy(alpha = 0.92f),
|
||||||
)
|
contentColor = MaterialTheme.colorScheme.onSurface
|
||||||
|
),
|
||||||
|
border = BorderStroke(1.dp, MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.45f))
|
||||||
) {
|
) {
|
||||||
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(4.dp)
|
||||||
|
.background(accent)
|
||||||
|
)
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
verticalArrangement = Arrangement.spacedBy(13.dp)
|
||||||
) {
|
) {
|
||||||
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
|
Row(
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
Text(account.displayName, style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
verticalAlignment = Alignment.Top,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(7.dp)) {
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
ServiceBadge(account.serviceType)
|
||||||
|
if (!account.enabled) {
|
||||||
|
StatusChip(AccountStatus.DISABLED)
|
||||||
|
}
|
||||||
|
}
|
||||||
Text(
|
Text(
|
||||||
"${account.serviceType.displayName} • ${account.loginIdentifier}",
|
account.displayName,
|
||||||
|
style = MaterialTheme.typography.titleLarge,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
account.loginIdentifier,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
StatusChip(account.status)
|
Spacer(modifier = Modifier.width(10.dp))
|
||||||
|
StatusChip(if (busy) AccountStatus.REFRESHING else account.status)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
Row(verticalAlignment = Alignment.Bottom, modifier = Modifier.fillMaxWidth()) {
|
||||||
Text("Remaining", color = MaterialTheme.colorScheme.onSurfaceVariant)
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text(account.remainingDisplay, style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.Bold)
|
Text(
|
||||||
|
"Remaining",
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.labelMedium
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
account.remainingDisplay,
|
||||||
|
style = MaterialTheme.typography.headlineMedium,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
Surface(
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = accent.copy(alpha = 0.13f),
|
||||||
|
contentColor = accent
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
account.refreshInterval.displayName,
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
modifier = Modifier.padding(horizontal = 9.dp, vertical = 6.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UsageBar(
|
UsageBar(
|
||||||
remainingBytes = account.remainingBytes,
|
remainingBytes = account.remainingBytes,
|
||||||
totalBytes = account.totalBytes,
|
totalBytes = account.totalBytes,
|
||||||
totalDisplay = account.totalDisplay
|
totalDisplay = account.totalDisplay
|
||||||
)
|
)
|
||||||
account.lastErrorMessage?.let {
|
account.lastErrorMessage?.let {
|
||||||
|
Surface(
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
color = MaterialTheme.colorScheme.error.copy(alpha = 0.12f),
|
||||||
|
contentColor = MaterialTheme.colorScheme.error,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
it,
|
it,
|
||||||
color = MaterialTheme.colorScheme.error,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
style = MaterialTheme.typography.bodySmall
|
modifier = Modifier.padding(10.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
FilledTonalButton(
|
FilledTonalButton(
|
||||||
onClick = onRefresh,
|
onClick = onRefresh,
|
||||||
enabled = !busy && account.enabled,
|
enabled = !busy && account.enabled,
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
) {
|
) {
|
||||||
Icon(Icons.Default.Refresh, contentDescription = null)
|
Icon(Icons.Default.Refresh, contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
Text(if (busy) "Refreshing" else "Refresh", modifier = Modifier.padding(start = 8.dp))
|
Text(if (busy) "Refreshing" else "Refresh", modifier = Modifier.padding(start = 8.dp))
|
||||||
}
|
}
|
||||||
if (account.status == AccountStatus.CAPTCHA_REQUIRED) {
|
if (account.status == AccountStatus.CAPTCHA_REQUIRED) {
|
||||||
@@ -254,4 +396,5 @@ private fun AccountCard(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package net.rodakot.remaining.ui.screens
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -20,13 +21,19 @@ import androidx.compose.material3.Scaffold
|
|||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import net.rodakot.remaining.data.AppSettings
|
import net.rodakot.remaining.data.AppSettings
|
||||||
import net.rodakot.remaining.domain.RefreshInterval
|
import net.rodakot.remaining.domain.RefreshInterval
|
||||||
import net.rodakot.remaining.domain.ThemePreference
|
import net.rodakot.remaining.domain.ThemePreference
|
||||||
|
import net.rodakot.remaining.ui.components.ModernPanel
|
||||||
|
import net.rodakot.remaining.ui.components.RemainingBackground
|
||||||
|
import net.rodakot.remaining.ui.components.SectionHeader
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -37,10 +44,25 @@ fun SettingsScreen(
|
|||||||
onNotificationsChanged: (Boolean) -> Unit,
|
onNotificationsChanged: (Boolean) -> Unit,
|
||||||
onDefaultRefreshChanged: (RefreshInterval) -> Unit
|
onDefaultRefreshChanged: (RefreshInterval) -> Unit
|
||||||
) {
|
) {
|
||||||
|
RemainingBackground {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Settings") },
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = Color.Transparent,
|
||||||
|
scrolledContainerColor = Color.Transparent
|
||||||
|
),
|
||||||
|
title = {
|
||||||
|
Column {
|
||||||
|
Text("Settings", fontWeight = FontWeight.Bold)
|
||||||
|
Text(
|
||||||
|
"App-wide defaults",
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
||||||
@@ -54,42 +76,43 @@ fun SettingsScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding)
|
.padding(padding)
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
.padding(16.dp),
|
.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 24.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(18.dp)
|
verticalArrangement = Arrangement.spacedBy(14.dp)
|
||||||
) {
|
) {
|
||||||
Text("Appearance", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
ModernPanel {
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
|
SectionHeader(
|
||||||
|
title = "Appearance",
|
||||||
|
subtitle = "Choose a stable theme or follow the device setting."
|
||||||
|
)
|
||||||
ThemePreference.entries.forEach { option ->
|
ThemePreference.entries.forEach { option ->
|
||||||
FilterChip(
|
FilterChip(
|
||||||
selected = settings.themePreference == option,
|
selected = settings.themePreference == option,
|
||||||
onClick = { onThemeChanged(option) },
|
onClick = { onThemeChanged(option) },
|
||||||
label = { Text(option.displayName) },
|
label = { Text(option.displayName) },
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
shape = RoundedCornerShape(8.dp)
|
shape = RoundedCornerShape(8.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text("Notifications", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
ModernPanel {
|
||||||
Row(horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth()) {
|
SettingSwitchRow(
|
||||||
Column(Modifier.weight(1f)) {
|
title = "Global alerts",
|
||||||
Text("Global alerts", fontWeight = FontWeight.Medium)
|
description = "Controls refresh failures, captcha-needed alerts, and low-data alerts.",
|
||||||
Text(
|
|
||||||
"Controls refresh failures, captcha-needed alerts, and low-data alerts.",
|
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
style = MaterialTheme.typography.bodySmall
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Switch(
|
|
||||||
checked = settings.notificationsEnabled,
|
checked = settings.notificationsEnabled,
|
||||||
onCheckedChange = onNotificationsChanged
|
onCheckedChange = onNotificationsChanged
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Text("New accounts", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
ModernPanel {
|
||||||
|
SectionHeader(
|
||||||
|
title = "New account defaults",
|
||||||
|
subtitle = "These settings apply to accounts you connect later."
|
||||||
|
)
|
||||||
Text(
|
Text(
|
||||||
"Default refresh interval",
|
"Default refresh interval",
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
)
|
)
|
||||||
RefreshInterval.entries.chunked(2).forEach { rowOptions ->
|
RefreshInterval.entries.chunked(2).forEach { rowOptions ->
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth()) {
|
||||||
@@ -103,10 +126,36 @@ fun SettingsScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (rowOptions.size == 1) {
|
if (rowOptions.size == 1) {
|
||||||
Column(Modifier.weight(1f)) {}
|
Spacer(Modifier.weight(1f))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SettingSwitchRow(
|
||||||
|
title: String,
|
||||||
|
description: String,
|
||||||
|
checked: Boolean,
|
||||||
|
onCheckedChange: (Boolean) -> Unit
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(3.dp)) {
|
||||||
|
Text(title, fontWeight = FontWeight.SemiBold)
|
||||||
|
Text(
|
||||||
|
description,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Switch(checked = checked, onCheckedChange = onCheckedChange)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,17 +2,22 @@ package net.rodakot.remaining.ui.theme
|
|||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
val Blue80 = Color(0xFF8FD8FF)
|
val SignalGreen80 = Color(0xFF98F7C7)
|
||||||
val Green80 = Color(0xFF8FE7B0)
|
val Cyan80 = Color(0xFF8EEBFF)
|
||||||
val Amber80 = Color(0xFFFFD66B)
|
val Rose80 = Color(0xFFFF9DB2)
|
||||||
|
|
||||||
val Blue40 = Color(0xFF006B8F)
|
val SignalGreen40 = Color(0xFF006C54)
|
||||||
val Green40 = Color(0xFF006C46)
|
val Cyan40 = Color(0xFF00677A)
|
||||||
val Amber40 = Color(0xFF765A00)
|
val Rose40 = Color(0xFF9C2945)
|
||||||
|
|
||||||
val DarkBackground = Color(0xFF0D1117)
|
val DarkBackground = Color(0xFF070B0A)
|
||||||
val DarkSurface = Color(0xFF151B23)
|
val DarkSurface = Color(0xFF101613)
|
||||||
val DarkSurfaceVariant = Color(0xFF222B36)
|
val DarkSurfaceLow = Color(0xFF0C110F)
|
||||||
val LightBackground = Color(0xFFF7F9FC)
|
val DarkSurfaceHigh = Color(0xFF17211D)
|
||||||
|
val DarkSurfaceVariant = Color(0xFF22302B)
|
||||||
|
|
||||||
|
val LightBackground = Color(0xFFF7FBF5)
|
||||||
val LightSurface = Color(0xFFFFFFFF)
|
val LightSurface = Color(0xFFFFFFFF)
|
||||||
val LightSurfaceVariant = Color(0xFFE8EEF5)
|
val LightSurfaceLow = Color(0xFFEDF6EF)
|
||||||
|
val LightSurfaceHigh = Color(0xFFE4F1E8)
|
||||||
|
val LightSurfaceVariant = Color(0xFFDDEBE1)
|
||||||
@@ -7,24 +7,67 @@ import androidx.compose.material3.dynamicDarkColorScheme
|
|||||||
import androidx.compose.material3.dynamicLightColorScheme
|
import androidx.compose.material3.dynamicLightColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
private val DarkColorScheme = darkColorScheme(
|
private val DarkColorScheme = darkColorScheme(
|
||||||
primary = Blue80,
|
primary = SignalGreen80,
|
||||||
secondary = Green80,
|
onPrimary = Color(0xFF003826),
|
||||||
tertiary = Amber80,
|
primaryContainer = Color(0xFF0A3F31),
|
||||||
|
onPrimaryContainer = Color(0xFFC7FFE6),
|
||||||
|
secondary = Cyan80,
|
||||||
|
onSecondary = Color(0xFF003640),
|
||||||
|
secondaryContainer = Color(0xFF0B3D46),
|
||||||
|
onSecondaryContainer = Color(0xFFC5F6FF),
|
||||||
|
tertiary = Rose80,
|
||||||
|
onTertiary = Color(0xFF5A0B1F),
|
||||||
|
tertiaryContainer = Color(0xFF5D1C2B),
|
||||||
|
onTertiaryContainer = Color(0xFFFFD9E0),
|
||||||
background = DarkBackground,
|
background = DarkBackground,
|
||||||
|
onBackground = Color(0xFFE2EEE7),
|
||||||
surface = DarkSurface,
|
surface = DarkSurface,
|
||||||
surfaceVariant = DarkSurfaceVariant
|
onSurface = Color(0xFFE5EEE9),
|
||||||
|
surfaceVariant = DarkSurfaceVariant,
|
||||||
|
onSurfaceVariant = Color(0xFFB7C8C0),
|
||||||
|
surfaceContainerLowest = DarkBackground,
|
||||||
|
surfaceContainerLow = DarkSurfaceLow,
|
||||||
|
surfaceContainer = DarkSurface,
|
||||||
|
surfaceContainerHigh = DarkSurfaceHigh,
|
||||||
|
surfaceContainerHighest = Color(0xFF1C2823),
|
||||||
|
outline = Color(0xFF7B9188),
|
||||||
|
outlineVariant = Color(0xFF31453D),
|
||||||
|
error = Color(0xFFFF8A9A),
|
||||||
|
onError = Color(0xFF5F0717)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val LightColorScheme = lightColorScheme(
|
private val LightColorScheme = lightColorScheme(
|
||||||
primary = Blue40,
|
primary = SignalGreen40,
|
||||||
secondary = Green40,
|
onPrimary = Color.White,
|
||||||
tertiary = Amber40,
|
primaryContainer = Color(0xFFC9F5DF),
|
||||||
|
onPrimaryContainer = Color(0xFF002116),
|
||||||
|
secondary = Cyan40,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
secondaryContainer = Color(0xFFC4F3FF),
|
||||||
|
onSecondaryContainer = Color(0xFF001F26),
|
||||||
|
tertiary = Rose40,
|
||||||
|
onTertiary = Color.White,
|
||||||
|
tertiaryContainer = Color(0xFFFFD9E0),
|
||||||
|
onTertiaryContainer = Color(0xFF3F0011),
|
||||||
background = LightBackground,
|
background = LightBackground,
|
||||||
|
onBackground = Color(0xFF17211C),
|
||||||
surface = LightSurface,
|
surface = LightSurface,
|
||||||
surfaceVariant = LightSurfaceVariant
|
onSurface = Color(0xFF17211C),
|
||||||
|
surfaceVariant = LightSurfaceVariant,
|
||||||
|
onSurfaceVariant = Color(0xFF53635B),
|
||||||
|
surfaceContainerLowest = Color.White,
|
||||||
|
surfaceContainerLow = LightSurfaceLow,
|
||||||
|
surfaceContainer = LightSurface,
|
||||||
|
surfaceContainerHigh = LightSurfaceHigh,
|
||||||
|
surfaceContainerHighest = Color(0xFFD8E8DD),
|
||||||
|
outline = Color(0xFF72857B),
|
||||||
|
outlineVariant = Color(0xFFC2D4C8),
|
||||||
|
error = Color(0xFFBA1A1A),
|
||||||
|
onError = Color.White
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ import androidx.compose.ui.unit.sp
|
|||||||
|
|
||||||
// Set of Material typography styles to start with
|
// Set of Material typography styles to start with
|
||||||
val Typography = Typography(
|
val Typography = Typography(
|
||||||
|
displaySmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 34.sp,
|
||||||
|
lineHeight = 38.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
headlineMedium = TextStyle(
|
headlineMedium = TextStyle(
|
||||||
fontFamily = FontFamily.Default,
|
fontFamily = FontFamily.Default,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
@@ -15,6 +22,13 @@ val Typography = Typography(
|
|||||||
lineHeight = 34.sp,
|
lineHeight = 34.sp,
|
||||||
letterSpacing = 0.sp
|
letterSpacing = 0.sp
|
||||||
),
|
),
|
||||||
|
headlineSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 24.sp,
|
||||||
|
lineHeight = 30.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
titleLarge = TextStyle(
|
titleLarge = TextStyle(
|
||||||
fontFamily = FontFamily.Default,
|
fontFamily = FontFamily.Default,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
@@ -29,11 +43,46 @@ val Typography = Typography(
|
|||||||
lineHeight = 22.sp,
|
lineHeight = 22.sp,
|
||||||
letterSpacing = 0.sp
|
letterSpacing = 0.sp
|
||||||
),
|
),
|
||||||
|
titleSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
bodyLarge = TextStyle(
|
bodyLarge = TextStyle(
|
||||||
fontFamily = FontFamily.Default,
|
fontFamily = FontFamily.Default,
|
||||||
fontWeight = FontWeight.Normal,
|
fontWeight = FontWeight.Normal,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
lineHeight = 24.sp,
|
lineHeight = 24.sp,
|
||||||
letterSpacing = 0.sp
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
bodyMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
labelLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
labelMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
fontSize = 12.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
lineHeight = 14.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Reference in new issue
Block a user