Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/src/main/assets/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@
"Score {0} out of 100": "Pontuação {0} de 100",
"Scores are PulseLoop estimates from ring data compared with the user's own baseline, not medical measurements.": "As pontuações são estimativas do PulseLoop a partir dos dados do anel comparados com a linha de base do próprio usuário, não medidas médicas.",
"Screens in bed": "Telas na cama",
"Screens that have moved to it so far: Today, Vitals, Sleep, Symptom Radar.": "Telas que já usam o novo visual: Hoje, Vitais, Sono, Radar de sintomas.",
"Screens that have moved to it so far: Today, Vitals, Sleep, Activity, Symptom Radar.": "Telas que já usam o novo visual: Hoje, Vitais, Sono, Atividade, Radar de sintomas.",
"Searching…": "Procurando…",
"See Raw Packets above.": "Veja Pacotes brutos acima.",
"See Ring Events above.": "Veja Eventos do anel acima.",
Expand Down Expand Up @@ -1996,6 +1996,7 @@
"Week {0}: resting HR {1} · HRV {2}": "Semana {0}: FC em repouso {1} · HRV {2}",
"Weekly": "Semanal",
"Weekly Sleep": "Sono semanal",
"Weekly goal": "Meta semanal",
"Weekly limit": "Limite semanal",
"Weekly report": "Relatório semanal",
"Weekly target": "Meta semanal",
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/java/com/pulseloop/service/DailyGuidance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ import kotlin.math.roundToInt
*/

/** One overnight signal outside the user's typical range. */
data class OffSignal(val title: String, val detail: String)
data class OffSignal(val title: String, val detail: String) {
/**
* The title inside a running sentence ("Outside your usual: resting heart rate, HRV"):
* lower-cased, except an acronym, which a plain lowercase() turned into "hrv".
*/
val inSentence: String get() =
if (title.length > 1 && title[0].isUpperCase() && title[1].isUpperCase()) title else title.lowercase()
}

