fix(#459): move the summary pointer into a picker footer, hide it once on
This commit is contained in:
1 parent
f14f6f32f4
commit
770a4756a4
4 files changed
+24
-38
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
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -429,7 +429,7 @@ private fun OverrideRow(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ChevronIcon() {
|
||||
internal fun ChevronIcon() {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight,
|
||||
contentDescription = null,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -809,7 +809,7 @@
|
||||
<!-- Daily summary notification (#459) -->
|
||||
<string name="settings_digest">Daily summary</string>
|
||||
<string name="settings_digest_hint">One notification listing a day\'s events</string>
|
||||
<string name="settings_fixed_reminder_digest_link">Want one list of tomorrow\'s events instead?</string>
|
||||
<string name="settings_fixed_reminder_digest_link">Want one list of the day\'s events instead?</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>
|
||||
<string name="settings_digest_day">Lists</string>
|
||||
|
||||
Reference in new issue
Block a user