Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47e737f8ec | ||
|
|
c4926145f3 | ||
|
|
770a4756a4 | ||
|
|
f14f6f32f4 |
No files matched your search
@@ -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
|
||||
@@ -131,7 +132,8 @@ 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.
|
||||
* editor. Applies live; the user leaves via back. [footer] follows the options
|
||||
* and gets [onDismiss] to close the picker.
|
||||
*/
|
||||
@Composable
|
||||
fun FixedTimeReminderPicker(
|
||||
@@ -141,6 +143,7 @@ fun FixedTimeReminderPicker(
|
||||
onDismiss: () -> Unit,
|
||||
inheritedLabel: String? = null,
|
||||
inherited: FixedTimeReminder? = null,
|
||||
footer: @Composable ColumnScope.(dismiss: () -> Unit) -> Unit = {},
|
||||
) {
|
||||
var current by rememberSaveable(stateSaver = FixedTimeOverrideSaver) { mutableStateOf(selected) }
|
||||
var editing by rememberSaveable { mutableStateOf(false) }
|
||||
@@ -192,6 +195,7 @@ fun FixedTimeReminderPicker(
|
||||
},
|
||||
)
|
||||
}
|
||||
footer(onDismiss)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ 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
|
||||
@@ -108,6 +110,7 @@ internal fun NotificationsScreen(
|
||||
var showFixedDefault by remember { mutableStateOf(false) }
|
||||
var showDigestDay by remember { mutableStateOf(false) }
|
||||
var showDigestTime by remember { mutableStateOf(false) }
|
||||
val digestRequester = remember { BringIntoViewRequester() }
|
||||
val scope = rememberCoroutineScope()
|
||||
val channelStatus by viewModel.channelStatus.collectAsStateWithLifecycle()
|
||||
val digestBlocked by viewModel.digestBlocked.collectAsStateWithLifecycle()
|
||||
@@ -193,6 +196,7 @@ internal fun NotificationsScreen(
|
||||
|
||||
Spacer(Modifier.height(24.dp))
|
||||
DailyDigestRows(
|
||||
switchRequester = digestRequester,
|
||||
digest = state.dailyDigest,
|
||||
blocked = channelStatus.appBlocked || digestBlocked,
|
||||
onEnable = toggleDigest,
|
||||
@@ -257,6 +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 },
|
||||
footer = { dismiss ->
|
||||
// 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_turn_on),
|
||||
summary = stringResource(R.string.settings_digest_hint),
|
||||
position = Position.Alone,
|
||||
onClick = {
|
||||
toggleDigest(true)
|
||||
dismiss()
|
||||
scope.launch { digestRequester.bringIntoView() }
|
||||
},
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
if (showDigestDay) {
|
||||
@@ -338,9 +358,11 @@ private fun DailyDigestRows(
|
||||
onPickDay: () -> Unit,
|
||||
onPickTime: () -> Unit,
|
||||
onOpenSound: () -> Unit,
|
||||
switchRequester: BringIntoViewRequester,
|
||||
) {
|
||||
GroupedSwitchRow(
|
||||
title = stringResource(R.string.settings_digest),
|
||||
modifier = Modifier.bringIntoViewRequester(switchRequester),
|
||||
checked = digest.enabled,
|
||||
onCheckedChange = onEnable,
|
||||
summary = if (digest.enabled) {
|
||||
|
||||
@@ -808,6 +808,7 @@
|
||||
<string name="settings_fixed_reminder_hint">Added to new timed events, e.g. the evening before. It follows the event when you move it to another time.</string>
|
||||
<!-- Daily summary notification (#459) -->
|
||||
<string name="settings_digest">Daily summary</string>
|
||||
<string name="settings_digest_turn_on">Turn on daily summary</string>
|
||||
<string name="settings_digest_hint">One notification listing a day\'s events</string>
|
||||
<!-- %1$s is settings_digest_day_today/tomorrow, %2$s a clock time. -->
|
||||
<string name="settings_digest_summary">%1$s at %2$s</string>
|
||||
|
||||
Reference in new issue
Block a user