diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/widget/agenda/AgendaWidget.kt b/app/src/main/java/de/jeanlucmakiola/calendula/widget/agenda/AgendaWidget.kt index e620b57..9c81d37 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/widget/agenda/AgendaWidget.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/widget/agenda/AgendaWidget.kt @@ -61,6 +61,7 @@ import de.jeanlucmakiola.calendula.ui.common.eventAccent import de.jeanlucmakiola.calendula.ui.common.EventDimAlpha import de.jeanlucmakiola.calendula.widget.AgendaWidgetStyle import de.jeanlucmakiola.floret.glance.LocalWidgetSeeThrough +import de.jeanlucmakiola.floret.glance.withAlpha import de.jeanlucmakiola.calendula.widget.WidgetDimFillAlpha import de.jeanlucmakiola.calendula.widget.widgetEventInk import de.jeanlucmakiola.calendula.ui.common.SECONDARY_INK_ALPHA @@ -422,7 +423,7 @@ private fun ClassicEventRow(row: AgendaRow.Event, data: AgendaWidgetData.Ready, text = event.title.ifBlank { context.getString(R.string.event_untitled) }, maxLines = 1, style = TextStyle( - color = if (dimmed) GlanceTheme.colors.outline else GlanceTheme.colors.onSurface, + color = if (dimmed) GlanceTheme.colors.onSurface.withAlpha(CLASSIC_DIM_INK) else GlanceTheme.colors.onSurface, fontSize = metrics.eventTitle, textDecoration = glanceDeclinedDecoration(event.isCrossedOut), ), @@ -431,7 +432,11 @@ private fun ClassicEventRow(row: AgendaRow.Event, data: AgendaWidgetData.Ready, text = eventTimeSummary(context, event, row.date, data.is24Hour), maxLines = 1, style = TextStyle( - color = if (dimmed) GlanceTheme.colors.outline else GlanceTheme.colors.onSurfaceVariant, + color = if (dimmed) { + GlanceTheme.colors.onSurfaceVariant.withAlpha(CLASSIC_DIM_INK) + } else { + GlanceTheme.colors.onSurfaceVariant + }, fontSize = metrics.eventTime, ), ) @@ -443,6 +448,9 @@ private fun ClassicEventRow(row: AgendaRow.Event, data: AgendaWidgetData.Ready, private val CLASSIC_CARD_TOP_PAD = 8.dp private val CLASSIC_CARD_H_PAD = 10.dp +/** How strongly a finished event's text shows in the classic style, on any fill. */ +private const val CLASSIC_DIM_INK = 0.5f + /** Where each row sits among the rows of its day, from each row's date, for the grouped-card shapes. */ private fun dayPositions(dates: List): List = buildList { var start = 0 @@ -639,7 +647,7 @@ private fun agendaDayLabel(context: Context, date: LocalDate, today: LocalDate): val java = java.time.LocalDate.of(date.year, date.month.ordinal + 1, date.day) // Weekday + date in the locale's own field order (compact: no year), rather // than a hardcoded day-month layout. - val formatted = localizedDateFormatter(locale, "EEEdMMM").format(java) + val formatted = localizedDateFormatter(locale, if (date.year == today.year) "EEEdMMM" else "EEEdMMMy").format(java) return if (relative != null) "$relative ยท $formatted" else formatted } diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/widget/config/WidgetConfigScreen.kt b/app/src/main/java/de/jeanlucmakiola/calendula/widget/config/WidgetConfigScreen.kt index 4e93c13..125fa9b 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/widget/config/WidgetConfigScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/widget/config/WidgetConfigScreen.kt @@ -72,6 +72,7 @@ import kotlin.math.roundToInt import de.jeanlucmakiola.floret.components.GroupedSliderRow import de.jeanlucmakiola.calendula.widget.AgendaWidgetStyle import java.text.NumberFormat +import de.jeanlucmakiola.floret.locale.currentLocale import androidx.compose.runtime.remember private val PreviewMaxHeight = 280.dp @@ -247,7 +248,9 @@ private fun ConfigOptions( value = opacity, onValueChange = { onAppearance(state.appearance.copy(opacity = it)) }, position = Position.Middle, - valueLabel = remember(opacity) { NumberFormat.getPercentInstance().format(opacity) }, + valueLabel = currentLocale().let { locale -> + remember(opacity, locale) { NumberFormat.getPercentInstance(locale).format(opacity) } + }, valueRange = MIN_OPACITY..1f, steps = OPACITY_STEPS, ) diff --git a/floret-kit b/floret-kit index 8ce070f..24c9257 160000 --- a/floret-kit +++ b/floret-kit @@ -1 +1 @@ -Subproject commit 8ce070f4903318f393899b0b3cdc0cfd8ed78b0d +Subproject commit 24c92571ab8bac74ce8dd27b10876ee0a335848f