diff --git a/AGENTS.md b/AGENTS.md index 5488ef12..1fefe403 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,9 +7,14 @@ Read this before touching ring/BLE hardware code (`app/src/main/java/com/pulselo **The owner's standing instruction (2026-11-04): open a PR for every change and, once it's verified (CI green, the repo's own tests and checks run, no unresolved review threads), merge it yourself; -don't leave it waiting.** Use a merge commit, the way `main`'s history does. A release is a separate -step: the Release workflow (`release.yml`, `workflow_dispatch`) with the next `v{name}+{code}` tag, -run when the owner asks for one. The same rule is in the Gabriel Design System's AGENTS.md. +don't leave it waiting.** Use a merge commit, the way `main`'s history does. + +**Then release, every time** (owner's correction, 2026-11-04: an earlier "only when asked" was a +mistake). After each merge to `main`, run the Release workflow (`release.yml`, +`workflow_dispatch`) with the next `v{name}+{code}` tag: check the releases list first, since +another session may have taken the next number, and confirm the release carries both the APK and +`SHA256SUMS.txt`. The merge rule is also in the Gabriel Design System's AGENTS.md; this release +rule is PulseLoop's. ## Commits carry no agent attribution @@ -1308,8 +1313,8 @@ serving, AI-estimate source); changing a number marks it `userEdited`, as a barc ## 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, + for anything that carries meaning; `PulseTypeScaleTest` fails on any other inline size in any + source file. 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 diff --git a/app/src/main/assets/i18n/pt-BR.json b/app/src/main/assets/i18n/pt-BR.json index db95fcd6..7eaf5296 100644 --- a/app/src/main/assets/i18n/pt-BR.json +++ b/app/src/main/assets/i18n/pt-BR.json @@ -23,6 +23,7 @@ "%,d steps": "%,d passos", "%,d steps a day": "%,d passos por dia", "%,d steps yesterday vs your usual %,d": "%,d passos ontem vs. seus habituais %,d", + "(no text)": "(sem texto)", "+ Log meal": "+ Registrar refeição", "+ Record Activity": "+ Registrar atividade", "+%.1f °C from your usual": "+%.1f °C acima do seu habitual", @@ -33,6 +34,7 @@ ". Your usual day: {0}": ". Seu dia habitual: {0}", "1 bowl": "1 tigela", "1 cup": "1 xícara", + "1 h ago": "Há 1 h", "1 lab marker to review": "1 marcador de exame para revisar", "1 ladle (100 g)": "1 concha (100 g)", "1 medium": "1 médio", @@ -53,6 +55,7 @@ "24h": "24h", "2–3 times a week": "2–3 vezes por semana", "2–4 times a month": "2–4 vezes por mês", + "3 h ago": "Há 3 h", "3 minutes of slow breathing. An urge usually passes within 20 minutes.": "3 minutos de respiração lenta. A vontade geralmente passa em até 20 minutos.", "3 or 4": "3 ou 4", "3-question check": "Verificação de 3 perguntas", @@ -92,6 +95,7 @@ "A typical skin-temperature range from the ring.": "Uma faixa típica de temperatura da pele medida pelo anel.", "A typical week now": "Uma semana típica agora", "A weekly limit and dry days you choose": "Um limite semanal e dias sem álcool que você escolhe", + "ACTIVE MIN": "MIN ATIVOS", "ADD DETAIL (OPTIONAL)": "ADICIONAR DETALHES (OPCIONAL)", "AI Coach": "Coach de IA", "AI Coach is off": "Coach de IA desativado", @@ -219,11 +223,13 @@ "Averaging {0} against a need of {1}": "Média de {0} contra uma necessidade de {1}", "Averaging {0} over {1} nights": "Média de {0} em {1} noites", "Avg ": "Méd. ", + "Avg HR": "FC média", "Awaiting permission": "Aguardando permissão", "Awake": "Acordado", "Awake time elevated": "Tempo acordado elevado", "Awake time low": "Tempo acordado baixo", "Awake {0} between": "Acordado {0} entre", + "BEDTIME": "HORA DE DORMIR", "BMI {0}": "IMC {0}", "BP & HRV": "PA e HRV", "BREASTFEEDING AS CONTRACEPTION (LAM)": "AMAMENTAÇÃO COMO CONTRACEPÇÃO (LAM)", @@ -274,6 +280,8 @@ "Blood, urine and any other lab report, charted exam by exam": "Sangue, urina e qualquer outro laudo, em gráficos exame a exame", "Bluetooth access needed": "Acesso ao Bluetooth necessário", "Bluetooth is off": "Bluetooth desativado", + "Bluetooth is off. Turn it on to find your ring.": "O Bluetooth está desligado. Ligue para encontrar seu anel.", + "Bluetooth permission is off. Allow it to find your ring.": "A permissão de Bluetooth está desligada. Permita para encontrar seu anel.", "Body clock": "Relógio biológico", "Body fat {0}%": "Gordura corporal {0}%", "Body metrics": "Medidas corporais", @@ -295,10 +303,12 @@ "Building baseline": "Criando linha de base", "Building momentum": "Ganhando ritmo", "Built on your phone from your ring's data. No AI key needed.": "Gerado no seu celular a partir dos dados do anel. Não precisa de chave de IA.", + "CALORIES": "CALORIAS", "CAPS AD": "CAPS AD", "CDC suggests waiting at least 2 hours per standard drink before breastfeeding. It's an estimate: bodies differ, and pumping and dumping doesn't make it faster. Not drinking is the safest choice.": "O CDC sugere esperar pelo menos 2 horas por dose padrão antes de amamentar. É uma estimativa: cada corpo é diferente, e tirar o leite e descartar não acelera nada. Não beber é a escolha mais segura.", "CDC suggests waiting at least 2 hours per standard drink before feeding. It's an estimate: bodies differ, and pumping and dumping doesn't make it faster. Not drinking is the safest choice.": "O CDC sugere esperar pelo menos 2 horas por dose padrão antes de amamentar. É uma estimativa: cada corpo é diferente, e tirar o leite e descartar não acelera nada. Não beber é a escolha mais segura.", "COACH": "COACH", + "CONFIRM CHANGE": "CONFIRMAR ALTERAÇÃO", "CVV (emotional support, 24 h)": "CVV (apoio emocional, 24 h)", "CVV listens 24 hours a day, free and anonymous. In danger now, call SAMU.": "O CVV escuta 24 horas por dia, de graça e com sigilo. Se houver perigo agora, ligue para o SAMU.", "CVV · 188": "CVV · 188", @@ -393,20 +403,27 @@ "Cost estimates aren't available for on-device or custom models.": "Estimativas de custo não estão disponíveis para modelos locais ou personalizados.", "Could not export diagnostics.": "Não foi possível exportar os diagnósticos.", "Could not open browser": "Não foi possível abrir o navegador", + "Couldn't analyse the meal. Check your connection and try again, or enter it by hand.": "Não foi possível analisar a refeição. Verifique a conexão e tente de novo, ou digite à mão.", "Couldn't check for updates ({0}). Try again.": "Não foi possível procurar atualizações ({0}). Tente de novo.", + "Couldn't connect. Keep the ring close and try again.": "Não foi possível conectar. Deixe o anel por perto e tente de novo.", "Couldn't copy that file.": "Não foi possível copiar esse arquivo.", "Couldn't delete this record": "Não foi possível excluir este registro", + "Couldn't find the ring. Keep it close and scan again.": "Não foi possível encontrar o anel. Deixe-o por perto e procure de novo.", "Couldn't get a steady reading. Keep the ring snug and your hand still, then try again.": "Não foi possível obter uma leitura estável. Mantenha o anel justo e a mão parada, e tente de novo.", "Couldn't load your health history.": "Não foi possível carregar seu histórico de saúde.", "Couldn't load {0} trends.": "Não foi possível carregar as tendências de {0}.", "Couldn't look up that barcode. Check your connection or enter the meal manually.": "Não foi possível consultar esse código de barras. Verifique sua conexão ou insira a refeição manualmente.", + "Couldn't make that change. Nothing was changed.": "Não foi possível fazer essa alteração. Nada foi mudado.", "Couldn't open that PDF. It may be protected by a password or damaged.": "Não foi possível abrir esse PDF. Ele pode ter senha ou estar danificado.", "Couldn't process that photo. Try again or describe the meal.": "Não foi possível processar essa foto. Tente de novo ou descreva a refeição.", + "Couldn't reach the coach. Try again.": "Não foi possível falar com o coach. Tente de novo.", "Couldn't reach the server.": "Não foi possível acessar o servidor.", "Couldn't read Health Connect. Try again in a moment.": "Não foi possível ler o Health Connect. Tente de novo em instantes.", + "Couldn't read the report. Check your connection and try again.": "Não foi possível ler o exame. Verifique a conexão e tente de novo.", "Couldn't read {0} from Health Connect just now.": "Não foi possível ler {0} do Health Connect agora.", "Couldn't read: ": "Não foi possível ler: ", "Couldn't save these changes. Check the times and try again.": "Não foi possível salvar as alterações. Verifique os horários e tente de novo.", + "Couldn't scan for rings. Try again.": "Não foi possível procurar anéis. Tente de novo.", "Couldn't update this record": "Não foi possível atualizar este registro", "Court sessions": "Sessões em quadra", "Critical": "Crítico", @@ -422,6 +439,7 @@ "DATA SOURCE": "FONTE DE DADOS", "DETECTED · REVIEW": "DETECTADO · REVISAR", "DIA": "DIA", + "DURATION": "DURAÇÃO", "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", @@ -457,6 +475,7 @@ "Default": "Padrão", "Default ports — Ollama 11434 · LM Studio 1234 · llama.cpp 8080 · vLLM 8000 · SGLang 30000. The /v1 path is added for you.": "Portas padrão — Ollama 11434 · LM Studio 1234 · llama.cpp 8080 · vLLM 8000 · SGLang 30000. O caminho /v1 é adicionado para você.", "Delete": "Excluir", + "Delete \"{0}\" ({1} kcal) from {2}?": "Apagar \"{0}\" ({1} kcal) de {2}?", "Delete drink?": "Excluir bebida?", "Delete every record PulseLoop wrote to Health Connect and reset the export to start fresh. Your ring data in PulseLoop is untouched.": "Exclua todos os registros que o PulseLoop gravou no Health Connect e redefina a exportação para começar do zero. Os dados do anel no PulseLoop não são afetados.", "Delete meal?": "Excluir refeição?", @@ -465,6 +484,7 @@ "Delete report": "Excluir laudo", "Delete this activity record": "Excluir este registro de atividade", "Delete this activity record?": "Excluir este registro de atividade?", + "Delete this period?": "Apagar este período?", "Delete this reading": "Excluir esta leitura", "Delete this reading?": "Excluir esta leitura?", "Delete this record": "Excluir este registro", @@ -472,7 +492,9 @@ "Delete this report?": "Excluir este laudo?", "Delete workout": "Excluir treino", "Delete workout?": "Excluir treino?", + "Delete your {0} session from {1}? This can't be undone.": "Apagar sua sessão de {0} de {1}? Não dá para desfazer.", "Delete {0}": "Excluir {0}", + "Deleted the {0} session.": "Sessão de {0} apagada.", "Deleting needs write permission, and PulseLoop has none right now — re-grant above, or delete the data in the Health Connect app.": "A exclusão precisa de permissão de gravação, e o PulseLoop não tem nenhuma agora — conceda de novo acima ou exclua os dados no app Health Connect.", "Demo Data": "Dados de demonstração", "Describe": "Descrever", @@ -598,6 +620,7 @@ "Export failed": "Falha na exportação", "Export reset — re-grant permissions to sync again.": "Exportação redefinida — conceda as permissões novamente para voltar a sincronizar.", "Export ring data to Health Connect so other apps and dashboards can show it. Exporting only writes. PulseLoop reads Health Connect only for features you turn on: body data in your profile, Use without a ring, and the accuracy check.": "Exporte os dados do anel para o Health Connect para que outros apps e painéis possam exibi-los. A exportação só grava. O PulseLoop lê o Health Connect apenas para recursos que você ativa: dados corporais no seu perfil, Usar sem anel e a verificação de precisão.", + "Export route (GPX)": "Exportar trajeto (GPX)", "Export them too": "Exportar também", "Export them too if you're taking the other device off and want the ring's full history in Health Connect.": "Exporte também se você vai deixar de usar o outro dispositivo e quer o histórico completo do anel no Health Connect.", "Exported only when switched on. A row stays dim until its permission is granted.": "Exportado somente quando ativado. Uma linha fica esmaecida até que sua permissão seja concedida.", @@ -678,11 +701,13 @@ "Good morning": "Bom dia", "Good morning{0}": "Bom dia{0}", "Good night": "Boa noite", + "Good sign": "Bom sinal", "Good sleep, with some restlessness": "Sono bom, com alguma inquietação", "Great balance of movement and recovery. Keep it up.": "Ótimo equilíbrio entre movimento e recuperação. Continue assim.", "Grounds suggestions in your city's current weather": "Baseia as sugestões no clima atual da sua cidade", "Gym": "Academia", "HELP": "AJUDA", + "HIDDEN": "OCULTOS", "HISTORY": "HISTÓRICO", "HR collected": "HR coletada", "HR pending": "HR pendente", @@ -924,6 +949,7 @@ "Mark today's doses": "Marque as doses de hoje", "Mask sensitive data": "Mascarar dados sensíveis", "Max": "Máx.", + "Max HR": "FC máx.", "Max tokens": "Máximo de tokens", "Maçã": "Maçã", "Me": "Eu", @@ -958,6 +984,7 @@ "Mild": "Leve", "Mild fatigue.": "Fadiga leve.", "Min": "Mín.", + "Min HR": "FC mín.", "MiniMax": "MiniMax", "MiniMax API Key": "Chave de API do MiniMax", "Minor signs": "Sinais leves", @@ -977,6 +1004,7 @@ "Morning": "Manhã", "Morning type": "Matutino", "Move every hour": "Mexa-se a cada hora", + "Move outdoors to start tracking your route.": "Vá para um lugar aberto para começar a gravar o trajeto.", "Move reminder": "Lembrete para se mexer", "Move {0} down": "Mover {0} para baixo", "Move {0} up": "Mover {0} para cima", @@ -1011,6 +1039,7 @@ "No SpO₂ samples yet — take a reading to start your trend.": "Ainda não há amostras de SpO₂ — faça uma medição para começar sua tendência.", "No access granted. You can allow it in Health Connect's settings.": "Acesso não concedido. Você pode permitir nas configurações do Health Connect.", "No accuracy check for this ring yet. Corrections from another ring don't carry over.": "Ainda não há verificação de precisão para este anel. Correções de outro anel não são aproveitadas.", + "No activity recorded yet. Sync your ring to see today's score.": "Nenhuma atividade registrada ainda. Sincronize seu anel para ver a pontuação de hoje.", "No activity records synced for {0} yet.": "Nenhum registro de atividade sincronizado para {0} ainda.", "No app on this phone opens PDFs.": "Nenhum app deste celular abre PDFs.", "No app wrote health data in the last {0} days.": "Nenhum app gravou dados de saúde nos últimos {0} dias.", @@ -1040,6 +1069,7 @@ "No ring connected": "Nenhum anel conectado", "No ring paired": "Nenhum anel pareado", "No rings found yet": "Nenhum anel encontrado ainda", + "No route yet": "Ainda sem trajeto", "No rows to display.": "Nenhuma linha para exibir.", "No score": "Sem pontuação", "No signs": "Sem sinais", @@ -1092,6 +1122,7 @@ "Notifications": "Notificações", "Notifications are disabled for PulseLoop in Android Settings.": "As notificações estão desativadas para o PulseLoop nas Configurações do Android.", "Notifications are off for PulseLoop. Turn them on in Android Settings to get check-ins.": "As notificações estão desativadas para o PulseLoop. Ative-as nas Configurações do Android para receber check-ins.", + "Now": "Agora", "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).", @@ -1148,6 +1179,7 @@ "Ovos mexidos": "Ovos mexidos", "Own your ring data": "Seus dados do anel são seus", "Oxygen saturation (SpO₂)": "Saturação de oxigênio (SpO₂)", + "P {0} · C {1} · F {2} g": "P {0} · C {1} · G {2} g", "PAUSED": "PAUSADO", "Pace": "Ritmo", "Pair a ring to configure its all-day measurements.": "Pareie um anel para configurar as medições contínuas.", @@ -1225,6 +1257,7 @@ "Quiet hours schedule:": "Horário de silêncio:", "Quiet until": "Silêncio até", "READINGS": "LEITURAS", + "RECORDS": "RECORDES", "RECOVERY, WEEK BY WEEK": "RECUPERAÇÃO, SEMANA A SEMANA", "REFERENCE ZONES": "ZONAS DE REFERÊNCIA", "REM": "REM", @@ -1330,6 +1363,7 @@ "Running": "Corrida", "SAMU (emergencies)": "SAMU (emergências)", "SCORE": "PONTUAÇÃO", + "SPLITS": "PARCIAIS", "SYS": "SIS", "Salada verde com tomate": "Salada verde com tomate", "Same as heart rate": "Igual à frequência cardíaca", @@ -1566,6 +1600,8 @@ "That PDF has no pages to read.": "Esse PDF não tem páginas para ler.", "That app shares nothing PulseLoop can compare.": "Esse app não compartilha nada que o PulseLoop possa comparar.", "That looks like PulseLoop's own data coming back through a sync app, so this report would compare the ring with itself. Check the sync direction in that app.": "Parecem ser dados do próprio PulseLoop voltando por um app de sincronização, então este relatório compararia o anel com ele mesmo. Verifique a direção da sincronização nesse app.", + "That meal no longer exists.": "Essa refeição não existe mais.", + "That workout no longer exists.": "Esse treino não existe mais.", "The AI didn't return a usable estimate. Try again or enter the meal manually.": "A IA não retornou uma estimativa utilizável. Tente novamente ou insira a refeição manualmente.", "The Health Connect app on this device needs an update before it can be used.": "O app Health Connect deste dispositivo precisa ser atualizado antes de ser usado.", "The WHO's short alcohol check (AUDIT-C). Three questions, under a minute. A screen, not a diagnosis.": "O teste rápido sobre álcool da OMS (AUDIT-C). Três perguntas, menos de um minuto. Uma triagem, não um diagnóstico.", @@ -1603,6 +1639,7 @@ "This permanently deletes everything currently in the app and replaces it with the contents of this file. This can't be undone.": "Isso exclui permanentemente tudo o que está no app e substitui pelo conteúdo deste arquivo. Não é possível desfazer.", "This permanently erases all your data — metrics, sleep, activity, coach history, settings, and saved API keys — and can't be undone.": "Isso apaga permanentemente todos os seus dados — métricas, sono, atividade, histórico do coach, configurações e chaves de API salvas — e não pode ser desfeito.", "This record runs {0} – {1}. You can only shorten it.": "Este registro vai de {0} a {1}. Você só pode encurtá-lo.", + "This removes the session and its recorded route. This can't be undone.": "Isso remove a sessão e o trajeto gravado. Não dá para desfazer.", "This report's PDF isn't on this phone.": "O PDF deste laudo não está neste celular.", "This score suggests depression is likely. Please talk to your doctor, nurse or midwife this week.": "Esta pontuação sugere que a depressão é provável. Por favor, converse com seu médico, enfermeira ou obstetriz ainda esta semana.", "This score suggests possible depression. Talk to your doctor, nurse or midwife soon.": "Esta pontuação sugere possível depressão. Converse em breve com seu médico, enfermeira ou obstetriz.", @@ -1683,10 +1720,13 @@ "Unusual signals alert": "Alerta de sinais incomuns", "Unusual-signal alerts, your weekly report and wind-down reminders": "Alertas de sinais incomuns, seu relatório semanal e lembretes para relaxar", "Update": "Atualizar", + "Update \"{0}\" from {1}?": "Atualizar \"{0}\" de {1}?", "Update Health Connect": "Atualizar o Health Connect", "Update Key": "Atualizar chave", "Update available · {0}": "Atualização disponível · {0}", + "Update your {0} session from {1}?": "Atualizar sua sessão de {0} de {1}?", "Update · {0}": "Atualizar · {0}", + "Updated the {0} session.": "Sessão de {0} atualizada.", "Upload failed: {0}": "Falha no envio: {0}", "Uploaded 1 workout": "1 treino enviado", "Uploaded {0} workouts": "{0} treinos enviados", @@ -1700,6 +1740,7 @@ "Use your device's data": "Usar os dados do seu dispositivo", "Use {0}": "Usar {0}", "Used to tune calories, activity goals, and summaries.": "Usado para ajustar calorias, metas de atividade e resumos.", + "Used {0} tools": "Usou {0} ferramentas", "User Profile": "Perfil do usuário", "User profile is incomplete — insights may be less personalized.": "O perfil do usuário está incompleto — os insights podem ser menos personalizados.", "Uses additional tokens": "Usa tokens adicionais", @@ -1784,6 +1825,7 @@ "Workout not found": "Treino não encontrado", "Workouts": "Treinos", "Workouts / week": "Treinos / semana", + "Worth a look": "Vale olhar", "Write Actions": "Ações de escrita", "YESTERDAY": "ONTEM", "YOUR GOAL": "SUA META", @@ -1826,6 +1868,7 @@ "Your body is still recovering. Broken nights and a resting heart rate that wanders are expected for months, so compare yourself with last week, not with before.": "Seu corpo ainda está se recuperando. Noites fragmentadas e uma frequência cardíaca em repouso que oscila são esperadas por meses, então compare-se com a semana passada, não com antes.", "Your body is still recovering. Go a little easier today and watch your {0}.": "Seu corpo ainda está se recuperando. Pegue um pouco mais leve hoje e fique de olho no seu {0}.", "Your body is still recovering. Go a little easier today.": "Seu corpo ainda está se recuperando. Pegue um pouco mais leve hoje.", + "Your cycle predictions are worked out again without it.": "As previsões do seu ciclo são recalculadas sem ele.", "Your data has been restored from the backup.": "Seus dados foram restaurados a partir do backup.", "Your drinks stay on this phone. They aren't sent to Health Connect or included in diagnostics.": "Suas bebidas ficam neste celular. Elas não são enviadas ao Health Connect nem incluídas nos diagnósticos.", "Your goal doesn't set any of these.": "Sua meta não define nenhum destes.", @@ -1860,24 +1903,33 @@ "a {0} fits.": "cabe um(a) {0}.", "above": "acima", "above {0}": "acima de {0}", + "adjusted by your accuracy check": "ajustado pela sua verificação de precisão", "any meal": "qualquer refeição", + "average week": "semana média", "avg {0} bpm": "média {0} bpm", "bed {0}": "deitar {0}", "below": "abaixo", "below {0}": "abaixo de {0}", + "best dry streak": "melhor sequência sem beber", + "calories": "calorias", "compared over the {0} h both were on": "comparado nas {0} h em que os dois estavam ligados", "daily calories": "calorias diárias", "daily calories {0} kcal": "calorias diárias {0} kcal", "day": "dia", "days": "dias", + "distance": "distância", "down": "a menos", + "dry days now": "dias sem beber agora", "e.g. rice, beans and a grilled chicken breast": "ex.: arroz, feijão e um filé de frango grelhado", + "e.g. two eggs, toast with butter, black coffee": "ex.: dois ovos, torrada com manteiga, café preto", + "fewer drinks": "doses a menos", "goal {0}": "meta {0}", "higher": "maior", "hour": "hora", "hours": "horas", "kcal": "kcal", "kcal eaten": "kcal ingeridas", + "kcal not drunk": "kcal não bebidas", "kg": "kg", "lb": "lb", "less": "menos", @@ -1888,8 +1940,10 @@ "night": "noite", "nights": "noites", "no overlap": "sem sobreposição", + "no sleep recorded": "nenhum sono registrado", "not chosen": "não escolhido", "not counted": "não contado", + "not measured": "não medido", "nothing logged yet": "nada registrado ainda", "of {0}": "de {0}", "of {0} this week": "de {0} esta semana", @@ -1899,10 +1953,12 @@ "resting heart rate {0}{1} bpm": "frequência cardíaca em repouso {0}{1} bpm", "retiring {0}": "sai de linha em {0}", "ring {0}": "anel {0}", + "saved": "economizado", "score {0}": "pontuação {0}", "sleep {0} h": "sono {0} h", "sleep {0}{1} min": "sono {0}{1} min", "steady": "estável", + "steps": "passos", "steps {0} a day": "passos {0} por dia", "the ring": "o anel", "trending down": "em queda", @@ -1938,6 +1994,8 @@ "{0} dry day{1} so far": "{0} dia{1} sem álcool até agora", "{0} g protein": "{0} g de proteína", "{0} has synced it in the morning.": "{0} a sincroniza pela manhã.", + "{0} hr": "{0} h", + "{0} hr {1} min": "{0} h {1} min", "{0} in · {1} out": "{0} entrada · {1} saída", "{0} inactive {1} since {2}:00": "{0} {1} sem se mexer desde as {2}:00", "{0} is retiring this model on {1}.": "{0} vai descontinuar este modelo em {1}.", @@ -1947,6 +2005,7 @@ "{0} markers": "{0} marcadores", "{0} markers found": "{0} marcadores encontrados", "{0} markers outside the lab's range in your latest report. Talk them over with your doctor.": "{0} marcadores fora da faixa do laboratório no seu último laudo. Converse sobre eles com seu médico.", + "{0} min": "{0} min", "{0} min a night less than your usual over the last 7 nights.": "{0} min por noite a menos que o seu habitual nas últimas 7 noites.", "{0} min a night more than your usual over the last 7 nights.": "{0} min por noite a mais que o seu habitual nas últimas 7 noites.", "{0} min at {1}. Tap to add it, or say it wasn't.": "{0} min às {1}. Toque para adicionar, ou diga que não foi.", diff --git a/app/src/main/java/com/pulseloop/coach/orchestration/PendingActionExecutor.kt b/app/src/main/java/com/pulseloop/coach/orchestration/PendingActionExecutor.kt index 297df922..596b54e9 100644 --- a/app/src/main/java/com/pulseloop/coach/orchestration/PendingActionExecutor.kt +++ b/app/src/main/java/com/pulseloop/coach/orchestration/PendingActionExecutor.kt @@ -28,7 +28,7 @@ object PendingActionExecutor { val sessions = db.activitySessionDao().recent(200) val session = sessions.firstOrNull { it.id == action.activityId } - ?: return "That workout no longer exists." + ?: return com.pulseloop.ui.i18n.tr("That workout no longer exists.") val typeLabel = activityLabels[session.type] ?: session.type @@ -46,11 +46,11 @@ object PendingActionExecutor { updatedAt = System.currentTimeMillis(), ) ) - "Deleted the $typeLabel session." + com.pulseloop.ui.i18n.trf("Deleted the {0} session.", com.pulseloop.ui.i18n.tr(typeLabel)) } PendingActionKind.UPDATE_ACTIVITY_SESSION -> { applyUpdates(db, action.updates, session) - "Updated the $typeLabel session." + com.pulseloop.ui.i18n.trf("Updated the {0} session.", com.pulseloop.ui.i18n.tr(typeLabel)) } } } @@ -64,7 +64,7 @@ object PendingActionExecutor { */ private suspend fun executeMeal(action: PendingAction, db: PulseLoopDatabase): String { val entry = db.mealEntryDao().byId(action.activityId) - ?: return "That meal no longer exists." + ?: return com.pulseloop.ui.i18n.tr("That meal no longer exists.") return when (action.kind) { PendingActionKind.DELETE_MEAL_ENTRY -> { val name = entry.name diff --git a/app/src/main/java/com/pulseloop/coach/schema/CoachActionCardView.kt b/app/src/main/java/com/pulseloop/coach/schema/CoachActionCardView.kt index 16c3d6b5..450b9b5f 100644 --- a/app/src/main/java/com/pulseloop/coach/schema/CoachActionCardView.kt +++ b/app/src/main/java/com/pulseloop/coach/schema/CoachActionCardView.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import com.pulseloop.coach.orchestration.PendingAction import com.pulseloop.coach.orchestration.PendingActionKind @@ -37,32 +38,28 @@ fun CoachActionCardView( modifier = Modifier .fillMaxWidth() .dither(tone, 0.08f, RoundedCornerShape(8.dp)) - .padding(14.dp), + .padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp), ) { - Row(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.CenterVertically) { - Icon(Icons.Filled.Warning, null, tint = tone, modifier = Modifier.size(14.dp)) - Text( - "Confirm action", - style = MaterialTheme.typography.labelSmall, - fontWeight = FontWeight.SemiBold, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) + Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) { + Icon(Icons.Filled.Warning, null, tint = tone, modifier = Modifier.size(22.dp)) + Text(com.pulseloop.ui.i18n.tr("CONFIRM CHANGE"), style = com.pulseloop.ui.theme.PulseType.eyebrow) } - Text(action.summary, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurface) + Text(action.summary, fontSize = 14.sp, color = PulseColors.textPrimary) Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { PulseButton(PulseButtonStyle.Outlined, onClick = onCancel, modifier = Modifier.weight(1f), ) { - Text("Cancel") + Text(com.pulseloop.ui.i18n.tr("Cancel")) } - PulseButton( + // Tonal, tinted by the risk: the tab's one filled accent stays the Actions button. + PulseButton(PulseButtonStyle.Tonal, onClick = onConfirm, modifier = Modifier.weight(1f), - colors = ButtonDefaults.buttonColors(containerColor = tone), + colors = ButtonDefaults.filledTonalButtonColors(containerColor = tone.copy(alpha = 0.22f), contentColor = tone), ) { Text(action.confirmLabel) } diff --git a/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt b/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt index 7dd658b2..f38516de 100644 --- a/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt +++ b/app/src/main/java/com/pulseloop/coach/schema/CoachToolTraceView.kt @@ -44,7 +44,7 @@ fun CoachToolTraceDisclosure(messageId: String, viewModel: CoachViewModel?) { Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp), - modifier = Modifier.clickable { expanded = !expanded }, + modifier = Modifier.heightIn(min = 48.dp).clickable(role = androidx.compose.ui.semantics.Role.Button) { expanded = !expanded }, ) { Icon(Icons.Filled.Build, null, tint = PulseColors.textMuted, modifier = Modifier.size(11.dp)) Text( @@ -74,7 +74,7 @@ fun CoachToolTraceDisclosure(messageId: String, viewModel: CoachViewModel?) { } private fun collapsedLabel(calls: List): String { - if (calls.size > 2) return "Used ${calls.size} tools" + if (calls.size > 2) return com.pulseloop.ui.i18n.trf("Used {0} tools", calls.size) return calls.joinToString(" → ") { displayLabel(it) } } @@ -93,12 +93,7 @@ private fun ToolTraceRow(call: CoachToolCallEntity) { ) Column(verticalArrangement = Arrangement.spacedBy(1.dp)) { Text(displayLabel(call), fontSize = 12.sp, fontWeight = FontWeight.Medium, color = PulseColors.textSecondary) - if (call.outputJSON?.isNotBlank() == true) { - Text( - call.outputJSON, fontSize = 12.sp, color = PulseColors.textMuted, - maxLines = 1, overflow = TextOverflow.Ellipsis, - ) - } + // The raw tool output (JSON) is a log, not a state: it stays in the usage sheet's data. } } } diff --git a/app/src/main/java/com/pulseloop/coach/tools/NutritionTools.kt b/app/src/main/java/com/pulseloop/coach/tools/NutritionTools.kt index 4af688c8..199b1365 100644 --- a/app/src/main/java/com/pulseloop/coach/tools/NutritionTools.kt +++ b/app/src/main/java/com/pulseloop/coach/tools/NutritionTools.kt @@ -387,8 +387,8 @@ object NutritionTools { ctx.pendingActions.add(PendingAction( kind = PendingActionKind.UPDATE_MEAL_ENTRY, activityId = mealId, - summary = "Update \"${entry.name}\" from ${CoachDataAccess.localDateString(entry.timestamp)}?", - confirmLabel = "Save changes", + summary = com.pulseloop.ui.i18n.trf("Update \"{0}\" from {1}?", entry.name, CoachDataAccess.localDateString(entry.timestamp)), + confirmLabel = com.pulseloop.ui.i18n.tr("Save changes"), mealUpdates = updates, )) ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to edit that meal."}""") @@ -425,8 +425,8 @@ object NutritionTools { ctx.pendingActions.add(PendingAction( kind = PendingActionKind.DELETE_MEAL_ENTRY, activityId = mealId, - summary = "Delete \"${entry.name}\" (${entry.calories.roundToLong()} kcal) from ${CoachDataAccess.localDateString(entry.timestamp)}?", - confirmLabel = "Delete", + summary = com.pulseloop.ui.i18n.trf("Delete \"{0}\" ({1} kcal) from {2}?", entry.name, entry.calories.roundToLong(), CoachDataAccess.localDateString(entry.timestamp)), + confirmLabel = com.pulseloop.ui.i18n.tr("Delete"), )) ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to delete that meal."}""") } diff --git a/app/src/main/java/com/pulseloop/coach/tools/ToolImplementations.kt b/app/src/main/java/com/pulseloop/coach/tools/ToolImplementations.kt index c5bd66c2..f5b23d05 100644 --- a/app/src/main/java/com/pulseloop/coach/tools/ToolImplementations.kt +++ b/app/src/main/java/com/pulseloop/coach/tools/ToolImplementations.kt @@ -896,8 +896,8 @@ object ActionTools { ctx.pendingActions.add(com.pulseloop.coach.orchestration.PendingAction( kind = com.pulseloop.coach.orchestration.PendingActionKind.UPDATE_ACTIVITY_SESSION, activityId = activityId, - summary = "Update your ${session.type} session from ${CoachDataAccess.localDateString(session.startedAt)}?", - confirmLabel = "Save changes", + summary = com.pulseloop.ui.i18n.trf("Update your {0} session from {1}?", session.type, CoachDataAccess.localDateString(session.startedAt)), + confirmLabel = com.pulseloop.ui.i18n.tr("Save changes"), updates = updates, )) ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to edit that workout."}""") @@ -933,8 +933,8 @@ object ActionTools { ctx.pendingActions.add(com.pulseloop.coach.orchestration.PendingAction( kind = com.pulseloop.coach.orchestration.PendingActionKind.DELETE_ACTIVITY_SESSION, activityId = activityId, - summary = "Delete your ${session.type} session from ${CoachDataAccess.localDateString(session.startedAt)}? This can't be undone.", - confirmLabel = "Delete", + summary = com.pulseloop.ui.i18n.trf("Delete your {0} session from {1}? This can't be undone.", session.type, CoachDataAccess.localDateString(session.startedAt)), + confirmLabel = com.pulseloop.ui.i18n.tr("Delete"), )) ToolResult("""{"ok":true,"needs_confirmation":true,"summary":"Awaiting your confirmation to delete that workout."}""") } diff --git a/app/src/main/java/com/pulseloop/service/LabReports.kt b/app/src/main/java/com/pulseloop/service/LabReports.kt index fe9853d0..e200f558 100644 --- a/app/src/main/java/com/pulseloop/service/LabReports.kt +++ b/app/src/main/java/com/pulseloop/service/LabReports.kt @@ -195,7 +195,8 @@ object LabReports { } catch (e: CancellationException) { throw e } catch (e: Exception) { - ReadResult.Failure(trf("Reading failed: {0}", e.message ?: e.javaClass.simpleName)) + android.util.Log.w("LabReports", "Reading the report failed", e) + ReadResult.Failure(tr("Couldn't read the report. Check your connection and try again.")) } } diff --git a/app/src/main/java/com/pulseloop/ui/components/AppChrome.kt b/app/src/main/java/com/pulseloop/ui/components/AppChrome.kt index ec0f8169..a719d81f 100644 --- a/app/src/main/java/com/pulseloop/ui/components/AppChrome.kt +++ b/app/src/main/java/com/pulseloop/ui/components/AppChrome.kt @@ -1,5 +1,6 @@ package com.pulseloop.ui.components +import androidx.compose.material.icons.automirrored.filled.ArrowBack import com.pulseloop.ui.i18n.trf import com.pulseloop.ui.i18n.tr @@ -288,3 +289,28 @@ fun SectionHeaderCaps(title: String, modifier: Modifier = Modifier, action: (@Co action?.invoke() } } + +/** + * The top bar of every pushed screen: a back arrow, the title centred in `PulseType.title`, and + * optional actions. One component so pushed screens stop hand-rolling a Box + IconButton header + * in three slightly different type styles (audit, v2.11.58). + */ +@OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class) +@Composable +fun PulseTopBar( + title: String, + onBack: () -> Unit, + actions: @Composable androidx.compose.foundation.layout.RowScope.() -> Unit = {}, +) { + androidx.compose.material3.CenterAlignedTopAppBar( + title = { Text(title, style = com.pulseloop.ui.theme.PulseType.title, maxLines = 1, overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis) }, + navigationIcon = { + androidx.compose.material3.IconButton(onClick = onBack) { + androidx.compose.material3.Icon(androidx.compose.material.icons.Icons.AutoMirrored.Filled.ArrowBack, com.pulseloop.ui.i18n.tr("Back")) + } + }, + actions = actions, + windowInsets = androidx.compose.foundation.layout.WindowInsets(0, 0, 0, 0), + colors = androidx.compose.material3.TopAppBarDefaults.topAppBarColors(containerColor = com.pulseloop.ui.theme.PulseColors.background), + ) +} diff --git a/app/src/main/java/com/pulseloop/ui/components/DeviceHeroCard.kt b/app/src/main/java/com/pulseloop/ui/components/DeviceHeroCard.kt index e90de524..9af9c9af 100644 --- a/app/src/main/java/com/pulseloop/ui/components/DeviceHeroCard.kt +++ b/app/src/main/java/com/pulseloop/ui/components/DeviceHeroCard.kt @@ -126,11 +126,19 @@ fun DeviceHeroCard( verticalArrangement = Arrangement.spacedBy(14.dp), ) { status.batteryText?.let { batteryText -> + // Tinted by level: always green read "fine" at 5%. + val pct = batteryText.filter { it.isDigit() }.toIntOrNull() + val batteryTone = when { + pct == null -> PulseColors.textSecondary + pct <= 20 -> PulseColors.danger + pct <= 50 -> PulseColors.warning + else -> PulseColors.success + } Row( Modifier .clip(CircleShape) - .dither(PulseColors.success, 0.12f) - .padding(horizontal = 9.dp, vertical = 6.dp), + .dither(batteryTone, 0.12f) + .padding(horizontal = 8.dp, vertical = 4.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(4.dp), ) { @@ -138,13 +146,13 @@ fun DeviceHeroCard( Icons.Filled.BatteryFull, contentDescription = null, modifier = Modifier.size(12.dp), - tint = PulseColors.success, + tint = batteryTone, ) Text( batteryText, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, - color = PulseColors.success, + color = batteryTone, ) } } diff --git a/app/src/main/java/com/pulseloop/ui/components/TodayTiles.kt b/app/src/main/java/com/pulseloop/ui/components/TodayTiles.kt index a27a8f3c..78dc71f0 100644 --- a/app/src/main/java/com/pulseloop/ui/components/TodayTiles.kt +++ b/app/src/main/java/com/pulseloop/ui/components/TodayTiles.kt @@ -25,7 +25,6 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.Layout @@ -130,7 +129,6 @@ fun TodayTile( Box( Modifier .size(8.dp) - .shadow(5.dp, CircleShape, ambientColor = color.copy(alpha = 0.7f), spotColor = color.copy(alpha = 0.7f)) .clip(CircleShape) .background(color), ) @@ -492,7 +490,6 @@ fun CoachMessageCard( Box( Modifier .size(6.dp) - .shadow(5.dp, CircleShape, ambientColor = PulseColors.accent, spotColor = PulseColors.accent) .clip(CircleShape) .background(PulseColors.accent), ) diff --git a/app/src/main/java/com/pulseloop/ui/components/VitalCard.kt b/app/src/main/java/com/pulseloop/ui/components/VitalCard.kt index bf41696c..5f9ec19f 100644 --- a/app/src/main/java/com/pulseloop/ui/components/VitalCard.kt +++ b/app/src/main/java/com/pulseloop/ui/components/VitalCard.kt @@ -23,7 +23,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.shadow import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -66,8 +65,8 @@ fun VitalCard( ) { Column( modifier = Modifier.padding( - horizontal = if (compact) 16.dp else 22.dp, - vertical = if (compact) 16.dp else 20.dp, + horizontal = if (compact) 16.dp else 24.dp, + vertical = 16.dp, ), verticalArrangement = Arrangement.spacedBy(if (compact) 6.dp else 8.dp), ) { @@ -91,7 +90,6 @@ private fun CardHeader(state: VitalCardState, compact: Boolean, footerText: Stri Box( Modifier .size(8.dp) - .shadow(5.dp, CircleShape, ambientColor = accent, spotColor = accent) .clip(CircleShape) .background(accent), ) diff --git a/app/src/main/java/com/pulseloop/ui/components/WorkoutMapView.kt b/app/src/main/java/com/pulseloop/ui/components/WorkoutMapView.kt index e3cd9973..9f9e7712 100644 --- a/app/src/main/java/com/pulseloop/ui/components/WorkoutMapView.kt +++ b/app/src/main/java/com/pulseloop/ui/components/WorkoutMapView.kt @@ -46,8 +46,8 @@ fun WorkoutMapView( contentAlignment = Alignment.Center, ) { Column(horizontalAlignment = Alignment.CenterHorizontally) { - Text("No route yet", style = MaterialTheme.typography.labelMedium, color = Color.White) - Text("Move outdoors to start tracking your route.", style = MaterialTheme.typography.labelSmall, color = Color.White.copy(alpha = 0.6f)) + Text(com.pulseloop.ui.i18n.tr("No route yet"), style = MaterialTheme.typography.labelMedium, color = com.pulseloop.ui.theme.PulseColors.textPrimary) + Text(com.pulseloop.ui.i18n.tr("Move outdoors to start tracking your route."), style = MaterialTheme.typography.labelSmall, color = com.pulseloop.ui.theme.PulseColors.textSecondary) } } } else { @@ -81,7 +81,7 @@ fun WorkoutMapView( } drawPath( path = path, - color = PulseColors.accent, + color = PulseColors.distance, style = Stroke(width = 4f, cap = StrokeCap.Round), ) diff --git a/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt b/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt index 8c7f6038..f66f53bd 100644 --- a/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt +++ b/app/src/main/java/com/pulseloop/ui/dashboard/DashboardEdit.kt @@ -205,7 +205,7 @@ private fun EditBadge( fun HiddenMetricsTray(hidden: List, onRestore: (DashboardCard) -> Unit) { if (hidden.isEmpty()) return Column(Modifier.fillMaxWidth().padding(vertical = 8.dp)) { - Text("HIDDEN", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant) + Text(com.pulseloop.ui.i18n.tr("HIDDEN"), style = com.pulseloop.ui.theme.PulseType.eyebrow) hidden.forEach { card -> Row( Modifier.fillMaxWidth().padding(vertical = 2.dp), diff --git a/app/src/main/java/com/pulseloop/ui/screens/AccuracyReportUi.kt b/app/src/main/java/com/pulseloop/ui/screens/AccuracyReportUi.kt index a00c8ce2..a156d98c 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/AccuracyReportUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/AccuracyReportUi.kt @@ -219,7 +219,7 @@ private fun MetricCard( fontSize = 12.sp, color = verdictColor(summary.verdict), maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(start = 8.dp).widthIn(max = 140.dp) - .clip(RoundedCornerShape(10.dp)).background(PulseColors.cardSoft).padding(horizontal = 8.dp, vertical = 3.dp), + .clip(RoundedCornerShape(16.dp)).background(PulseColors.cardSoft).padding(horizontal = 8.dp, vertical = 4.dp), ) } Text(AccuracyReportText.reading(summary, check.referenceLabel), fontSize = 12.sp, color = PulseColors.textSecondary) @@ -227,7 +227,7 @@ private fun MetricCard( correction?.invoke(summary) } if (!expanded) { - Text(tr("Details"), fontSize = 12.sp, color = PulseColors.accent, modifier = Modifier.clickable(onClick = onToggle)) + com.pulseloop.ui.components.PulseButton(com.pulseloop.ui.components.PulseButtonStyle.Text, onClick = onToggle) { Text(tr("Details")) } return@AccuracyCard } if (m.kind != ComparisonMetric.Kind.STAGES && summary.validDays > 0) { diff --git a/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt index 417db73a..abc1231a 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/ActivityScreen.kt @@ -416,7 +416,7 @@ private fun DailyActivitySummaryCard(state: ActivityViewModel.ActivityState, uni size = 112.dp, strokeWidth = 11.dp, ringSpacing = 5.dp, - labels = listOf("steps", "distance", "calories"), + labels = listOf(tr("steps"), tr("distance"), tr("calories")), ) } } @@ -821,7 +821,7 @@ private fun ActivityRecordsCard( verticalAlignment = Alignment.CenterVertically, ) { Text( - "RECORDS", + tr("RECORDS"), style = com.pulseloop.ui.theme.PulseType.eyebrow, fontWeight = FontWeight.SemiBold, color = PulseColors.textSecondary, ) diff --git a/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt index 25d3c31f..e6c7e3cb 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/CoachScreen.kt @@ -141,6 +141,16 @@ fun CoachScreen( // Persisted rows key by id; the greeting and this session's unsaved turns have none. items(state.messages.size, key = { idx -> state.messages[idx].id ?: "local-$idx" }) { idx -> MessageBubble(state.messages[idx], viewModel) + // The coach's proposed changes wait here for a yes; nothing runs without it. + state.messages[idx].pendingActions.forEach { action -> + Box(Modifier.widthIn(max = 360.dp).padding(top = 8.dp)) { + com.pulseloop.coach.schema.CoachActionCardView( + action = action, + onConfirm = { viewModel?.confirmAction(idx, action) }, + onCancel = { viewModel?.cancelAction(idx, action) }, + ) + } + } } if (state.isThinking) { item { diff --git a/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt b/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt index 50b6533e..07d4a1de 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/CoachUsageSheet.kt @@ -161,7 +161,7 @@ private fun MessageBreakdownRow(message: CoachMessageEntity) { val tokens = trf("{0} in · {1} out", message.inputTokens ?: 0, message.outputTokens ?: 0) val cost = message.costUSD?.let { "$" + "%.4f".format(it) } ?: "—" Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { - Text(preview.ifEmpty { "(no text)" }, fontSize = 12.sp, color = PulseColors.textPrimary, maxLines = 1) + Text(preview.ifEmpty { tr("(no text)") }, fontSize = 12.sp, color = PulseColors.textPrimary, maxLines = 1) Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) { Text(tokens, fontSize = 12.sp, color = PulseColors.textMuted) Text(cost, fontSize = 12.sp, color = PulseColors.textMuted) diff --git a/app/src/main/java/com/pulseloop/ui/screens/CycleUi.kt b/app/src/main/java/com/pulseloop/ui/screens/CycleUi.kt index 2a8f0c70..bc6f9fdc 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/CycleUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/CycleUi.kt @@ -51,6 +51,7 @@ fun CycleScreen(onBack: () -> Unit) { val context = LocalContext.current val db = remember { PulseLoopDatabase.getInstance(context) } val scope = rememberCoroutineScope() + var pendingDelete by remember { mutableStateOf(null) } // null until Room answers: read as empty, the card said "log your period to start" and the // button offered "period started today" to someone mid-period, then both changed a frame later. val periodsLoaded by remember { db.periodDao().allFlow() }.collectAsState(initial = null) @@ -137,7 +138,8 @@ fun CycleScreen(onBack: () -> Unit) { ) next?.let { Text(trf("Cycle of {0} days", it - p.startDay), fontSize = 12.sp, color = PulseColors.textMuted) } } - IconButton(onClick = { scope.launch { db.periodDao().delete(p.id) } }) { + // Asks first: one tap used to delete a logged period with no way back. + IconButton(onClick = { pendingDelete = p.id }) { Icon(Icons.Filled.Delete, tr("Delete"), tint = PulseColors.textMuted, modifier = Modifier.size(18.dp)) } } @@ -175,4 +177,20 @@ fun CycleScreen(onBack: () -> Unit) { DatePicker(state = state, showModeToggle = false) } } + pendingDelete?.let { id -> + androidx.compose.material3.AlertDialog( + onDismissRequest = { pendingDelete = null }, + title = { Text(tr("Delete this period?")) }, + text = { Text(tr("Your cycle predictions are worked out again without it.")) }, + confirmButton = { + com.pulseloop.ui.components.PulseButton(com.pulseloop.ui.components.PulseButtonStyle.Text, onClick = { + scope.launch { db.periodDao().delete(id) } + pendingDelete = null + }) { Text(tr("Delete"), color = PulseColors.danger) } + }, + dismissButton = { + com.pulseloop.ui.components.PulseButton(com.pulseloop.ui.components.PulseButtonStyle.Text, onClick = { pendingDelete = null }) { Text(tr("Cancel")) } + }, + ) + } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt b/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt index 8902e807..b3466496 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/DrinksUi.kt @@ -414,7 +414,7 @@ private fun WeekHero(s: DrinksRepository.Snapshot) { Text(title, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = if (over) PulseColors.warning else PulseColors.textPrimary) Text(sub, fontSize = 14.sp, color = PulseColors.textSecondary) if (s.streaks.current >= 2) { - Text(trf("{0} dry days in a row", s.streaks.current), fontSize = 14.sp, color = PulseColors.accent) + Text(trf("{0} dry days in a row", s.streaks.current), fontSize = 14.sp, color = PulseColors.success) } } } @@ -452,7 +452,7 @@ private fun WeekStrip(s: DrinksRepository.Snapshot) { isToday -> PulseColors.textPrimary drank -> dotColor future || !known -> PulseColors.borderSubtle - else -> PulseColors.accent + else -> PulseColors.success }, shape = CircleShape, ), @@ -460,7 +460,7 @@ private fun WeekStrip(s: DrinksRepository.Snapshot) { ) { when { drank -> Text(std(DrinkInsights.standardDrinks(grams, s.gramsPerStandard)), fontSize = 12.sp, fontWeight = FontWeight.Bold, color = PulseColors.onAccent, maxLines = 1, softWrap = false) - !future && known && !isToday -> Icon(Icons.Filled.Check, tr("Dry"), tint = PulseColors.accent, modifier = Modifier.size(16.dp)) + !future && known && !isToday -> Icon(Icons.Filled.Check, tr("Dry"), tint = PulseColors.success, modifier = Modifier.size(16.dp)) } } } @@ -483,7 +483,7 @@ private fun LogCard(db: PulseLoopDatabase, s: DrinksRepository.Snapshot, onChang Text( tr("More"), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.accent, - modifier = Modifier.clickable { more = true }.padding(4.dp), + modifier = Modifier.heightIn(min = 48.dp).clickable(role = Role.Button) { more = true }.wrapContentHeight(Alignment.CenterVertically).padding(horizontal = 8.dp), ) }) { // Equal-height buttons whose labels may take two lines: a translated or voice name @@ -513,14 +513,14 @@ private fun LogCard(db: PulseLoopDatabase, s: DrinksRepository.Snapshot, onChang } lastLogged?.let { (text, ids) -> Row(verticalAlignment = Alignment.CenterVertically) { - Text(trf("Logged {0}", text), fontSize = 14.sp, color = PulseColors.accent, modifier = Modifier.weight(1f)) + Text(trf("Logged {0}", text), fontSize = 14.sp, color = PulseColors.success, modifier = Modifier.weight(1f)) Text( tr("Undo"), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = Modifier.widthIn(max = 120.dp).clickable { + modifier = Modifier.widthIn(max = 120.dp).heightIn(min = 48.dp).clickable(role = Role.Button) { scope.launch { ids.forEach { DrinksRepository.delete(db, it) }; lastLogged = null; onChange() } - }.padding(4.dp), + }.wrapContentHeight(Alignment.CenterVertically).padding(horizontal = 8.dp), ) } } @@ -660,7 +660,7 @@ private fun MoreDrinkSheet(onLog: (DrinkType, Int, Long, Double?) -> Unit) { Stepper(tr("How many"), "$count", { count = (count - 1).coerceAtLeast(1) }, { count = (count + 1).coerceAtMost(12) }) FlowRow(Modifier.selectableGroup(), horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) { listOf(0L to "Now", 1L to "1 h ago", 3L to "3 h ago", 12L to "Last night").forEach { (h, l) -> - Pill(l, hoursAgo == h, PulseColors.drinks) { hoursAgo = h } + Pill(tr(l), hoursAgo == h, PulseColors.drinks) { hoursAgo = h } } } OutlinedTextField( @@ -743,9 +743,9 @@ private fun TrendsTab(s: DrinksRepository.Snapshot) { val completed = tracked.dropLast(1) val avg = completed.takeIf { it.isNotEmpty() }?.map { it.second }?.average() Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min), horizontalArrangement = Arrangement.spacedBy(8.dp)) { - Stat(avg?.let { std(it) } ?: "—", "average week", Modifier.weight(1f).fillMaxHeight()) - Stat("${s.streaks.best}", "best dry streak", Modifier.weight(1f).fillMaxHeight()) - Stat("${s.streaks.current}", "dry days now", Modifier.weight(1f).fillMaxHeight()) + Stat(avg?.let { std(it) } ?: "—", tr("average week"), Modifier.weight(1f).fillMaxHeight()) + Stat("${s.streaks.best}", tr("best dry streak"), Modifier.weight(1f).fillMaxHeight()) + Stat("${s.streaks.current}", tr("dry days now"), Modifier.weight(1f).fillMaxHeight()) } DrinkCard(tr("Last 8 weeks")) { WeeksChart(s) @@ -757,9 +757,9 @@ private fun TrendsTab(s: DrinksRepository.Snapshot) { s.savings?.takeIf { it.drinksAvoided >= 0.5 }?.let { sv -> DrinkCard(tr("Compared with your typical week")) { Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min), horizontalArrangement = Arrangement.spacedBy(8.dp)) { - Stat(std(sv.drinksAvoided), "fewer drinks", Modifier.weight(1f).fillMaxHeight()) - sv.money?.let { Stat("%.0f".format(it), "saved", Modifier.weight(1f).fillMaxHeight()) } - Stat("%,d".format(sv.kcal.roundToInt()), "kcal not drunk", Modifier.weight(1f).fillMaxHeight()) + Stat(std(sv.drinksAvoided), tr("fewer drinks"), Modifier.weight(1f).fillMaxHeight()) + sv.money?.let { Stat("%.0f".format(it), tr("saved"), Modifier.weight(1f).fillMaxHeight()) } + Stat("%,d".format(sv.kcal.roundToInt()), tr("kcal not drunk"), Modifier.weight(1f).fillMaxHeight()) } } } ?: run { @@ -858,7 +858,7 @@ private fun AuditCard(s: DrinksRepository.Snapshot, onDone: () -> Unit) { Spacer(Modifier.height(64.dp)) } else if (score != null) { val level = AuditC.level(score, sex) - Text(level.label, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = if (level == AuditC.Level.LOW) PulseColors.accent else PulseColors.warning) + Text(level.label, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = if (level == AuditC.Level.LOW) PulseColors.success else PulseColors.warning) Text(AuditC.advice(level), fontSize = 14.sp, color = PulseColors.textSecondary) Text(trf("Score {0} of 12 · {1}", score, DrinkPrefs.auditDate), fontSize = 12.sp, color = PulseColors.textMuted) } else { @@ -979,6 +979,6 @@ fun ColumnScope.DrinksTileContent(week: DrinkInsights.Week?, limit: Double, dryT Text( "+ ${DrinkPrefs.lastType.label}", fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.accent, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = Modifier.clickable(role = Role.Button, onClick = onAdd).padding(vertical = 2.dp), + modifier = Modifier.heightIn(min = 48.dp).clickable(role = Role.Button, onClick = onAdd).wrapContentHeight(Alignment.CenterVertically), ) } diff --git a/app/src/main/java/com/pulseloop/ui/screens/GuidanceUi.kt b/app/src/main/java/com/pulseloop/ui/screens/GuidanceUi.kt index d366743b..ed4fb2e2 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/GuidanceUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/GuidanceUi.kt @@ -74,7 +74,7 @@ fun TonightCard(g: BedtimeGuidance.Result, sleepGoalMinutes: Int) { horizontalArrangement = Arrangement.spacedBy(16.dp), ) { Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) { - Text("BEDTIME", fontSize = 12.sp, fontWeight = FontWeight.Medium, color = PulseColors.sleep) + Text(tr("BEDTIME"), style = com.pulseloop.ui.theme.PulseType.eyebrow, color = PulseColors.sleep) Text( "${BedtimeGuidance.fmt(g.windowStart)}–${BedtimeGuidance.fmt(g.windowEnd)}", fontSize = 20.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary, diff --git a/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt b/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt index b2520f15..0cd9200d 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/HealthConnectSourceUi.kt @@ -220,7 +220,8 @@ fun HealthConnectSourceContent(onEnabled: (() -> Unit)? = null) { AccuracyCard { Text(HealthConnectSource.label(context, src.packageName), fontSize = 16.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary) Text(src.metrics.joinToString(", ") { it.metric.label }, fontSize = 14.sp, color = PulseColors.textSecondary) - PulseButton(onClick = { + // Tonal: one card per app, so filled would put several mint buttons on one screen. + PulseButton(PulseButtonStyle.Tonal, onClick = { HealthConnectSource.enable(context, src.packageName) enabled = true source = src.packageName diff --git a/app/src/main/java/com/pulseloop/ui/screens/JournalUi.kt b/app/src/main/java/com/pulseloop/ui/screens/JournalUi.kt index ca0a5656..93949172 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/JournalUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/JournalUi.kt @@ -145,7 +145,10 @@ private fun DaySwitch(yesterday: Boolean, onChange: (Boolean) -> Unit) { modifier = Modifier .background(if (on) PulseColors.accent else PulseColors.cardSoft) .selectable(selected = on, role = Role.RadioButton) { onChange(isYesterday) } - .padding(horizontal = 10.dp, vertical = 6.dp), + // 48dp tall: the text alone was a ~28dp target. + .heightIn(min = 48.dp) + .wrapContentHeight(Alignment.CenterVertically) + .padding(horizontal = 12.dp, vertical = 8.dp), ) } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/LabReportsUi.kt b/app/src/main/java/com/pulseloop/ui/screens/LabReportsUi.kt index e115d302..7f061682 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/LabReportsUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/LabReportsUi.kt @@ -79,7 +79,7 @@ private fun shortDay(ms: Long): String = .format(DateTimeFormatter.ofPattern("MMM yy")) private fun flagColor(flag: String): Color = - if (LabReports.isOutside(flag)) PulseColors.warning else if (flag == "NORMAL") PulseColors.accent else PulseColors.textMuted + if (LabReports.isOutside(flag)) PulseColors.warning else if (flag == "NORMAL") PulseColors.success else PulseColors.textMuted private fun flagLabel(flag: String): String = when (flag) { "HIGH" -> tr("High") @@ -444,19 +444,19 @@ private fun LabChart(m: LabReports.Marker) { if (l.refLow != null || l.refHigh != null) { val bandTop = l.refHigh?.let { y(it) } ?: top val bandBottom = l.refLow?.let { y(it) } ?: bottom - ditherBrush(PulseColors.accent, 0.14f)?.let { + ditherBrush(PulseColors.info, 0.14f)?.let { drawRect(it, Offset(0f, bandTop), Size(size.width, (bandBottom - bandTop).coerceAtLeast(1f))) } } if (pts.size >= 2) { val path = Path() pts.forEachIndexed { i, p -> if (i == 0) path.moveTo(x(i), y(p.valueNum!!)) else path.lineTo(x(i), y(p.valueNum!!)) } - drawPath(path, PulseColors.accent, style = Stroke(width = 2.dp.toPx())) + drawPath(path, PulseColors.info, style = Stroke(width = 2.dp.toPx())) } pts.forEachIndexed { i, p -> val c = Offset(x(i), y(p.valueNum!!)) drawCircle(PulseColors.background, 6.dp.toPx(), c) - drawCircle(if (LabReports.isOutside(p.flag)) PulseColors.warning else PulseColors.accent, 4.5.dp.toPx(), c) + drawCircle(if (LabReports.isOutside(p.flag)) PulseColors.warning else PulseColors.info, 4.5.dp.toPx(), c) val v = measurer.measure(LabReports.valueLabel(p.valueNum, null), label) drawText(v, topLeft = Offset(c.x - v.size.width / 2, c.y - v.size.height - 8.dp.toPx())) val d = measurer.measure(shortDay(p.day), tick) diff --git a/app/src/main/java/com/pulseloop/ui/screens/LogPastActivityScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/LogPastActivityScreen.kt index 129ef014..459fba23 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/LogPastActivityScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/LogPastActivityScreen.kt @@ -1,6 +1,7 @@ package com.pulseloop.ui.screens import com.pulseloop.ui.i18n.tr +import com.pulseloop.ui.i18n.trf import com.pulseloop.ui.components.PulseButton import com.pulseloop.ui.theme.dither @@ -237,7 +238,7 @@ private fun PastActivityDurationCard(minutes: Int, onChange: (Int) -> Unit) { DurationStepButton(Icons.Filled.Remove, tr("Decrease duration by 5 minutes"), enabled = !atFloor) { onChange(maxOf(5, minutes - 5)) } Column(Modifier.weight(1f), horizontalAlignment = Alignment.CenterHorizontally) { Text(durationText(minutes), fontSize = 28.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary) - Text("DURATION", fontSize = 12.sp, letterSpacing = 1.1.sp, color = PulseColors.textMuted) + Text(tr("DURATION"), style = com.pulseloop.ui.theme.PulseType.eyebrow) } DurationStepButton(Icons.Filled.Add, tr("Increase duration by 5 minutes"), enabled = true) { onChange(minutes + 5) } } @@ -288,8 +289,8 @@ private fun durationText(minutes: Int): String { val hours = minutes / 60 val remaining = minutes % 60 return when { - hours == 0 -> "$remaining min" - remaining == 0 -> "$hours hr" - else -> "$hours hr $remaining min" + hours == 0 -> trf("{0} min", remaining) + remaining == 0 -> trf("{0} hr", hours) + else -> trf("{0} hr {1} min", hours, remaining) } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/LogSheet.kt b/app/src/main/java/com/pulseloop/ui/screens/LogSheet.kt index 522eb406..1d781b4e 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/LogSheet.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/LogSheet.kt @@ -195,7 +195,7 @@ private fun QuickDrinks(db: PulseLoopDatabase, onMore: () -> Unit) { val last = logged Text( if (last != null) trf("Logged {0}", last.first.lowercase()) else "", - fontSize = 14.sp, color = PulseColors.accent, modifier = Modifier.weight(1f), + fontSize = 14.sp, color = PulseColors.success, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis, ) if (last != null) { diff --git a/app/src/main/java/com/pulseloop/ui/screens/MealAnalysisSheet.kt b/app/src/main/java/com/pulseloop/ui/screens/MealAnalysisSheet.kt index 6cbabe4a..dab8a86e 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/MealAnalysisSheet.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/MealAnalysisSheet.kt @@ -316,7 +316,7 @@ fun MealAnalysisDialog( FilterChip( selected = mealType == t, onClick = { mealType = t }, - label = { Text(t.replaceFirstChar { it.uppercase() }) }, + label = { Text(tr(t.replaceFirstChar { it.uppercase() })) }, ) } } @@ -376,7 +376,7 @@ fun MealAnalysisDialog( value = describeText, onValueChange = { describeText = it }, label = { Text(if (image == null) tr("Describe your meal") else tr("Meal details")) }, - placeholder = { Text("e.g. two eggs, toast with butter, black coffee") }, + placeholder = { Text(tr("e.g. two eggs, toast with butter, black coffee")) }, modifier = Modifier.fillMaxWidth(), minLines = 2, ) @@ -776,7 +776,8 @@ object MealEstimator { } catch (e: CancellationException) { throw e } catch (e: Exception) { - Result.Failure(trf("Analysis failed: {0}", e.message ?: e.javaClass.simpleName)) + android.util.Log.w("MealAnalysis", "Meal analysis failed", e) + Result.Failure(tr("Couldn't analyse the meal. Check your connection and try again, or enter it by hand.")) } } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/MedsUi.kt b/app/src/main/java/com/pulseloop/ui/screens/MedsUi.kt index 1872f3fd..0807d2ec 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/MedsUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/MedsUi.kt @@ -99,7 +99,7 @@ fun MedsScreen(onBack: () -> Unit) { listOfNotNull(d.med.dose, d.state.label).joinToString(" · "), fontSize = 12.sp, color = when (d.state) { - Meds.State.TAKEN -> PulseColors.accent + Meds.State.TAKEN -> PulseColors.success Meds.State.MISSED -> PulseColors.warning else -> PulseColors.textMuted }, diff --git a/app/src/main/java/com/pulseloop/ui/screens/MyHealthUi.kt b/app/src/main/java/com/pulseloop/ui/screens/MyHealthUi.kt index b0cbbd6c..20f1842a 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/MyHealthUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/MyHealthUi.kt @@ -230,7 +230,11 @@ fun MyHealthScreen(onBack: () -> Unit, onBreathe: () -> Unit, onWhatChanged: () if (s == null) { item { if (loadFailed) { - Text(tr("Couldn't load your health history."), color = PulseColors.warning, fontSize = 14.sp) + // A dead end otherwise: say so, and offer the retry. + Column { + Text(tr("Couldn't load your health history."), color = PulseColors.warning, fontSize = 14.sp) + com.pulseloop.ui.components.PulseButton(com.pulseloop.ui.components.PulseButtonStyle.Text, onClick = { refresh++ }) { Text(tr("Try again")) } + } } else { // Only after a moment: on a quick read the line would just flash before the cards. var slow by remember { mutableStateOf(false) } @@ -481,7 +485,7 @@ private fun TrendsSection(db: PulseLoopDatabase) { val bw = size.width / shown.size shown.forEachIndexed { i, p -> val h = ((p.value - lo) / range * size.height).toFloat().coerceAtLeast(2f) - drawRect(PulseColors.accent, Offset(i * bw + bw * 0.15f, size.height - h), Size(bw * 0.7f, h)) + drawRect(PulseColors.info, Offset(i * bw + bw * 0.15f, size.height - h), Size(bw * 0.7f, h)) } } val last = shown.last() @@ -538,12 +542,7 @@ fun BreatheScreen(onBack: () -> Unit) { } Column(Modifier.fillMaxSize().background(PulseColors.background).padding(16.dp), horizontalAlignment = Alignment.CenterHorizontally) { - Box(Modifier.fillMaxWidth()) { - IconButton(onClick = { if (startedAt != null) finish(); onBack() }, modifier = Modifier.align(Alignment.CenterStart)) { - Icon(Icons.AutoMirrored.Filled.ArrowBack, tr("Back")) - } - Text(tr("Breathe"), modifier = Modifier.align(Alignment.Center), fontSize = 16.sp, fontWeight = FontWeight.Bold) - } + com.pulseloop.ui.components.PulseTopBar(tr("Breathe"), onBack = { if (startedAt != null) finish(); onBack() }) Spacer(Modifier.weight(1f)) val r = result when { diff --git a/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt index 5f5aafb8..9a095973 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/NutritionScreen.kt @@ -599,7 +599,7 @@ fun MealLogDialog( } } Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) { - OutlinedTextField(value = cal, onValueChange = { cal = decimalInput(it) ?: cal }, label = { Text("kcal", maxLines = 1, overflow = TextOverflow.Ellipsis) }, modifier = Modifier.weight(1f), singleLine = true, keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(keyboardType = androidx.compose.ui.text.input.KeyboardType.Decimal)) + OutlinedTextField(value = cal, onValueChange = { cal = decimalInput(it) ?: cal }, label = { Text(tr("kcal"), maxLines = 1, overflow = TextOverflow.Ellipsis) }, modifier = Modifier.weight(1f), singleLine = true, keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(keyboardType = androidx.compose.ui.text.input.KeyboardType.Decimal)) OutlinedTextField(value = protein, onValueChange = { protein = decimalInput(it) ?: protein }, label = { Text(tr("Protein (g)"), maxLines = 1, overflow = TextOverflow.Ellipsis) }, modifier = Modifier.weight(1f), singleLine = true, keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(keyboardType = androidx.compose.ui.text.input.KeyboardType.Decimal)) } Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) { @@ -747,7 +747,7 @@ private fun NextMealCard( idea.note?.let { Text(it, fontSize = 12.sp, color = PulseColors.textSecondary) } // Same treatment as the Photo/Describe pair: two lines allowed, equal heights. Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min), horizontalArrangement = Arrangement.spacedBy(8.dp)) { - PulseButton(onClick = onLog, modifier = Modifier.weight(1f).fillMaxHeight(), contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp)) { + PulseButton(PulseButtonStyle.Tonal, onClick = onLog, modifier = Modifier.weight(1f).fillMaxHeight(), contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp)) { Text(tr("Log this"), maxLines = 2, overflow = TextOverflow.Ellipsis, textAlign = TextAlign.Center) } if (onDiscuss != null) { diff --git a/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt index bf854a85..f7d1f679 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/OnboardingScreen.kt @@ -55,7 +55,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.scale -import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector @@ -366,12 +365,6 @@ private fun WelcomeStep( contentDescription = null, modifier = Modifier .size(92.dp) - .shadow( - 18.dp, - RoundedCornerShape(8.dp), - ambientColor = PulseColors.accent, - spotColor = PulseColors.accent, - ) .clip(RoundedCornerShape(8.dp)), ) StepHeader( @@ -550,7 +543,7 @@ private fun BaselineStep(finish: () -> Unit) { LaunchedEffect(Unit) { appeared = true } val medallionScale by animateFloatAsState( targetValue = if (appeared) 1f else 0.3f, - animationSpec = spring(dampingRatio = 0.6f, stiffness = Spring.StiffnessLow), + animationSpec = androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.EMPHASIS_MS, easing = com.pulseloop.ui.theme.Motion.ease), label = "medallionScale", ) diff --git a/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt index 520b3f1d..5c5c491e 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/PairingScreen.kt @@ -263,8 +263,8 @@ fun PairingScreen( // The permission card explains a missing grant; don't also show the raw scan error. if (state.lastError != null && !connected && hasBlePermissions) { Text( - state.lastError ?: "", - fontSize = 12.sp, + pairingErrorText(state.lastError), + fontSize = 14.sp, color = PulseColors.danger, textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth(), @@ -621,17 +621,17 @@ private fun ConnectedCard( LaunchedEffect(Unit) { appeared = true } val haloScale by animateFloatAsState( targetValue = if (appeared) 1f else 0.7f, - animationSpec = spring(dampingRatio = 0.6f, stiffness = Spring.StiffnessMediumLow), + animationSpec = androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.EMPHASIS_MS, easing = com.pulseloop.ui.theme.Motion.ease), label = "haloScale", ) val haloAlpha by animateFloatAsState( targetValue = if (appeared) 1f else 0f, - animationSpec = spring(dampingRatio = 0.6f, stiffness = Spring.StiffnessMediumLow), + animationSpec = androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.EMPHASIS_MS, easing = com.pulseloop.ui.theme.Motion.ease), label = "haloAlpha", ) val checkScale by animateFloatAsState( targetValue = if (checkmarkFired || appeared) 1f else 0.3f, - animationSpec = spring(dampingRatio = 0.55f, stiffness = Spring.StiffnessMedium), + animationSpec = androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.EMPHASIS_MS, easing = com.pulseloop.ui.theme.Motion.ease), label = "checkScale", ) @@ -779,3 +779,19 @@ private fun Context.findActivity(): Activity? { } return null } + + +/** + * The connection client's error as a state the user can act on. The raw text ("GATT connect + * failed: 133", "Scan failed: 2") names the engine and stays in the diagnostics panel below. + */ +private fun pairingErrorText(raw: String?): String { + val r = raw.orEmpty() + return when { + r.contains("permission", ignoreCase = true) -> tr("Bluetooth permission is off. Allow it to find your ring.") + r.contains("not powered on", ignoreCase = true) -> tr("Bluetooth is off. Turn it on to find your ring.") + r.contains("no longer available", ignoreCase = true) -> tr("Couldn't find the ring. Keep it close and scan again.") + r.startsWith("Scan failed") -> tr("Couldn't scan for rings. Try again.") + else -> tr("Couldn't connect. Keep the ring close and try again.") + } +} diff --git a/app/src/main/java/com/pulseloop/ui/screens/PostpartumUi.kt b/app/src/main/java/com/pulseloop/ui/screens/PostpartumUi.kt index 526252b7..79383b04 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/PostpartumUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/PostpartumUi.kt @@ -9,6 +9,8 @@ import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* +import androidx.compose.foundation.selection.selectableGroup +import androidx.compose.foundation.selection.selectable import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll @@ -295,7 +297,7 @@ fun PostpartumScreen(onBack: () -> Unit, onOpenProfile: () -> Unit) { Postpartum.nextCheckIn(birth, today, history)?.let { next -> Text(trf("Suggested next check-in: {0}", next.format(DateTimeFormatter.ofPattern("d MMM"))), fontSize = 12.sp, color = PulseColors.textMuted) } - PulseButton(onClick = { checkIn = true }) { Text(tr("Start check-in")) } + PulseButton(PulseButtonStyle.Tonal, onClick = { checkIn = true }) { Text(tr("Start check-in")) } Text(tr("Your answers stay on this phone. They aren't in backups, diagnostics or Health Connect."), fontSize = 12.sp, color = PulseColors.textMuted) } } val lastEpds = history.lastOrNull() @@ -437,7 +439,8 @@ private fun ResourcesCard(context: Context) { @Composable private fun ResourceRow(label: String, action: String, onClick: () -> Unit) { - Row(Modifier.fillMaxWidth().clickable(onClick = onClick).padding(vertical = 6.dp), verticalAlignment = Alignment.CenterVertically) { + // 48dp and a button role: these rows dial emergency lines, so they must be easy to hit and to find. + Row(Modifier.fillMaxWidth().heightIn(min = 48.dp).clickable(role = androidx.compose.ui.semantics.Role.Button, onClick = onClick), verticalAlignment = Alignment.CenterVertically) { Text(label, fontSize = 14.sp, color = PulseColors.textPrimary, modifier = Modifier.weight(1f)) Text(action, fontSize = 14.sp, fontWeight = FontWeight.Bold, color = PulseColors.accent) } @@ -511,11 +514,10 @@ private fun EpdsCheckIn(onDone: (Postpartum.EpdsResult?) -> Unit) { val answers = remember { mutableStateListOf().apply { repeat(form.items.size) { add(null) } } } var result by remember { mutableStateOf(null) } + // System Back behaves like the arrow: it returns to Postpartum and keeps a result already shown. + androidx.activity.compose.BackHandler { onDone(result) } Column(Modifier.fillMaxSize().background(PulseColors.background)) { - Box(Modifier.fillMaxWidth().padding(vertical = 4.dp)) { - IconButton(onClick = { onDone(result) }, modifier = Modifier.align(Alignment.CenterStart)) { Icon(Icons.AutoMirrored.Filled.ArrowBack, tr("Back")) } - Text(tr("Mood check-in"), modifier = Modifier.align(Alignment.Center), fontSize = 16.sp, fontWeight = FontWeight.Bold) - } + com.pulseloop.ui.components.PulseTopBar(tr("Mood check-in"), onBack = { onDone(result) }) Column( Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(12.dp), @@ -533,15 +535,20 @@ private fun EpdsCheckIn(onDone: (Postpartum.EpdsResult?) -> Unit) { form.items.forEachIndexed { i, item -> Card { Text("${i + 1}. ${item.text}", fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary) - item.options.forEachIndexed { o, opt -> - val on = answers[i] == o - Text( - opt.text, fontSize = 14.sp, - color = if (on) PulseColors.onAccent else PulseColors.textPrimary, - modifier = Modifier.fillMaxWidth().clip(RoundedCornerShape(6.dp)) - .background(if (on) PulseColors.accent else PulseColors.cardSoft) - .clickable { answers[i] = o }.padding(horizontal = 12.dp, vertical = 10.dp), - ) + // One radio group per question, so TalkBack says which answer is chosen. + Column(Modifier.selectableGroup(), verticalArrangement = Arrangement.spacedBy(8.dp)) { + item.options.forEachIndexed { o, opt -> + val on = answers[i] == o + Text( + opt.text, fontSize = 14.sp, + color = if (on) PulseColors.onAccent else PulseColors.textPrimary, + modifier = Modifier.fillMaxWidth().heightIn(min = 48.dp).clip(RoundedCornerShape(4.dp)) + .background(if (on) PulseColors.accent else PulseColors.cardSoft) + .selectable(selected = on, role = androidx.compose.ui.semantics.Role.RadioButton) { answers[i] = o } + .wrapContentHeight(Alignment.CenterVertically) + .padding(horizontal = 12.dp, vertical = 12.dp), + ) + } } } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt b/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt index 2b54e836..fd73ae8d 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/ReadinessUi.kt @@ -266,7 +266,7 @@ fun ReadinessScreen(db: PulseLoopDatabase, onBack: () -> Unit) { ScoreRing( value = score?.value, color = score?.let { bandColor(it.band) } ?: PulseColors.readiness, - size = 168.dp, stroke = 12.dp, centerSize = 48, + size = 168.dp, stroke = 12.dp, centerSize = 40, // An empty ring while loading, not the "no score" dash. centerText = score?.value?.toString() ?: if (load.loaded) "—" else "", ) @@ -385,15 +385,7 @@ fun ActivityScoreScreen(db: PulseLoopDatabase, onBack: () -> Unit, onOpenActivit val load = rememberActivityScoreLoad(db, Unit) val result = load.value Column(Modifier.fillMaxSize()) { - Box(Modifier.fillMaxWidth().padding(vertical = 4.dp)) { - IconButton(onClick = onBack, modifier = Modifier.align(Alignment.CenterStart)) { - Icon(Icons.AutoMirrored.Filled.ArrowBack, tr("Back")) - } - Text( - tr("Activity"), modifier = Modifier.align(Alignment.Center), - style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold, - ) - } + com.pulseloop.ui.components.PulseTopBar(tr("Activity"), onBack) Column( Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(16.dp), @@ -402,7 +394,7 @@ fun ActivityScoreScreen(db: PulseLoopDatabase, onBack: () -> Unit, onOpenActivit ScoreRing( value = result?.value, color = result?.let { bandColor(it.band) } ?: PulseColors.steps, - size = 168.dp, stroke = 12.dp, centerSize = 48, + size = 168.dp, stroke = 12.dp, centerSize = 40, centerText = result?.value?.toString() ?: if (load.loaded) "—" else "", ) result?.let { @@ -417,11 +409,9 @@ fun ActivityScoreScreen(db: PulseLoopDatabase, onBack: () -> Unit, onOpenActivit ) } result?.let { ContributorsCard(it.contributors) } - Text( - tr("Open today's activity"), - fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.steps, - modifier = Modifier.clip(RoundedCornerShape(4.dp)).clickable(onClick = onOpenActivity).padding(8.dp), - ) + com.pulseloop.ui.components.PulseButton(com.pulseloop.ui.components.PulseButtonStyle.Text, onClick = onOpenActivity) { + Text(tr("Open today's activity")) + } Text( tr("Activity is estimated by PulseLoop from your ring's steps and the workouts you log. It is not a medical measurement."), fontSize = 12.sp, color = PulseColors.textMuted, @@ -432,7 +422,7 @@ fun ActivityScoreScreen(db: PulseLoopDatabase, onBack: () -> Unit, onOpenActivit } fun activityHeadline(result: com.pulseloop.service.ActivityScore.Result?): String { - if (result == null) return "No activity recorded yet. Sync your ring to see today's score." + if (result == null) return tr("No activity recorded yet. Sync your ring to see today's score.") val weakest = result.contributors.minByOrNull { it.score }?.takeIf { it.score < 70 }?.title?.lowercase() return when (result.band) { Readiness.Band.OPTIMAL -> tr("Great balance of movement and recovery. Keep it up.") @@ -470,9 +460,9 @@ private fun DataBehindScore(db: PulseLoopDatabase, result: Readiness.Result?) { add(line(tr("Night covered by the ring"), "${(night.coverage * 100).roundToInt()}%")) add(line(tr("Heart-rate readings"), "${night.hrSamples}")) add(line(tr("HRV readings"), "${night.hrvSamples}")) - add(line(tr("Resting heart rate"), night.restingHr?.let { "${it.roundToInt()} bpm" } ?: "not measured")) - add(line("HRV", night.hrv?.let { "${it.roundToInt()} ms" } ?: "not measured")) - } else add(line(tr("Last night"), "no sleep recorded")) + add(line(tr("Resting heart rate"), night.restingHr?.let { "${it.roundToInt()} bpm" } ?: tr("not measured"))) + add(line(tr("HRV"), night.hrv?.let { "${it.roundToInt()} ms" } ?: tr("not measured"))) + } else add(line(tr("Last night"), tr("no sleep recorded"))) inputs?.let { add(line(tr("Nights in your baseline"), "${it.history.count { n -> n.restingHr != null || n.hrv != null }}")) } add(line(tr("Formula version"), "${com.pulseloop.service.Algorithms.VERSION}")) } diff --git a/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt index df99d65d..f0509a94 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/RecordScreen.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.graphics.Color 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.sp import com.pulseloop.service.HeartRateZones import com.pulseloop.settings.UnitConverter import com.pulseloop.settings.UnitSystem @@ -99,7 +100,7 @@ fun RecordScreen( // Large elapsed + HR Card(Modifier.fillMaxWidth(), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant)) { Column(Modifier.padding(20.dp), horizontalAlignment = Alignment.CenterHorizontally) { - Text(elapsed, style = MaterialTheme.typography.displayMedium, fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.primary) + Text(elapsed, fontSize = 40.sp, fontWeight = FontWeight.Bold, color = PulseColors.textPrimary) Spacer(Modifier.height(4.dp)) val hrText = heartRate?.let { "$it bpm" } ?: "-- bpm" val zoneColor = when (hrZone) { @@ -110,7 +111,7 @@ fun RecordScreen( } Text(hrText, style = MaterialTheme.typography.headlineLarge, color = zoneColor) if (heartRateAdjusted) { - Text("adjusted by your accuracy check", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant) + Text(tr("adjusted by your accuracy check"), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant) } Text(tr(hrZone.label), style = MaterialTheme.typography.labelMedium, color = zoneColor) } diff --git a/app/src/main/java/com/pulseloop/ui/screens/Screens.kt b/app/src/main/java/com/pulseloop/ui/screens/Screens.kt index ef141d8a..8431e2d8 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/Screens.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/Screens.kt @@ -217,7 +217,7 @@ fun VitalsScreen( Text(tr("No blood pressure data yet."), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) } if (measuring) { - Text(tr("Measuring… updates when complete"), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) + Text(tr("Measuring… updates when complete"), fontSize = 12.sp, color = PulseColors.textSecondary) } } DashboardCard.HRV -> VitalCard( @@ -416,6 +416,7 @@ fun VitalsScreen( } var pickOpen by remember { mutableStateOf(false) } PulseButton( + PulseButtonStyle.Tonal, enabled = !measuring, modifier = Modifier.widthIn(max = 160.dp), onClick = { pickOpen = true }, @@ -436,6 +437,7 @@ fun VitalsScreen( } } else { PulseButton( + PulseButtonStyle.Tonal, enabled = !measuring, // Same reason as the bound above: the title is weighted, this isn't. modifier = Modifier.widthIn(max = 208.dp), @@ -563,9 +565,14 @@ private fun VitalGaugeCardItem( VitalCard( state = card, showsValueRow = false, - footerOverride = footnote ?: gaugeFooter(card), + footerOverride = gaugeFooter(card), onTap = onTap, ) { + // Its own wrapping line, never the one-line header slot: there it was cut to a couple + // of words, and the card stopped saying the number is derived (issue #67). + footnote?.let { + Text(it, fontSize = 12.sp, color = PulseColors.warning) + } if (hasReading) { Box( Modifier.fillMaxWidth().padding(vertical = 4.dp), @@ -587,7 +594,7 @@ private fun VitalGaugeCardItem( Text(emptyText, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) } if (measuring) { - Text(tr("Measuring… updates when complete"), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.primary) + Text(tr("Measuring… updates when complete"), fontSize = 12.sp, color = PulseColors.textSecondary) } } } diff --git a/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt b/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt index 7c248b2f..3bf89544 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/SettingsSubScreens.kt @@ -2690,7 +2690,7 @@ fun PrivacyDataSettingsScreen( title = { Text(tr("Error")) }, text = { Text(msg) }, confirmButton = { - PulseButton(PulseButtonStyle.Text, onClick = { statusMessage = null }) { Text("OK") } + PulseButton(PulseButtonStyle.Text, onClick = { statusMessage = null }) { Text(tr("OK")) } }, ) } @@ -2700,7 +2700,7 @@ fun PrivacyDataSettingsScreen( title = { Text(tr("Import Complete")) }, text = { Text(tr("Your data has been restored from the backup.")) }, confirmButton = { - PulseButton(PulseButtonStyle.Text, onClick = { showImportSuccess = false }) { Text("OK") } + PulseButton(PulseButtonStyle.Text, onClick = { showImportSuccess = false }) { Text(tr("OK")) } }, ) diff --git a/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt index 08359a37..037a580b 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/SleepScreen.kt @@ -634,7 +634,7 @@ private fun SleepHypnogram( val cur = sorted[i] val cx = xForMinute(cur.startMinute, size.width) drawLine( - color = Color(0xFFD2CDFF).copy(alpha = 0.46f), + color = PulseColors.sleep.copy(alpha = 0.46f), start = Offset(cx, laneY(prev.stageRaw, size.height)), end = Offset(cx, laneY(cur.stageRaw, size.height)), strokeWidth = 1.2.dp.toPx(), @@ -749,9 +749,9 @@ private fun SleepHypnogram( @Composable private fun SleepStageSummaryCards(prefix: String = "", deep: String, light: String, awake: String) { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp)) { - StageStat("${prefix}Deep", deep, PulseColors.stageDeep, Modifier.weight(1f)) - StageStat("${prefix}Light", light, PulseColors.stageLight, Modifier.weight(1f)) - StageStat("${prefix}Awake", awake, PulseColors.stageAwake, Modifier.weight(1f)) + StageStat(prefix + tr("Deep"), deep, PulseColors.stageDeep, Modifier.weight(1f)) + StageStat(prefix + tr("Light"), light, PulseColors.stageLight, Modifier.weight(1f)) + StageStat(prefix + tr("Awake"), awake, PulseColors.stageAwake, Modifier.weight(1f)) } } @@ -832,7 +832,7 @@ private fun SleepDurationHistogram( drawPath(barPath, PulseColors.stageDeep) drawDitherFade(barPath, PulseColors.stageLight, 1f, 0.12f, top, size.height) } else { - drawDither(barPath, PulseColors.accent, 0.06f) + drawDither(barPath, PulseColors.textMuted, 0.06f) } } if (goalMin != null && goalMin > 0) { diff --git a/app/src/main/java/com/pulseloop/ui/screens/TodayPrograms.kt b/app/src/main/java/com/pulseloop/ui/screens/TodayPrograms.kt index 3e958aca..7b2abae2 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/TodayPrograms.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/TodayPrograms.kt @@ -54,7 +54,7 @@ fun ProgramsRow(db: PulseLoopDatabase, onCycle: () -> Unit, onMeds: () -> Unit, val chips = buildList { if (Postpartum.active()) Postpartum.birthDate?.let { birth -> - add(Chip(Icons.Filled.ChildCare, PulseColors.accent, trf("Postpartum · week {0}", Postpartum.weeksSince(birth, today)), onPostpartum)) + add(Chip(Icons.Filled.ChildCare, PulseColors.bloodPressure, trf("Postpartum · week {0}", Postpartum.weeksSince(birth, today)), onPostpartum)) } Cycle.status(periods!!.map { it.toPeriod() }, today)?.let { s -> add(Chip(Icons.Filled.WaterDrop, PulseColors.danger, trf("Cycle · day {0}", s.cycleDay), onCycle)) diff --git a/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt index e640a95e..5db430df 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/TodayScreen.kt @@ -702,7 +702,7 @@ private fun ColumnScope.NutritionTileBody(food: FoodTotals?, onLog: () -> Unit) val kcal = food?.kcal ?: 0.0 Row(verticalAlignment = Alignment.Bottom, horizontalArrangement = Arrangement.spacedBy(4.dp)) { Text(Formats.count(kcal.toInt()), fontSize = 24.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary, maxLines = 1) - Text("kcal", fontSize = 12.sp, color = PulseColors.textMuted, modifier = Modifier.padding(bottom = 4.dp)) + Text(tr("kcal"), fontSize = 12.sp, color = PulseColors.textMuted, modifier = Modifier.padding(bottom = 4.dp)) } val goal = food?.goalKcal?.takeIf { it > 0 } if (goal != null) { @@ -715,7 +715,7 @@ private fun ColumnScope.NutritionTileBody(food: FoodTotals?, onLog: () -> Unit) Spacer(Modifier.weight(1f)) if (food != null && food.meals > 0) { Text( - "P ${food.proteinG.toInt()} · C ${food.carbsG.toInt()} · F ${food.fatG.toInt()} g", + trf("P {0} · C {1} · F {2} g", food.proteinG.toInt(), food.carbsG.toInt(), food.fatG.toInt()), fontSize = 12.sp, color = PulseColors.textSecondary, maxLines = 1, ) } else { diff --git a/app/src/main/java/com/pulseloop/ui/screens/WhatChangedUi.kt b/app/src/main/java/com/pulseloop/ui/screens/WhatChangedUi.kt index 63f11a13..5585af8e 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/WhatChangedUi.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/WhatChangedUi.kt @@ -1,5 +1,7 @@ package com.pulseloop.ui.screens +import androidx.compose.material.icons.filled.Info +import androidx.compose.material.icons.filled.CheckCircle import com.pulseloop.ui.i18n.trf import com.pulseloop.ui.i18n.tr @@ -50,10 +52,7 @@ fun WhatChangedScreen(onBack: () -> Unit) { val fmt = remember { DateTimeFormatter.ofPattern("EEE d MMM") } Column(Modifier.fillMaxSize().background(PulseColors.background)) { - Box(Modifier.fillMaxWidth().padding(vertical = 4.dp)) { - IconButton(onClick = onBack, modifier = Modifier.align(Alignment.CenterStart)) { Icon(Icons.AutoMirrored.Filled.ArrowBack, tr("Back")) } - Text(tr("What changed"), modifier = Modifier.align(Alignment.Center), fontSize = 16.sp, fontWeight = FontWeight.Bold) - } + com.pulseloop.ui.components.PulseTopBar(tr("What changed"), onBack) Column( Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 8.dp), verticalArrangement = Arrangement.spacedBy(12.dp), @@ -62,9 +61,9 @@ fun WhatChangedScreen(onBack: () -> Unit) { val recent = rows.filter { it.day >= recentKey } Column( Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(PulseColors.card).padding(16.dp), - verticalArrangement = Arrangement.spacedBy(6.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { - Text(tr("LAST 3 DAYS"), fontSize = 12.sp, letterSpacing = 1.6.sp, color = PulseColors.textMuted) + Text(tr("LAST 3 DAYS"), style = com.pulseloop.ui.theme.PulseType.eyebrow) if (rowsLoaded == null) { Spacer(Modifier.height(48.dp)) } else if (recent.isEmpty()) { @@ -76,11 +75,11 @@ fun WhatChangedScreen(onBack: () -> Unit) { } val older = rows.filter { it.day < recentKey }.groupBy { it.day } if (older.isNotEmpty()) { - Text(tr("EARLIER"), fontSize = 12.sp, letterSpacing = 1.6.sp, color = PulseColors.textMuted) + Text(tr("EARLIER"), style = com.pulseloop.ui.theme.PulseType.eyebrow) older.forEach { (day, list) -> Column( Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp)).background(PulseColors.card).padding(16.dp), - verticalArrangement = Arrangement.spacedBy(6.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { Text(FindingsRepository.dateOf(day, zone).format(fmt), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textMuted) list.forEach { FindingRow(it) } @@ -99,10 +98,13 @@ fun WhatChangedScreen(onBack: () -> Unit) { @Composable private fun FindingRow(f: FindingEntity) { - Row(verticalAlignment = Alignment.Top, horizontalArrangement = Arrangement.spacedBy(10.dp)) { - Box( - Modifier.padding(top = 6.dp).size(8.dp).clip(CircleShape) - .background(if (f.positive) PulseColors.accent else PulseColors.warning), + Row(verticalAlignment = Alignment.Top, horizontalArrangement = Arrangement.spacedBy(12.dp)) { + // An icon as well as a colour, so "good" and "look at this" don't rest on hue alone. + androidx.compose.material3.Icon( + if (f.positive) androidx.compose.material.icons.Icons.Filled.CheckCircle else androidx.compose.material.icons.Icons.Filled.Info, + contentDescription = if (f.positive) tr("Good sign") else tr("Worth a look"), + tint = if (f.positive) PulseColors.success else PulseColors.warning, + modifier = Modifier.size(22.dp), ) Column(Modifier.weight(1f)) { Text(f.title, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = PulseColors.textPrimary) diff --git a/app/src/main/java/com/pulseloop/ui/screens/WorkoutSummaryScreen.kt b/app/src/main/java/com/pulseloop/ui/screens/WorkoutSummaryScreen.kt index 99643d6d..54970949 100644 --- a/app/src/main/java/com/pulseloop/ui/screens/WorkoutSummaryScreen.kt +++ b/app/src/main/java/com/pulseloop/ui/screens/WorkoutSummaryScreen.kt @@ -140,7 +140,7 @@ fun WorkoutSummaryScreen( putExtra(android.content.Intent.EXTRA_STREAM, uri) addFlags(android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION) } - context.startActivity(android.content.Intent.createChooser(intent, "Export route (GPX)")) + context.startActivity(android.content.Intent.createChooser(intent, tr("Export route (GPX)"))) } } }) @@ -179,7 +179,7 @@ fun WorkoutSummaryScreen( AlertDialog( onDismissRequest = { confirmDelete = false }, title = { Text(tr("Delete workout?")) }, - text = { Text("This removes the session and its recorded route. This can't be undone.") }, + text = { Text(tr("This removes the session and its recorded route. This can't be undone.")) }, confirmButton = { PulseButton(PulseButtonStyle.Text, onClick = { confirmDelete = false @@ -476,18 +476,18 @@ private fun SummaryHeroBand(s: ActivitySessionEntity, durationSec: Int?, units: val parts = ActivityMeta.speedParts(s.distanceMeters, durationSec, units) M(parts?.first ?: "—", parts?.second ?: "SPEED", PulseColors.accent) } - else -> M(s.calories?.let { "${it.toInt()}" } ?: "—", "CALORIES", PulseColors.calories) + else -> M(s.calories?.let { "${it.toInt()}" } ?: "—", tr("CALORIES"), PulseColors.calories) } listOf( M(dist ?: "—", UnitConverter.distanceUnit(units).uppercase(java.util.Locale.ROOT), PulseColors.distance), - M(dur, "DURATION", PulseColors.textPrimary), + M(dur, tr("DURATION"), PulseColors.textPrimary), third, ) } else { listOf( - M(dur, "DURATION", PulseColors.textPrimary), - M(durationSec?.let { "${it / 60}" } ?: "—", "ACTIVE MIN", PulseColors.success), - M(s.calories?.let { "${it.toInt()}" } ?: "—", "CALORIES", PulseColors.calories), + M(dur, tr("DURATION"), PulseColors.textPrimary), + M(durationSec?.let { "${it / 60}" } ?: "—", tr("ACTIVE MIN"), PulseColors.success), + M(s.calories?.let { "${it.toInt()}" } ?: "—", tr("CALORIES"), PulseColors.calories), ) } val shape = RoundedCornerShape(8.dp) @@ -519,10 +519,10 @@ private fun StatsGrid(s: ActivitySessionEntity) { val corrections = rememberAccuracyCorrections() fun hr(v: Double?) = v?.let { "${corrections.heartRate(it).toInt()}" } ?: "—" val stats = buildList { - if (s.useGps) add("Calories" to (s.calories?.let { "${it.toInt()}" } ?: "—")) - add("Avg HR" to hr(s.avgHeartRate)) - add("Max HR" to hr(s.maxHeartRate)) - add("Min HR" to hr(s.minHeartRate)) + if (s.useGps) add(tr("Calories") to (s.calories?.let { "${it.toInt()}" } ?: "—")) + add(tr("Avg HR") to hr(s.avgHeartRate)) + add(tr("Max HR") to hr(s.maxHeartRate)) + add(tr("Min HR") to hr(s.minHeartRate)) add("SpO₂" to (s.latestSpO2?.let { "${corrections.spo2(it).toInt()}%" } ?: "—")) } Column(verticalArrangement = Arrangement.spacedBy(12.dp)) { @@ -576,7 +576,7 @@ private fun SplitsCard(points: List, units: UnitSystem, .padding(16.dp), verticalArrangement = Arrangement.spacedBy(10.dp), ) { - Text("SPLITS", fontSize = 12.sp, fontWeight = FontWeight.Medium, letterSpacing = 1.sp, color = PulseColors.textMuted) + Text(tr("SPLITS"), style = com.pulseloop.ui.theme.PulseType.eyebrow) splits.forEachIndexed { index, seconds -> val isFastest = seconds == fastest val frac = if (slowest > fastest) (seconds - fastest) / (slowest - fastest) else 0.0 diff --git a/app/src/main/java/com/pulseloop/ui/theme/Motion.kt b/app/src/main/java/com/pulseloop/ui/theme/Motion.kt index c9716d09..b5bbc681 100644 --- a/app/src/main/java/com/pulseloop/ui/theme/Motion.kt +++ b/app/src/main/java/com/pulseloop/ui/theme/Motion.kt @@ -28,6 +28,12 @@ import androidx.compose.ui.graphics.graphicsLayer object Motion { /** A ring filling, a number counting up: long enough to see, short enough not to wait for. */ const val FILL_MS = 900 + /** The design system's standard duration: small state changes. */ + const val STANDARD_MS = 150 + /** The design system's emphasised duration: something appearing or moving into place. */ + const val EMPHASIS_MS = 250 + /** The one ease (quick out, gentle in). No springs that overshoot: the system has no bounce. */ + val ease: androidx.compose.animation.core.Easing = androidx.compose.animation.core.FastOutSlowInEasing } /** diff --git a/app/src/main/java/com/pulseloop/ui/theme/Theme.kt b/app/src/main/java/com/pulseloop/ui/theme/Theme.kt index 7a844b70..c41641f4 100644 --- a/app/src/main/java/com/pulseloop/ui/theme/Theme.kt +++ b/app/src/main/java/com/pulseloop/ui/theme/Theme.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.em +import androidx.compose.ui.unit.sp import com.pulseloop.R // GMind branding: Ubuntu Mono throughout, mint #43F3B7 as the one accent with ink-green @@ -53,7 +54,15 @@ private fun darkScheme() = darkColorScheme( * height: a 13sp label inherited bodyLarge's 24sp and a wrapped line opened a gap under it. */ private fun Typography.withFamily(family: FontFamily): Typography { - fun TextStyle.f() = copy(fontFamily = family, lineHeight = (lineHeight.value / fontSize.value).em) + // Every Material style lands on PulseType.SCALE too: its own 57/45/36/22/11sp sizes were + // reachable through `MaterialTheme.typography.*` and slipped past PulseTypeScaleTest, which + // only sees inline `fontSize` (audit, v2.11.58). The line-height ratio is kept. + fun TextStyle.f(): TextStyle { + val ratio = lineHeight.value / fontSize.value + val onScale = PulseType.SCALE.minByOrNull { kotlin.math.abs(it - fontSize.value) }!! + val size = if (fontSize.value < PulseType.SCALE.first()) PulseType.SCALE.first() else onScale + return copy(fontFamily = family, fontSize = size.sp, lineHeight = ratio.em) + } return copy( displayLarge = displayLarge.f(), displayMedium = displayMedium.f(), displaySmall = displaySmall.f(), headlineLarge = headlineLarge.f(), headlineMedium = headlineMedium.f(), headlineSmall = headlineSmall.f(), @@ -63,7 +72,7 @@ private fun Typography.withFamily(family: FontFamily): Typography { ) } -private val PulseTypography = Typography().withFamily(UbuntuMono) +internal val PulseTypography = Typography().withFamily(UbuntuMono) /** * Always the dark scheme: every screen draws on [PulseColors]' dark tokens, so a light Material diff --git a/app/src/main/java/com/pulseloop/ui/viewmodels/ViewModels.kt b/app/src/main/java/com/pulseloop/ui/viewmodels/ViewModels.kt index 51e12ad3..9d52e7d6 100644 --- a/app/src/main/java/com/pulseloop/ui/viewmodels/ViewModels.kt +++ b/app/src/main/java/com/pulseloop/ui/viewmodels/ViewModels.kt @@ -996,8 +996,35 @@ class CoachViewModel( /** The persisted row's id, null for the client-side-only greeting. Lets * [CoachToolTraceDisclosure] (iOS #65c) query `coach_tool_calls` by messageId. */ val id: String? = null, + /** Changes the coach proposed in this turn and hasn't made: each waits for the user's + * Confirm on its card (`CoachActionCardView`). Nothing runs until then. In memory only: + * a proposal left unanswered when the screen goes away is dropped, never applied. */ + val pendingActions: List = emptyList(), ) + /** The user confirmed a proposed change: run it, then say what happened as a coach line. */ + fun confirmAction(messageIndex: Int, action: com.pulseloop.coach.orchestration.PendingAction) { + dropAction(messageIndex, action) + viewModelScope.launch { + val outcome = runCatching { com.pulseloop.coach.orchestration.PendingActionExecutor.execute(action, db) } + .getOrElse { tr("Couldn't make that change. Nothing was changed.") } + _state.update { it.copy(messages = it.messages + ChatMessage("assistant", outcome)) } + } + } + + /** The user said no: the card goes and nothing changes. */ + fun cancelAction(messageIndex: Int, action: com.pulseloop.coach.orchestration.PendingAction) { + dropAction(messageIndex, action) + } + + private fun dropAction(messageIndex: Int, action: com.pulseloop.coach.orchestration.PendingAction) { + _state.update { s -> + s.copy(messages = s.messages.mapIndexed { i, m -> + if (i == messageIndex) m.copy(pendingActions = m.pendingActions - action) else m + }) + } + } + private val greeting = ChatMessage("assistant", tr("Hi! I'm your PulseLoop coach. I can answer questions about your sleep, heart rate, activity, and recovery. What would you like to know?")) @@ -1113,7 +1140,10 @@ class CoachViewModel( val reply = if (turnError != null) { ChatMessage("assistant", turnError.plainText, isError = true, id = assistantMessageId) } else { - ChatMessage("assistant", result.assistant.plainText, id = assistantMessageId) + ChatMessage("assistant", result.assistant.plainText, id = assistantMessageId, + // Shown as confirm cards under the reply (it used to be dropped here, so a + // proposed edit or delete never reached the user and never ran). + pendingActions = result.pendingActions) } // The red error bubble (above) already carries the code + reason; don't also set // `error`, or CoachScreen renders a duplicate "Error: " footer for the same @@ -1162,9 +1192,11 @@ class CoachViewModel( // "+" tap mid-turn already moved `currentConversation` on to a newer one. if (currentConversation.id == conversationId) currentConversation = touched } catch (e: Exception) { + // A state, not a log: the exception text goes to logcat, not into the chat. + android.util.Log.w("CoachViewModel", "Coach turn failed", e) _state.update { it.copy( - messages = it.messages + ChatMessage("assistant", trf("Sorry, something went wrong: {0}", e.message)), - isThinking = false, error = e.message, + messages = it.messages + ChatMessage("assistant", tr("Couldn't reach the coach. Try again."), isError = true), + isThinking = false, error = null, ) } } } diff --git a/app/src/main/java/com/pulseloop/widgets/WidgetConfigActivity.kt b/app/src/main/java/com/pulseloop/widgets/WidgetConfigActivity.kt index d95d6d0e..52546a5b 100644 --- a/app/src/main/java/com/pulseloop/widgets/WidgetConfigActivity.kt +++ b/app/src/main/java/com/pulseloop/widgets/WidgetConfigActivity.kt @@ -12,6 +12,7 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -113,6 +114,8 @@ private fun ConfigScreen( Modifier .fillMaxSize() .background(PulseColors.background) + // targetSdk 35 draws edge to edge: keep the title off the status bar and the button off the nav bar. + .safeDrawingPadding() .verticalScroll(rememberScrollState()) .padding(20.dp), verticalArrangement = Arrangement.spacedBy(8.dp), diff --git a/app/src/test/java/com/pulseloop/ui/theme/PulseTypographyTest.kt b/app/src/test/java/com/pulseloop/ui/theme/PulseTypographyTest.kt new file mode 100644 index 00000000..b63887bf --- /dev/null +++ b/app/src/test/java/com/pulseloop/ui/theme/PulseTypographyTest.kt @@ -0,0 +1,21 @@ +package com.pulseloop.ui.theme + +import org.junit.Assert.assertTrue +import org.junit.Test + +/** Material's own styles sit on the type scale too, so `MaterialTheme.typography.*` can't go below 12sp. */ +class PulseTypographyTest { + @Test + fun everyMaterialStyleIsOnTheScale() { + val t = PulseTypography + val styles = mapOf( + "displayLarge" to t.displayLarge, "displayMedium" to t.displayMedium, "displaySmall" to t.displaySmall, + "headlineLarge" to t.headlineLarge, "headlineMedium" to t.headlineMedium, "headlineSmall" to t.headlineSmall, + "titleLarge" to t.titleLarge, "titleMedium" to t.titleMedium, "titleSmall" to t.titleSmall, + "bodyLarge" to t.bodyLarge, "bodyMedium" to t.bodyMedium, "bodySmall" to t.bodySmall, + "labelLarge" to t.labelLarge, "labelMedium" to t.labelMedium, "labelSmall" to t.labelSmall, + ) + val off = styles.filter { (_, s) -> s.fontSize.value.toInt() !in PulseType.SCALE || s.fontSize.value % 1f != 0f } + assertTrue("Off the scale: " + off.map { "${it.key}=${it.value.fontSize}" }, off.isEmpty()) + } +} diff --git a/audits/2026-11-04-v2.11.58-all-screens.md b/audits/2026-11-04-v2.11.58-all-screens.md new file mode 100644 index 00000000..ac5050b3 --- /dev/null +++ b/audits/2026-11-04-v2.11.58-all-screens.md @@ -0,0 +1,181 @@ +# Audit: every screen and flow (v2.11.58) + +Date: 2026-11-04 · PR: see below · Auditor: Claude (four parallel read-only passes, one per +journey, each finding checked against the code before it was fixed) + +## Scope + +Every screen and flow in the app, grouped by journey: + +- **Today and chrome:** header, tab bar and rail, Today, the Actions sheet, My Health, Readiness, + Activity score, What changed, Breathe. +- **Vitals, Sleep, Activity:** Vitals, vital detail, measure, Sleep, hypnogram, Activity, Record, + live workout, workout summary, log past activity, journal. +- **Nutrition, programs, coach:** Nutrition, meal log (typing, photo, barcode), Drinks, Meds, + Body, Cycle, Postpartum with the EPDS check-in, Lab reports, Coach and its cards. +- **First run, ring, Settings:** onboarding, pairing, Ring & sync, every Settings group, Accuracy + check, Health Connect source, Language, the update sheet, widget config. + +Known divergences were not reported: D-2 wipe, D-3 dither, D-4 dark only, D-5 tab titles, D-6 +48dp rows, D-9 shared hues, P3-2 button pill shape. + +**Every skill was read from its vendored copy** (`.claude/skills/*`), so none had to be applied by +hand. Impeccable is scored against `reference/audit.native.md` and `android.md`. + +## graphic-design-fundamentals (§13 checklist) + +The four passes are merged; "fixed" means the failing items below were corrected in this PR. + +| # | Question | Result | +|---|---|---| +| 1 | Brief | Pass. Each tab answers its own question; each program screen does one job | +| 2 | Concept | Pass. The dithered, monospaced instrument look holds | +| 3 | Hierarchy | Pass with notes. One hero per screen. Open: Log past activity's two 20sp titles; the onboarding finale says "done" three times | +| 4 | Contrast | **Was failing, fixed.** Mint meant tap, good, taken, in range, dry, route and selected all at once. Now mint is only "tap here"; `success` carries good | +| 5 | Alignment and grid | Pass with notes. 16dp gutters hold. Off-scale 5/6/10/14/18/20/22dp spacing remains in places (P3, carried) | +| 6 | Spacing | Fail, carried (P3). Fixed where touched: VitalCard, WhatChanged, cards, battery chip | +| 7 | Typography | **Was failing, fixed.** Material's styles (11/22/45/57sp) sat outside the scale; they now snap to it, and `PulseTypographyTest` pins that. Hand-rolled eyebrows were replaced where touched | +| 8 | Colour | **Was failing, fixed.** See 4. Also: a literal colour in the hypnogram, Lab "In range" and its chart, the battery chip always green | +| 9 | Consistency | **Was failing, partly fixed.** `PulseTopBar` now serves pushed screens: What changed, Activity score, Breathe, Mood check-in. Others are still hand-rolled (P3, carried) | +| 10 | Simplicity | Pass with cuts (see less-is-more). The raw tool JSON under every coach reply is gone | +| 11 | Real-size test | **Was failing, fixed.** The derived-stress label was cut off; tap targets were under 48dp (EPDS answers, crisis dial rows, Drinks More/Undo/+ drink, Journal day switch, Accuracy Details, Readiness link). Open: the pairing dots overflow with 22 models; the pager clips at large font (P2, carried) | +| 12 | Accessibility and ergonomics | **Was failing, fixed.** EPDS answers are a radio group, and Back keeps the result. Crisis rows are 48dp buttons. What changed shows an icon as well as a colour | +| 13 | Production | Pass. Every `tr()` key has a pt-BR entry (script-checked, including concatenated keys); 60+ unwrapped strings were wrapped | + +## impeccable (audit, native / Android) + +Before → after this PR, merged across the four journeys: + +| # | Dimension | Before | After | Key finding | +|---|---|---|---|---| +| 1 | Accessibility | 2 | 3 | Targets and radio semantics fixed. Font-scale and pairing-dots overflow are still open | +| 2 | Performance | 3 | 3 | Coach photo bitmaps decode on the main thread (P2, carried) | +| 3 | Appearance & theming | 2 | 3 | Colour roles and type scale fixed. Spacing and eyebrows are partly done | +| 4 | Platform conformance | 2 | 3 | Back on EPDS, edge-to-edge widget config, confirm before delete, no bounce. Some top bars are still hand-rolled | +| 5 | Adaptivity | 3 | 3 | Record doesn't scroll in landscape; the pager has a fixed 300dp height (P2, carried) | +| | **Total** | **12/20** | **15/20** | **Good**; the carried P2/P3s are below | + +### Findings and what happened + +**P0, fixed** +- **The coach's proposed edits and deletes never reached the user.** `pendingActions` was dropped + in `CoachViewModel`, and `CoachActionCardView` was never shown. Now the confirm card sits under + the reply, and the change runs only on Confirm (`confirmAction` / `cancelAction`). + +**P1, fixed** +- **Raw exception text in the coach, meal analysis and lab reading.** These now show plain + states, and the exception goes to logcat. +- **Raw tool JSON under every coach reply.** Removed. "Used N tools" is translated, and the trace + row is a 48dp button. +- **EPDS check-in:** + - answers had no radio semantics and were about 40dp tall; + - Back threw the result away; + - the SAMU/CVV rows were about 32dp tall. +- **Lab reports showed "In range" in mint.** Now `success`. +- **Extra filled mint buttons on tabs:** Vitals Measure, Nutrition "Log this", the HC source cards + and the coach confirm. All are tonal now. +- **Drinks More/Undo/+ drink were about 24dp targets.** Now 48dp with a button role. +- **Deleting a period took one tap with no confirm.** It now asks first. +- **The derived-stress label was cut to about 24 characters,** which broke the issue #67 rule. It + is now its own wrapping line. +- **Sleep stage labels, workout labels and many other strings were untranslated.** All wrapped, + with pt-BR entries. +- **11sp text, through Material's `labelSmall`.** Fixed for the whole app in `Theme.kt`. +- **The Journal day switch was about a 28dp target.** Now 48dp. +- **Widget config had no system-bar insets on targetSdk 35.** It now uses `safeDrawingPadding`. +- **Pairing showed "GATT connect failed: 133".** It shows a plain state now; the raw text stays in + diagnostics. +- **The Accuracy "Details" link was about a 16dp target.** Now a PulseButton. + +**P2, fixed** +- **My Health's load failure was a dead end.** It now offers Try again. +- **Mint used for status:** + - fixed in What changed, Log sheet "Logged", Drinks (dry days, streak, AUDIT-C), Meds "Taken", + My Health trend bars, the Lab chart, the Record timer, untracked Sleep bars, the route line + and the Postpartum chip; + - tab and selected-chip mint is allowed, since the mint token itself lists the active tab pill. +- **Glow shadows** in Today tiles, VitalCard and the onboarding logo: removed. +- **Bouncy springs** in onboarding and pairing are now `Motion.EMPHASIS_MS` with `Motion.ease`. + `STANDARD_MS` was added too. +- **The battery chip was always green.** It is tinted by level now. +- **Score centre text was 48sp.** Now 40. +- **The Readiness link** is now a PulseButton. +- **"Start check-in"** is tonal, so the crisis buttons lead. + +**P2, carried (next audit)** +- Pairing: the dots overflow with more than 8 models, and the pager's fixed 300dp clips at large + font scale. +- Record doesn't scroll in landscape. +- Coach photo decode runs on the main thread, and attach / new chat share one icon. +- Dates and times: several are forced to 24 hours or English month names. Use + `DateFormat.is24HourFormat` and localised patterns. +- Nutrition with no goal shows "of 2000" as if the user had set it. +- Onboarding: + - the finale promises a baseline at days 3–7, but it is 14 nights; + - its goal save skips `GoalSync`; + - "Skip" is about 43dp tall. +- "Unpair & Reset" sits on Backup & data. Unpairing belongs on Ring & sync only. +- Settings sub-screens use `TopAppBar`; the hub and Pairing have no bar. +- Mint is still decorative on the recognised-ring stripe and on Settings icons. +- A Lab review is thrown away on Back or Discard without asking. +- CVV in Drinks Support doesn't dial. +- The vital-detail explainer for derived stress, and its disclaimer placement. +- Toasts in Sleep should be Snackbars. +- Workout map: no spoken summary, and its aspect ratio is distorted. + +**P3, carried:** +- off-scale spacing; +- hand-rolled eyebrows and top bars on the remaining screens; +- 18/26dp icons; +- `Color.White` in the chrome; +- clickables without a role; +- title case in a few labels ("Forget Ring", "Add Widget"); +- dead code: `HeroInsightCard`, `UnusualSignalsCard`, `SimpleLineChart`, `MetricWithSparkline`, + `CoachResponseView`, `CoachChartView`; +- `tr(" · %.2f %s")` used as a format key; +- AGENTS.md says the readiness ring wears the brand colour, but Readiness and Activity score + colour it by band. The code's bands are the more useful reading, so the rule text should + change. + +## less-is-more + +| Element | Question (1–5) | Kept / moved / merged / removed, and where | +|---|---|---| +| Raw tool output under every coach reply | 1, 3 | **Removed** (state, not log); the label line stays | +| Exception text in chat and sheets | 1 | **Removed**; plain state + logcat | +| Stage cards' untranslated labels | — | Kept, translated | +| Derived-stress label in the header slot | 2 | **Moved** to its own line under the card title | +| Pairing raw error | 1 | **Moved** to diagnostics; plain state on screen | +| "Today" LastNightCard repeating duration + score beside the Sleep tile | 2 | Carried: keep only the drinks line when the tile is shown | +| "Customize cards" row on every Today/Vitals visit | 5 | Carried: proposed behind a long-press or overflow (rare action; common taps unchanged) | +| FOOD moment card's Photo/Barcode/Add beside the tile's Log meal | 2 | Carried: one door, both straight to the method | +| Vitals "Tap to start" subtitle on each Measure option | 3 | Carried: cut | +| Sleep empty state shown three ways | 2 | Carried: one empty state | +| Workout summary "ACTIVE MIN" (= duration/60) | 2 | Carried: replace with Avg HR | +| Settings one-row sections (Notifications, AI Coach) and the duplicate "Ring & sync" row beside the hero | 2 | Carried: merge | +| Onboarding finale "done" screen | 3 | Carried: finish on Save goals (−1 tap) | +| Lab reports "Tap a report…" / "Tap a row…" hints | 3 | Carried: rows carry chevrons | +| What changed "formula version" footer | 3 | Kept for now; proposed behind "How it's worked out" | + +| Dimension | 0–4 | +|---|---| +| Elements per screen, compared with before | 3 (coach reply lost its JSON trace; nothing added except the confirm card that was missing) | +| Duplicates left | 2 (the carried cuts above) | +| Text to read when tired | 3 (logs and exception text gone from every surface touched) | +| Taps on the common actions (must not rise) | 4 (none rose; a period delete gains a confirm, which is a destructive action, not a common one) | + +## Evidence + +- Script checks: + - every `tr()`/`trf()` key, including concatenated literals, has a pt-BR entry; + - no `Color(0x…)` left in screens outside the Fairy effect; + - no `.shadow(` left. +- New tests: `PulseTypographyTest` (every Material style is on the scale), alongside + `PulseTypeScaleTest` and `PulseButtonTest`. +- `drift.py --pulseloop`: 0 differences (no token changed). +- CI on the PR (unit tests, lint, assemble). + +## Verdict + +Merge: the P0 and every P1 are fixed. The carried P2/P3 items above are the next pass. The canvas +gets the visible changes: the coach confirm card, colour roles, and the Postpartum check-in.