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
20 changes: 20 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,26 @@ clutter came from ignoring one of them:
- **A goal saved anywhere goes through `GoalSync.afterManualSave`** — it is what stops the field
following the coach, sends the step goal to the ring and republishes the widget.

## Type, colour and chrome: one of each role (audit, v2.11.52)

- **Type sizes come from `PulseType.SCALE`** (12, 14, 16, 20, 24, 28, 32, 40). 12sp is the floor
for anything that carries meaning; `PulseTypeScaleTest` fails on any other inline size in the
main screens. The tracked caps label over a card or section is `PulseType.eyebrow` (12sp,
1sp tracking, `textSecondary`) everywhere — don't hand-roll another letter-spacing.
- **Mint is the brand and the thing to tap, nothing else.** `success` (good, in range,
connected) is its own green, REM is cyan, connecting is amber. The readiness ring keeps the
brand colour on purpose: it is the headline score.
- **One card radius: 8dp.** Tiles and vital cards used to be 20/30dp.
- **One filled accent per screen**: the Actions button. A screen's own primary action is a tonal
button (Activity's Record).
- **Landscape keeps the header** (compact, one row): it is the only route to Settings and the
ring. From 600dp the tabs move to a `NavigationRail` and tab content caps at 720dp.
- **The ring pill opens the ring's screen** (`settings/wearable`); the gear opens Settings.
- **Tabs have no title of their own**: the tab bar names the screen. Pushed screens use
`CenterAlignedTopAppBar`, and a row's trailing arrow is `Chevron()`, never a "›" glyph.
- **The window theme is dark** (`Theme.PulseLoop`), so cold start doesn't flash white, and
predictive Back is on (`enableOnBackInvokedCallback`).

## Motion: one transition, a small vocabulary

- **Every navigation destination goes through `DitherTransitionBox`** (`theme/DitherTransition.kt`),
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@
android:networkSecurityConfig="@xml/network_security_config"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@android:style/Theme.Material.Light.NoActionBar">
android:theme="@style/Theme.PulseLoop"
android:enableOnBackInvokedCallback="true"
tools:targetApi="tiramisu">

<activity
android:name=".MainActivity"
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/assets/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
"Coach goal: {0}": "Meta do Coach: {0}",
"Coach is thinking…": "O coach está pensando…",
"Cocktail": "Coquetel",
"Collapse": "Recolher",
"Collapsed": "Recolhido",
"Collected on": "Coletado em",
"Collecting: needs {0} days with at least {1} steps on both. Carry your phone as usual.": "Coletando: são necessários {0} dias com pelo menos {1} passos em ambos. Leve o celular como de costume.",
Expand Down Expand Up @@ -414,6 +415,7 @@
"Cycling": "Ciclismo",
"DATA SOURCE": "FONTE DE DADOS",
"DETECTED · REVIEW": "DETECTADO · REVISAR",
"DIA": "DIA",
"Daily": "Diário",
"Daily AI-generated health insights based on your ring data": "Insights de saúde diários gerados por IA com base nos dados do seu anel",
"Daily Check-in Notifications": "Notificações de check-in diário",
Expand Down Expand Up @@ -569,6 +571,7 @@
"Everything compared agrees within its band.": "Tudo o que foi comparado está dentro da faixa.",
"Excellent": "Excelente",
"Exceptional": "Excepcional",
"Expand": "Expandir",
"Expanded": "Expandido",
"Explain my heart rate trend": "Explique minha tendência de frequência cardíaca",
"Explore the app without a ring. Seeds activity, HR, SpO2, sleep, and a coach conversation.": "Explore o app sem um anel. Gera dados de atividade, HR, SpO2, sono e uma conversa com o coach.",
Expand Down Expand Up @@ -890,6 +893,7 @@
"Lowest {0} · {1} readings": "Mínimo {0} · {1} leituras",
"Lunch": "Almoço",
"Luteal": "Lútea",
"MIN": "MIN",
"MOOD CHECK-IN": "CHECK-IN DE HUMOR",
"MY WEEK": "MINHA SEMANA",
"Major signs": "Sinais fortes",
Expand Down Expand Up @@ -1072,6 +1076,7 @@
"Nutrition": "Nutrição",
"OFF — includes full unmasked BLE frames (for protocol debugging only).": "DESATIVADO — inclui frames BLE completos sem mascaramento (apenas para depuração de protocolo).",
"OFF — includes full unmasked BLE frames and health values (for protocol debugging only).": "DESATIVADO — inclui frames BLE completos sem mascaramento e valores de saúde (apenas para depuração de protocolo).",
"OK": "OK",
"OR DESCRIBE IT": "OU DESCREVA",
"Off": "Desativado",
"Offline": "Offline",
Expand Down Expand Up @@ -1203,6 +1208,7 @@
"READINGS": "LEITURAS",
"RECOVERY, WEEK BY WEEK": "RECUPERAÇÃO, SEMANA A SEMANA",
"REFERENCE ZONES": "ZONAS DE REFERÊNCIA",
"REM": "REM",
"REM sleep": "Sono REM",
"REM sleep supports memory and mood. It usually makes up 20 to 25% of a night, about 90 minutes or more.": "O sono REM ajuda a memória e o humor. Normalmente ocupa de 20 a 25% da noite, cerca de 90 minutos ou mais.",
"RIGHT METRIC": "MÉTRICA DA DIREITA",
Expand Down Expand Up @@ -1304,6 +1310,7 @@
"Running": "Corrida",
"SAMU (emergencies)": "SAMU (emergências)",
"SCORE": "PONTUAÇÃO",
"SYS": "SIS",
"Salada verde com tomate": "Salada verde com tomate",
"Same as heart rate": "Igual à frequência cardíaca",
"Save": "Salvar",
Expand Down Expand Up @@ -1683,7 +1690,7 @@
"Very high": "Muito alto",
"Very low": "Muito baixo",
"View": "Ver",
"Vitals": "Sinais vitais",
"Vitals": "Vitais",
"WEEKLY GOAL": "META SEMANAL",
"WHAT THIS MEANS": "O QUE ISSO SIGNIFICA",
"Waiting for BLE connection events…": "Aguardando eventos de conexão BLE…",
Expand Down Expand Up @@ -1840,11 +1847,13 @@
"higher": "maior",
"hour": "hora",
"hours": "horas",
"kcal": "kcal",
"kcal eaten": "kcal ingeridas",
"kg": "kg",
"lb": "lb",
"less": "menos",
"lower": "menor",
"min": "min",
"more": "mais",
"night": "noite",
"nights": "noites",
Expand All @@ -1863,8 +1872,11 @@
"score {0}": "pontuação {0}",
"sleep {0} h": "sono {0} h",
"sleep {0}{1} min": "sono {0}{1} min",
"steady": "estável",
"steps {0} a day": "passos {0} por dia",
"the ring": "o anel",
"trending down": "em queda",
"trending up": "em alta",
"unknown error": "erro desconhecido",
"up": "a mais",
"up {0}": "acordar {0}",
Expand Down Expand Up @@ -1913,6 +1925,7 @@
"{0} ms over the last 3 nights against your usual {1} ({2}%). Your body may be under extra load.": "{0} ms nas últimas 3 noites contra seu habitual de {1} ({2}%). Seu corpo pode estar sob carga extra.",
"{0} of 7 active days": "{0} de 7 dias ativos",
"{0} of exercise in the last 7 days": "{0} de exercício nos últimos 7 dias",
"{0} of {1}": "{0} de {1}",
"{0} of {1} dry days": "{0} de {1} dias sem álcool",
"{0} of {1} dry days; a fresh week starts Monday": "{0} de {1} dias sem álcool; uma nova semana começa na segunda",
"{0} of {1} goal": "{0} de {1} da meta",
Expand All @@ -1935,6 +1948,7 @@
"{0} steps today. {1} Time to start winding down.": "{0} passos hoje. {1} Hora de começar a relaxar.",
"{0} stopped mid-night at {1}": "{0} parou no meio da noite às {1}",
"{0} swears, grumbles and judges your habits — the coach too. The numbers stay exactly as accurate, and anything serious is said plainly. If you easily get offended, maybe stick with the boring version.": "{0} xinga, resmunga e julga seus hábitos — o coach também. Os números continuam exatamente tão precisos, e tudo o que é sério é dito com clareza. Se você se ofende fácil, talvez seja melhor ficar com a versão sem graça.",
"{0} to {1}": "{0} a {1}",
"{0} unavailable": "{0} indisponível",
"{0} via Health Connect": "{0} via Health Connect",
"{0} vs {1}, until {2}.": "{0} vs {1}, até {2}.",
Expand Down
84 changes: 72 additions & 12 deletions app/src/main/java/com/pulseloop/ui/PulseLoopApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.pulseloop.ui.i18n.tr
import com.pulseloop.ui.i18n.trf

import android.content.res.Configuration
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
Expand Down Expand Up @@ -378,6 +379,10 @@ fun PulseLoopApp() {

val isLandscape =
LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
// From 600dp (landscape phones, tablets, unfolded foldables) the tabs move to a
// NavigationRail at the side, as Material's adaptive navigation asks; the bottom bar
// stays for compact portrait.
val useRail = LocalConfiguration.current.screenWidthDp >= 600
val tabRoutes = remember(tabs) { tabs.map { it.route }.toSet() }

// The header's health line (HealthHeadline). Held here, not in the top bar, so it
Expand Down Expand Up @@ -447,7 +452,9 @@ fun PulseLoopApp() {
val route = navBackStackEntry?.destination?.route
// The coach is no longer a tab but keeps the frosted header it had as one.
val onTabRoute = route in tabRoutes || route == "coach"
if (onTabRoute && !isLandscape) {
// Landscape keeps the header (compact, one row): it is the only route to
// Settings and the ring, so dropping it stranded them.
if (onTabRoute) {
Column(
Modifier
// iOS-style scroll-under: blur strongest at the status bar,
Expand Down Expand Up @@ -509,6 +516,10 @@ fun PulseLoopApp() {
else storedDevice?.state ?: ble.connectionState,
batteryPercent = ble.batteryPercent ?: storedDevice?.batteryPercent,
onOpenSettings = { navController.navigate("settings") },
// The pill says what the ring is doing, so it opens the ring's
// screen; the gear beside it is the Settings hub.
onOpenRing = { navController.navigate("settings/wearable") { launchSingleTop = true } },
compact = isLandscape,
idle = ble.idleSince != null,
sourceLabel = hcSource?.let { com.pulseloop.health.source.HealthConnectSource.label(context, it) + tr(" · Health Connect") },
name = profileName,
Expand Down Expand Up @@ -545,14 +556,19 @@ fun PulseLoopApp() {
launchSingleTop = true
}
}
if (currentDestination?.route == "onboarding") {
// The onboarding flow is full-screen chrome of its own — no tab bar.
// Blur only where content scrolls under the bar (the tabs); a pushed screen sits
// above an opaque bar anyway, so a per-frame blur there bought nothing.
val barGlass = if (currentDestination?.route in tabRoutes) Modifier.hazeEffect(state = hazeState, style = glassStyle)
else Modifier.background(com.pulseloop.ui.theme.PulseColors.background)
if (currentDestination?.route == "onboarding" || useRail) {
// The onboarding flow is full-screen chrome of its own — no tab bar; on wide
// windows the tabs live in the rail beside the content instead.
} else if (isLandscape) {
// Landscape: a compact icon-only bar at ~half the standard height,
// so the short viewport keeps more room for content.
Surface(
color = Color.Transparent,
modifier = Modifier.hazeEffect(state = hazeState, style = glassStyle),
modifier = barGlass,
) {
Row(
modifier = Modifier
Expand Down Expand Up @@ -586,7 +602,7 @@ fun PulseLoopApp() {
HorizontalDivider(thickness = 1.dp, color = com.pulseloop.ui.theme.PulseColors.borderSubtle)
NavigationBar(
containerColor = Color.Transparent,
modifier = Modifier.hazeEffect(state = hazeState, style = glassStyle),
modifier = barGlass,
) {
tabs.forEach { tab ->
val selected = isSelected(tab)
Expand All @@ -598,13 +614,13 @@ fun PulseLoopApp() {
contentDescription = null,
)
},
// One line, a touch smaller than labelMedium: "Sinais vitais" wrapped to two
// lines and pushed its icon up out of line with the others. Items already
// One line at the 12sp label size. Portuguese says "Vitais" here: "Sinais vitais"
// wrapped to two lines and pushed its icon out of line. Items already
// share the width equally (NavigationBarItem weights itself 1f).
label = {
Text(
tab.label,
fontSize = 11.sp,
fontSize = 12.sp,
maxLines = 1,
softWrap = false,
overflow = TextOverflow.Ellipsis,
Expand Down Expand Up @@ -643,11 +659,50 @@ fun PulseLoopApp() {
fun androidx.navigation.NavGraphBuilder.screen(
route: String,
content: @Composable (androidx.navigation.NavBackStackEntry) -> Unit,
) = composable(route) { entry -> DitherTransitionBox { content(entry) } }
) = composable(route) { entry ->
DitherTransitionBox {
// On a tablet or a landscape phone a single column of cards stretched across
// the whole window; it is capped at 720dp and centred instead.
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.TopCenter) {
Box(Modifier.widthIn(max = 720.dp).fillMaxSize()) { content(entry) }
}
}
}
val railEntry by navController.currentBackStackEntryAsState()
val railDestination = railEntry?.destination
Row(Modifier.fillMaxSize()) {
if (useRail && railDestination?.route != "onboarding") {
NavigationRail(
containerColor = com.pulseloop.ui.theme.PulseColors.background,
modifier = Modifier.fillMaxHeight().padding(top = topPad, bottom = barPad),
) {
tabs.forEach { tab ->
val selected = railDestination?.hierarchy?.any { it.route == tab.route } == true
NavigationRailItem(
selected = selected,
onClick = {
if (!selected) navController.navigate(tab.route) {
popUpTo(navController.graph.startDestinationId)
launchSingleTop = true
}
},
icon = { Icon(if (selected) tab.selectedIcon else tab.unselectedIcon, contentDescription = null) },
label = { Text(tab.label, maxLines = 1, softWrap = false, overflow = TextOverflow.Ellipsis) },
colors = NavigationRailItemDefaults.colors(
selectedIconColor = com.pulseloop.ui.theme.PulseColors.onAccent,
selectedTextColor = com.pulseloop.ui.theme.PulseColors.textPrimary,
unselectedIconColor = com.pulseloop.ui.theme.PulseColors.textMuted,
unselectedTextColor = com.pulseloop.ui.theme.PulseColors.textMuted,
indicatorColor = com.pulseloop.ui.theme.PulseColors.accent,
),
)
}
}
}
NavHost(
navController = navController,
startDestination = "today",
modifier = Modifier.hazeSource(hazeState),
modifier = Modifier.weight(1f).hazeSource(hazeState),
enterTransition = { com.pulseloop.ui.theme.DitherTransition.enter },
exitTransition = { com.pulseloop.ui.theme.DitherTransition.exit },
popEnterTransition = { com.pulseloop.ui.theme.DitherTransition.enter },
Expand Down Expand Up @@ -748,8 +803,12 @@ fun PulseLoopApp() {
navController.navigate("coach") { launchSingleTop = true }
} else null
// A tab: the shared header above it, and no back arrow of its own.
paddedComposable("nutrition") {
NutritionScreen(onBack = { navController.popBackStack() }, onDiscuss = discussMeal, asTab = true)
// Scrolls under the glass bars like the other four tabs, with the same paddings.
screen("nutrition") {
NutritionScreen(
onBack = { navController.popBackStack() }, onDiscuss = discussMeal, asTab = true,
topBarPadding = topPad, bottomBarPadding = tabPad,
)
}
// Straight into a way of logging (Today's food card, the "Log meal" shortcut).
listOf("photo", "barcode", "add").forEach { start ->
Expand Down Expand Up @@ -919,6 +978,7 @@ fun PulseLoopApp() {
)
}
}
} // Row: rail + content
}

val logStep by LaunchRequests.openLog.collectAsState()
Expand Down
Loading
Loading