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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions app/src/main/assets/i18n/pt-BR.json

Large diffs are not rendered by default.

132 changes: 0 additions & 132 deletions app/src/main/java/com/pulseloop/coach/schema/CoachChartView.kt

This file was deleted.

134 changes: 0 additions & 134 deletions app/src/main/java/com/pulseloop/coach/schema/CoachResponseView.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ fun CoachToolTraceDisclosure(messageId: String, viewModel: CoachViewModel?) {
horizontalArrangement = Arrangement.spacedBy(4.dp),
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))
Icon(Icons.Filled.Build, null, tint = PulseColors.textMuted, modifier = Modifier.size(12.dp))
Text(
collapsedLabel(calls),
fontSize = 12.sp, color = PulseColors.textMuted,
modifier = Modifier.weight(1f),
)
Icon(
if (expanded) Icons.Filled.KeyboardArrowUp else Icons.Filled.KeyboardArrowDown,
null, tint = PulseColors.textMuted, modifier = Modifier.size(14.dp),
null, tint = PulseColors.textMuted, modifier = Modifier.size(16.dp),
)
}

AnimatedVisibility(
visible = expanded,
enter = expandVertically(tween(180)),
exit = shrinkVertically(tween(180)),
enter = expandVertically(tween(com.pulseloop.ui.theme.Motion.EMPHASIS_MS, easing = com.pulseloop.ui.theme.Motion.ease)),
exit = shrinkVertically(tween(com.pulseloop.ui.theme.Motion.STANDARD_MS, easing = com.pulseloop.ui.theme.Motion.ease)),
) {
Column(
verticalArrangement = Arrangement.spacedBy(6.dp),
Expand Down
13 changes: 8 additions & 5 deletions app/src/main/java/com/pulseloop/ui/PulseLoopApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ fun PulseLoopApp() {
backgroundColor = com.pulseloop.ui.theme.PulseColors.background,
tints = listOf(
dev.chrisbanes.haze.HazeTint(com.pulseloop.ui.theme.PulseColors.background.copy(alpha = 0.42f)),
dev.chrisbanes.haze.HazeTint(Color.White.copy(alpha = 0.04f)),
dev.chrisbanes.haze.HazeTint(com.pulseloop.ui.theme.PulseColors.textPrimary.copy(alpha = 0.04f)),
),
blurRadius = 24.dp,
noiseFactor = 0.02f,
Expand All @@ -433,8 +433,11 @@ fun PulseLoopApp() {
// blinking with the screen change.
androidx.compose.animation.AnimatedVisibility(
visible = showLogFab,
enter = androidx.compose.animation.scaleIn() + androidx.compose.animation.fadeIn(),
exit = androidx.compose.animation.scaleOut() + androidx.compose.animation.fadeOut(),
// The system's durations and ease (theme/Motion.kt), not Compose's default springs.
enter = androidx.compose.animation.scaleIn(androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.EMPHASIS_MS, easing = com.pulseloop.ui.theme.Motion.ease)) +
androidx.compose.animation.fadeIn(androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.EMPHASIS_MS, easing = com.pulseloop.ui.theme.Motion.ease)),
exit = androidx.compose.animation.scaleOut(androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.STANDARD_MS, easing = com.pulseloop.ui.theme.Motion.ease)) +
androidx.compose.animation.fadeOut(androidx.compose.animation.core.tween(com.pulseloop.ui.theme.Motion.STANDARD_MS, easing = com.pulseloop.ui.theme.Motion.ease)),
) {
ExtendedFloatingActionButton(
onClick = { LaunchRequests.openLog.value = com.pulseloop.ui.screens.LogStep.MENU },
Expand Down Expand Up @@ -590,8 +593,8 @@ fun PulseLoopApp() {
Icon(
if (selected) tab.selectedIcon else tab.unselectedIcon,
contentDescription = tab.label,
tint = if (selected) MaterialTheme.colorScheme.primary
else MaterialTheme.colorScheme.onSurfaceVariant,
tint = if (selected) com.pulseloop.ui.theme.PulseColors.accent
else com.pulseloop.ui.theme.PulseColors.textMuted,
)
}
}
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/java/com/pulseloop/ui/components/ActivityMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ object ActivityMeta {
"yoga" -> tr("Yoga")
"dance" -> tr("Dance")
"hike" -> tr("Hiking")
"other" -> tr("Other")
else -> type.replaceFirstChar { it.uppercase() }
}

Expand Down Expand Up @@ -127,3 +128,35 @@ object ActivityMeta {
else "%.1f".format(mps * 3.6) to "KM/H"
}
}

/**
* Times and dates in the phone's own format: the clock follows the system 12/24-hour setting and
* the dates follow the locale's own order and month names (a pattern like "MMM d" or "h:mm a"
* forced English order and a 12-hour clock on everyone).
*/
object PhoneFormat {
/** "07:42" or "7:42 AM", as the phone's clock setting says. */
fun clock(context: android.content.Context, epochMillis: Long): String =
clock(android.text.format.DateFormat.is24HourFormat(context), epochMillis)

/** The same, for code that read the 12/24-hour setting once already. Built the way the
* platform's own `DateFormat.getTimeFormat` builds it. */
fun clock(is24Hour: Boolean, epochMillis: Long): String {
val locale = java.util.Locale.getDefault()
val pattern = android.text.format.DateFormat.getBestDateTimePattern(locale, if (is24Hour) "Hm" else "hm")
return java.text.SimpleDateFormat(pattern, locale).format(java.util.Date(epochMillis))
}

/**
* A date from a skeleton ("EEEMMMd", "yMMMd", "EEEE", "EEEEMMMMd"), arranged the locale's way:
* "Wed, Nov 4" in English, "qua., 4 de nov." in Portuguese.
*/
fun date(skeleton: String, date: java.time.temporal.TemporalAccessor): String {
val locale = java.util.Locale.getDefault()
val pattern = android.text.format.DateFormat.getBestDateTimePattern(locale, skeleton)
return java.time.format.DateTimeFormatter.ofPattern(pattern, locale).format(date)
}

fun date(skeleton: String, epochMillis: Long): String =
date(skeleton, java.time.Instant.ofEpochMilli(epochMillis).atZone(java.time.ZoneId.systemDefault()))
}
Loading
Loading