object VitalsCheck {
/** Nights needed before a typical range means anything. */
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/pulseloop/ui/components/VitalCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ private fun ValueRow(state: VitalCardState) {
val calmStatus = com.pulseloop.ui.calm.NewLook.on
Text(
if (calmStatus) state.statusText else state.statusText.uppercase(),
style = if (calmStatus) com.pulseloop.ui.calm.CalmType.title else com.pulseloop.ui.theme.PulseType.eyebrow,
// A step under the card's title, so the two don't compete (impeccable pass).
style = if (calmStatus) com.pulseloop.ui.calm.CalmType.bodySmall else com.pulseloop.ui.theme.PulseType.eyebrow,
fontWeight = FontWeight.SemiBold,

color = state.statusToken.toColor(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ fun VitalRingGauge(
)
}
if (centerStatus != null) {
val calm = com.pulseloop.ui.calm.NewLook.on
Text(
centerStatus.uppercase(),
if (calm) centerStatus else centerStatus.uppercase(),
fontSize = onScale(size.value * 0.08f),
fontWeight = FontWeight.SemiBold,
letterSpacing = 1.sp,
letterSpacing = if (calm) 0.sp else 1.sp,
color = valueColor,
// A translated zone label can outgrow the ring's hole: wrap it centred, never
// more than two lines, instead of spilling over the arc.
Expand Down
93 changes: 61 additions & 32 deletions app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,15 @@ fun ActivityScreen(
WeeklyDay(label, completed = (stepsByWeekday[i] ?: 0) >= state.stepGoal, isToday = i == todayIdx)
}

val calm = com.pulseloop.ui.calm.NewLook.on
// The new look (docs/new-look-plan.md, "Activity"): page colour, gutter, 720dp cap, Inter.
com.pulseloop.ui.calm.CalmTypography(enabled = calm) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
modifier = if (calm) Modifier.fillMaxSize().background(com.pulseloop.ui.calm.CalmColors.page)
.wrapContentWidth().widthIn(max = 720.dp).fillMaxWidth() else Modifier.fillMaxSize(),
contentPadding = PaddingValues(
start = 16.dp, end = 16.dp,
start = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp,
end = if (calm) com.pulseloop.ui.calm.CalmShape.gutter else 16.dp,
top = 16.dp + topBarPadding, bottom = 16.dp + bottomBarPadding,
),
verticalArrangement = Arrangement.spacedBy(16.dp),
Expand Down Expand Up @@ -203,7 +208,12 @@ fun ActivityScreen(
item { DetectedActivityCard() }

item {
Text(
if (calm) Text(
// A section heading in the new look, not a tracked-caps label.
if (isToday) tr("Today") else dayHeaderLabel(dayStart),
style = com.pulseloop.ui.calm.CalmType.sectionTitle, color = com.pulseloop.ui.calm.CalmColors.text,
modifier = Modifier.padding(top = 8.dp),
) else Text(
if (isToday) tr("TODAY") else dayHeaderLabel(dayStart).uppercase(),
style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary,
)
Expand All @@ -213,10 +223,8 @@ fun ActivityScreen(
Column(
Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(8.dp))
.background(PulseColors.card)
.border(1.dp, PulseColors.borderSubtle, RoundedCornerShape(8.dp))
.padding(vertical = 24.dp),
.activityCard()
.padding(vertical = 24.dp, horizontal = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
Expand Down Expand Up @@ -265,6 +273,7 @@ fun ActivityScreen(
}
item { Spacer(Modifier.height(64.dp)) }
}
}

if (permissionDenied) {
AlertDialog(
Expand Down Expand Up @@ -400,7 +409,6 @@ private fun dayHeaderLabel(dayMillis: Long): String {

@Composable
private fun DailyActivitySummaryCard(state: ActivityViewModel.ActivityState, units: UnitSystem) {
val shape = RoundedCornerShape(8.dp)
// The shown day's totals, not always-today: day navigation must move this card (issue #76).
// No fallback to today: a day with no stored row is a day with no data, not today's (issue #101).
// WeeklyGoalCard keeps reading state.today — a week widget is about the live week.
Expand All @@ -409,10 +417,8 @@ private fun DailyActivitySummaryCard(state: ActivityViewModel.ActivityState, uni
Row(
Modifier
.fillMaxWidth()
.clip(shape)
.background(PulseColors.card)
.border(1.dp, PulseColors.borderSubtle, shape)
.padding(16.dp),
.activityCard()
.padding(if (com.pulseloop.ui.calm.NewLook.on) 20.dp else 16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
Expand Down Expand Up @@ -442,13 +448,21 @@ private fun DailyActivitySummaryCard(state: ActivityViewModel.ActivityState, uni
@Composable
private fun SummaryMetric(label: String, value: String, unit: String?, color: Color, modifier: Modifier = Modifier) {
Column(modifier, verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
val calm = com.pulseloop.ui.calm.NewLook.on
if (calm) Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
// The metric's colour stays on its dot; the name reads as text, not a coloured caps label.
Box(Modifier.size(8.dp).clip(androidx.compose.foundation.shape.CircleShape).background(color))
Text(label, style = com.pulseloop.ui.calm.CalmType.bodySmall, color = com.pulseloop.ui.calm.CalmColors.textSecondary, maxLines = 1)
} else Text(
label.uppercase(),
style = com.pulseloop.ui.theme.PulseType.eyebrow, color = color, maxLines = 1,
)
Row(verticalAlignment = Alignment.Bottom, horizontalArrangement = Arrangement.spacedBy(4.dp)) {
// weight(fill = false): bounded so the unit beside it is never squeezed off.
Text(
if (calm) Text(
value, style = com.pulseloop.ui.calm.CalmType.display, color = com.pulseloop.ui.calm.CalmColors.text,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false),
) else Text(
value, fontSize = 32.sp, fontWeight = FontWeight.SemiBold,
color = PulseColors.textPrimary, maxLines = 1, overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f, fill = false),
Expand All @@ -466,24 +480,23 @@ private fun SummaryMetric(label: String, value: String, unit: String?, color: Co
@Composable
fun ActivityWorkoutRow(session: ActivitySessionEntity, units: UnitSystem, onTap: () -> Unit) {
val corrections = rememberAccuracyCorrections()
val shape = RoundedCornerShape(8.dp)
val calm = com.pulseloop.ui.calm.NewLook.on
val durationSec = session.endedAt?.let { ((it - session.startedAt) / 1000 - session.totalPauseSeconds).toInt() }
Row(
Modifier
.fillMaxWidth()
.clip(shape)
.background(PulseColors.card)
.border(1.dp, PulseColors.borderSubtle, shape)
.activityCard()
.clickable(role = Role.Button, onClick = onTap)
.padding(12.dp),
.padding(if (calm) 16.dp else 12.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
Box(
Modifier
.size(44.dp)
.clip(RoundedCornerShape(8.dp))
.dither(PulseColors.accent, 0.18f),
// A plain raised tile in the new look; the dither is the old look's.
.then(if (calm) Modifier.background(com.pulseloop.ui.calm.CalmColors.cardRaised) else Modifier.dither(PulseColors.accent, 0.18f)),
contentAlignment = Alignment.Center,
) {
Icon(ActivityMeta.icon(session.type), null, tint = PulseColors.accent, modifier = Modifier.size(20.dp))
Expand All @@ -494,7 +507,8 @@ fun ActivityWorkoutRow(session: ActivitySessionEntity, units: UnitSystem, onTap:
// ellipsizes instead of squeezing the start time.
Text(
ActivityMeta.label(session.type),
fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary,
fontSize = if (calm) 16.sp else 14.sp, fontWeight = FontWeight.SemiBold,
color = if (calm) com.pulseloop.ui.calm.CalmColors.text else PulseColors.textPrimary,
maxLines = 1, overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
)
Expand Down Expand Up @@ -522,6 +536,16 @@ fun ActivityWorkoutRow(session: ActivitySessionEntity, units: UnitSystem, onTap:
}
}

/** The card surface, in whichever look is on, so every Activity card matches. */
@Composable
private fun Modifier.activityCard(): Modifier {
val calm = com.pulseloop.ui.calm.NewLook.on
val shape = RoundedCornerShape(if (calm) com.pulseloop.ui.calm.CalmShape.radius else 8.dp)
return this.clip(shape)
.background(if (calm) com.pulseloop.ui.calm.CalmColors.card else PulseColors.card)
.border(1.dp, if (calm) com.pulseloop.ui.calm.CalmColors.border else PulseColors.borderSubtle, shape)
}

private fun durationLabel(seconds: Int): String = Formats.durationCompact(seconds / 60)

// ─────────────────── Weekly goal widget ───────────────────
Expand All @@ -530,17 +554,15 @@ data class WeeklyDay(val label: String, val completed: Boolean, val isToday: Boo

@Composable
private fun WeeklyGoalCard(state: ActivityViewModel.ActivityState, days: List<WeeklyDay>, onTap: () -> Unit) {
val shape = RoundedCornerShape(8.dp)
val calm = com.pulseloop.ui.calm.NewLook.on
val activeMinutes = state.today?.activeMinutes ?: 0
val activeDayCount = days.count { it.completed }
Column(
Modifier
.fillMaxWidth()
.clip(shape)
.background(PulseColors.card)
.border(1.dp, PulseColors.borderSubtle, shape)
.activityCard()
.clickable(role = Role.Button, onClick = onTap)
.padding(16.dp),
.padding(if (calm) 20.dp else 16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
Expand All @@ -551,15 +573,22 @@ private fun WeeklyGoalCard(state: ActivityViewModel.ActivityState, days: List<We
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text("$activeMinutes", fontSize = 20.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary)
Text(tr("MIN"), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary)
if (calm) Text(tr("min"), style = com.pulseloop.ui.calm.CalmType.label, color = com.pulseloop.ui.calm.CalmColors.textSecondary)
else Text(tr("MIN"), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary)
}
}
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
tr("WEEKLY GOAL"),
style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary,
)
Text(trf("{0} of 7 active days", activeDayCount), fontSize = 16.sp, color = PulseColors.textPrimary)
if (calm) {
// The heading is the card's name; the count follows it (no kicker over a heading).
Text(tr("Weekly goal"), style = com.pulseloop.ui.calm.CalmType.title, color = com.pulseloop.ui.calm.CalmColors.text)
Text(trf("{0} of 7 active days", activeDayCount), style = com.pulseloop.ui.calm.CalmType.bodySmall, color = com.pulseloop.ui.calm.CalmColors.textSecondary)
} else {
Text(
tr("WEEKLY GOAL"),
style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.textSecondary,
)
Text(trf("{0} of 7 active days", activeDayCount), fontSize = 16.sp, color = PulseColors.textPrimary)
}
}
}
WeeklyPillCalendar(days)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/pulseloop/ui/screens/DebugScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fun DebugScreen(viewModel: DiagnosticsViewModel, onBack: () -> Unit = {}) {
) {
Column(Modifier.weight(1f)) {
Text(tr("Try the new look"), style = MaterialTheme.typography.bodyMedium)
Text(tr("Screens that have moved to it so far: Today, Vitals, Sleep, Symptom Radar."), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Text(tr("Screens that have moved to it so far: Today, Vitals, Sleep, Activity, Symptom Radar."), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
Switch(checked = com.pulseloop.ui.calm.NewLook.on, onCheckedChange = null)
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/pulseloop/ui/screens/Screens.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ private fun VitalsStatusLine() {
when {
off == null -> " "
off.isEmpty() -> tr("All within your usual range")
else -> trf("Outside your usual: {0}", off.joinToString(", ") { it.title.lowercase() })
else -> trf("Outside your usual: {0}", off.joinToString(", ") { it.inSentence })
},
style = com.pulseloop.ui.calm.CalmType.sectionTitle,
color = if (off.isNullOrEmpty()) com.pulseloop.ui.calm.CalmColors.text else PulseColors.warning,
Expand All @@ -1431,7 +1431,7 @@ private fun VitalsStatusLine() {
when {
off == null -> " "
off.isEmpty() -> tr("Last night: all within your usual range")
else -> trf("Outside your usual last night: {0}", off.joinToString(", ") { it.title.lowercase() })
else -> trf("Outside your usual last night: {0}", off.joinToString(", ") { it.inSentence })
},
style = MaterialTheme.typography.bodySmall,
color = if (off.isNullOrEmpty()) MaterialTheme.colorScheme.onSurfaceVariant else PulseColors.warning,
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,11 @@ private fun VisualizationCard(
) {
Row(verticalAlignment = Alignment.Top) {
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
SleepLabel(eyebrow)
// The new look leads with the title and puts the category under it: a label over a
// heading is a kicker, which the craft floor bans (impeccable pass).
if (!calm) SleepLabel(eyebrow)
Text(title, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = if (calm) com.pulseloop.ui.calm.CalmColors.text else PulseColors.textPrimary)
if (calm) SleepLabel(eyebrow)
}
if (legend) {
// A wrapping legend capped at half the row (weight, fill = false): four translated
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/pulseloop/ui/screens/TodayGlance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fun TodayGlance(
) {
Icon(Icons.Filled.Warning, null, Modifier.size(16.dp), tint = PulseColors.warning)
Text(
tr("Unusual last night: ") + alert.joinToString(", ") { it.title.lowercase() },
tr("Unusual last night: ") + alert.joinToString(", ") { it.inSentence },
fontSize = 14.sp, color = PulseColors.textPrimary,
maxLines = 2, overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ fun TodayScreen(
val alert = guidance?.offSignals?.takeIf { com.pulseloop.service.VitalsCheck.shouldAlert(it) }
val summary = state.coachSummary
CalmGlance(
alert = alert?.let { tr("Unusual last night: ") + it.joinToString(", ") { s -> s.title.lowercase() } },
alert = alert?.let { tr("Unusual last night: ") + it.joinToString(", ") { s -> s.inSentence } },
insight = if (coachEnabled && summary != null) listOf(summary.title, summary.body).filter { it.isNotBlank() }.joinToString(". ")
else if (readinessLoad.loaded && readiness == null) hero.summary else null,
insightPending = coachEnabled && summary == null && !readinessLoad.loaded,
Expand Down
Loading
Loading