Compare commits

...
5 changed files with 27 additions and 16 deletions

No files matched your search

@@ -203,7 +203,7 @@ fun CalendarHost(
var detailKey by rememberSaveable { mutableStateOf<LongArray?>(null) }
val onOpenDetail: (EventInstance) -> Unit = { event -> detailKey = event.occurrenceKey() }
// The drawer's "Hide in this view" picker (#517). It is its own window over
// The drawer's "Hide in “<view>” view" picker (#517). It is its own window over
// everything here, so each external request below closes it first.
var showViewCalendars by rememberSaveable { mutableStateOf(false) }
@@ -38,6 +38,7 @@ import de.jeanlucmakiola.calendula.ui.common.CalendarAccountGroup
import de.jeanlucmakiola.calendula.ui.common.CalendarColorChip
import de.jeanlucmakiola.calendula.ui.common.CalendarView
import de.jeanlucmakiola.calendula.ui.common.accountGroupTitle
import de.jeanlucmakiola.calendula.ui.common.label
import de.jeanlucmakiola.calendula.ui.common.orUnnamed
import de.jeanlucmakiola.floret.components.GroupedListInset
import de.jeanlucmakiola.floret.components.GroupedRow
@@ -70,6 +71,7 @@ fun CalendarFilterList(
hidden = s.hidden,
hiddenInView = hiddenInView,
hiddenOnlyHere = hiddenInView.size,
currentView = currentView,
onHideInView = onHideInView,
onToggleCalendar = viewModel::toggleCalendar,
onToggleGroup = viewModel::toggleGroup,
@@ -90,11 +92,13 @@ private fun FilterList(
hidden: Set<Long>,
hiddenInView: Set<Long>,
hiddenOnlyHere: Int,
currentView: CalendarView,
onHideInView: () -> Unit,
onToggleCalendar: (Long) -> Unit,
onToggleGroup: (List<Long>) -> Unit,
modifier: Modifier = Modifier,
) {
val viewName = currentView.label()
Column(modifier = modifier.fillMaxWidth()) {
groups.forEach { group ->
val ids = group.calendars.map { it.id }
@@ -107,7 +111,7 @@ private fun FilterList(
val visible = cal.id !in hidden
GroupedRow(
title = cal.displayName.orUnnamed(),
summary = if (cal.id in hiddenInView) stringResource(R.string.filter_hidden_in_view) else null,
summary = if (cal.id in hiddenInView) stringResource(R.string.filter_hidden_in_named_view, viewName) else null,
position = positionOf(index, group.calendars.size),
minHeight = 56.dp,
leading = { CalendarColorChip(cal.color) },
@@ -124,11 +128,11 @@ private fun FilterList(
// The per-view hide (#517): the drawer filter above hides everywhere, this only here.
Spacer(Modifier.height(8.dp))
GroupedRow(
title = stringResource(R.string.view_calendars_title),
title = stringResource(R.string.view_hide_in_title, viewName),
summary = if (hiddenOnlyHere > 0) {
pluralStringResource(R.plurals.drawer_hidden_in_view_count, hiddenOnlyHere, hiddenOnlyHere)
pluralStringResource(R.plurals.drawer_hidden_in_named_view_count, hiddenOnlyHere, hiddenOnlyHere, viewName)
} else {
stringResource(R.string.drawer_hidden_in_view_none)
stringResource(R.string.drawer_hidden_in_named_view_none, viewName)
},
position = Position.Alone,
minHeight = 56.dp,
@@ -12,6 +12,7 @@ import de.jeanlucmakiola.calendula.ui.common.CalendarColorChip
import de.jeanlucmakiola.calendula.ui.common.CalendarView
import de.jeanlucmakiola.calendula.ui.common.accountGroupTitle
import de.jeanlucmakiola.calendula.ui.common.calendarsHiddenIn
import de.jeanlucmakiola.calendula.ui.common.label
import de.jeanlucmakiola.calendula.ui.common.orUnnamed
import de.jeanlucmakiola.floret.components.FullScreenPicker
import de.jeanlucmakiola.floret.components.GroupedHint
@@ -30,8 +31,9 @@ fun ViewCalendarsPicker(
onSetHidden: (calendarId: Long, hidden: Boolean) -> Unit,
onDismiss: () -> Unit,
) {
val viewName = view.label()
FullScreenPicker(
title = stringResource(R.string.view_calendars_title),
title = stringResource(R.string.view_hide_in_title, viewName),
onDismiss = onDismiss,
predictiveBack = true,
) {
@@ -42,7 +44,7 @@ fun ViewCalendarsPicker(
// Seeded once, then ahead of the store: the picker is the only
// writer while open, so a quick second tap still flips.
var hidden by remember(view) { mutableStateOf(state.hiddenViews.calendarsHiddenIn(view)) }
GroupedHint(stringResource(R.string.view_calendars_hint), verticalPadding = 8.dp)
GroupedHint(stringResource(R.string.view_calendars_named_hint, viewName), verticalPadding = 8.dp)
state.groups.forEach { group ->
GroupedSectionHeader(accountGroupTitle(group))
MultiOptionRows(
+12 -7
View File
@@ -967,14 +967,19 @@
<string name="calendars_hide_in_views_hint">Events from “%1$s” stay out of the views checked here. Reminders, search and widgets still include them.</string>
<string name="calendars_hide_in_views_none">Shown in every view</string>
<string name="calendars_hidden_in">Hidden in %1$s</string>
<string name="filter_hidden_in_view">Hidden in this view</string>
<string name="view_calendars_title">Hide in this view</string>
<plurals name="drawer_hidden_in_view_count">
<item quantity="one">%d calendar hidden in this view</item>
<item quantity="other">%d calendars hidden in this view</item>
<!-- %1$s: the quoted view name, as in view_hide_in_title. -->
<string name="filter_hidden_in_named_view">Hidden in “%1$s” view</string>
<!-- %1$s is the view's name as the view switcher shows it, e.g. "Month" or "3 days". It is a quoted label: phrase around it instead of inflecting it. -->
<string name="view_hide_in_title">Hide in “%1$s” view</string>
<!-- %2$s: the quoted view name, as in view_hide_in_title. -->
<plurals name="drawer_hidden_in_named_view_count">
<item quantity="one">%1$d calendar hidden in “%2$s” view</item>
<item quantity="other">%1$d calendars hidden in “%2$s” view</item>
</plurals>
<string name="drawer_hidden_in_view_none">Leave calendars out of this view only</string>
<string name="view_calendars_hint">Checked calendars stay out of this view only. Reminders, search and widgets still include them.</string>
<!-- %1$s: the quoted view name, as in view_hide_in_title. -->
<string name="drawer_hidden_in_named_view_none">Leave calendars out of the “%1$s” view only</string>
<!-- %1$s: the quoted view name, as in view_hide_in_title. -->
<string name="view_calendars_named_hint">Checked calendars stay out of the “%1$s” view only. Reminders, search and widgets still include them.</string>
<string name="view_calendars_hidden_everywhere">Hidden in every view from the menu</string>
<string name="color_name_mauve">Mauve</string>
<string name="color_name_red">Red</string>
+2 -2
View File
@@ -420,8 +420,8 @@ separate in-app declutter that never touches reminders. Narrower still is the pe
(`SettingsPrefs.perCalendarHiddenViews`, #270): each view model asks for its
events through `instancesWithout(range, calendarsHiddenIn(view, …))`, which drops
the calendars hidden in that one view on top of the repository's filters; reminders, search and widgets read
the repository and never see it. The drawer's "Hide in this view" entry (#517) edits the same
set for the view on show, and the drawer's per-row "Hidden in this view" notes read it.
the repository and never see it. The drawer's "Hide in “<view>” view" entry (#517, #143) edits the same
set for the view on show, and the drawer's per-row "Hidden in “<view>” view" notes read it.
**A channel per calendar (#145).** `ReminderChannels` keeps one notification
channel per calendar, grouped by account (one that syncs no events only gets