diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt index f78fe9e9..4a5265d3 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/FixedTimeReminderUi.kt @@ -2,6 +2,7 @@ package de.jeanlucmakiola.calendula.ui.common import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth @@ -9,10 +10,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight import androidx.compose.material3.FilledTonalButton -import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -134,8 +132,7 @@ fun FixedTimeReminderEditor( * Picker for a fixed-time default (#459), full-screen: off, or a reminder at a * set time edited in place — and, on a per-calendar picker ([inheritedLabel] * non-null), deferring to the global default, [inherited], which also seeds the - * editor. Applies live; the user leaves via back. A non-null [onOpenDailySummary] - * adds a row leading to the daily summary, for a list of the day's events instead. + * editor. Applies live; the user leaves via back. [footer] follows the options. */ @Composable fun FixedTimeReminderPicker( @@ -145,7 +142,7 @@ fun FixedTimeReminderPicker( onDismiss: () -> Unit, inheritedLabel: String? = null, inherited: FixedTimeReminder? = null, - onOpenDailySummary: (() -> Unit)? = null, + footer: @Composable ColumnScope.() -> Unit = {}, ) { var current by rememberSaveable(stateSaver = FixedTimeOverrideSaver) { mutableStateOf(selected) } var editing by rememberSaveable { mutableStateOf(false) } @@ -197,22 +194,7 @@ fun FixedTimeReminderPicker( }, ) } - if (onOpenDailySummary != null) { - Spacer(Modifier.height(24.dp)) - GroupedRow( - title = stringResource(R.string.settings_digest), - summary = stringResource(R.string.settings_fixed_reminder_digest_link), - position = Position.Alone, - trailing = { - Icon( - imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight, - contentDescription = null, - tint = MaterialTheme.colorScheme.onSurfaceVariant, - ) - }, - onClick = onOpenDailySummary, - ) - } + footer() } } diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/CalendarReminderSettings.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/CalendarReminderSettings.kt index bec548ff..d5e4d2d8 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/CalendarReminderSettings.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/CalendarReminderSettings.kt @@ -429,7 +429,7 @@ private fun OverrideRow( } @Composable -private fun ChevronIcon() { +internal fun ChevronIcon() { Icon( imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null, diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt index 6079e765..8e1cccf8 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/NotificationSettings.kt @@ -15,12 +15,12 @@ import android.widget.Toast import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.relocation.BringIntoViewRequester -import androidx.compose.foundation.relocation.bringIntoViewRequester import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.relocation.BringIntoViewRequester +import androidx.compose.foundation.relocation.bringIntoViewRequester import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight import androidx.compose.material.icons.automirrored.filled.OpenInNew @@ -110,14 +110,7 @@ internal fun NotificationsScreen( var showFixedDefault by remember { mutableStateOf(false) } var showDigestDay by remember { mutableStateOf(false) } var showDigestTime by remember { mutableStateOf(false) } - var revealDigest by remember { mutableStateOf(false) } val digestRequester = remember { BringIntoViewRequester() } - LaunchedEffect(revealDigest) { - if (revealDigest) { - digestRequester.bringIntoView() - revealDigest = false - } - } val scope = rememberCoroutineScope() val channelStatus by viewModel.channelStatus.collectAsStateWithLifecycle() val digestBlocked by viewModel.digestBlocked.collectAsStateWithLifecycle() @@ -268,11 +261,22 @@ internal fun NotificationsScreen( selected = state.defaultFixedTimeReminder?.let { FixedTimeOverride.At(it) } ?: FixedTimeOverride.Off, onSelect = { viewModel.setDefaultFixedTimeReminder((it as? FixedTimeOverride.At)?.reminder) }, onDismiss = { showFixedDefault = false }, - onOpenDailySummary = { - showFixedDefault = false - revealDigest = true - }, - ) + ) { + // A pointer for those after one list of the day's events (#459). + if (!state.dailyDigest.enabled) { + Spacer(Modifier.height(24.dp)) + GroupedRow( + title = stringResource(R.string.settings_digest), + summary = stringResource(R.string.settings_fixed_reminder_digest_link), + position = Position.Alone, + trailing = { ChevronIcon() }, + onClick = { + showFixedDefault = false + scope.launch { digestRequester.bringIntoView() } + }, + ) + } + } } if (showDigestDay) { OptionPicker( diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3ae3eb25..89691ad6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -809,7 +809,7 @@ Daily summary One notification listing a day\'s events - Want one list of tomorrow\'s events instead? + Want one list of the day\'s events instead? %1$s at %2$s Lists