diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt index 32e60e8..253b02e 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt @@ -175,9 +175,18 @@ private fun ManyContent( onSelect: (Long) -> Unit, onManageCalendars: (() -> Unit)? = null, ) { - // No writable calendar to import into — tell the user honestly. + // No calendar to import into — tell the user honestly, and carry the same + // way out the picker's footer offers below. This is the state that footer + // exists for: every writable calendar being switched off, read-only or + // contact-filled is exactly what empties this list (#76). if (state.calendars.isEmpty()) { - CenteredMessage(stringResource(R.string.import_no_calendar), onClose = null) + CenteredMessage( + message = stringResource(R.string.import_no_calendar), + onClose = null, + actionLabel = stringResource(R.string.settings_manage_calendars) + .takeIf { onManageCalendars != null }, + onAction = onManageCalendars, + ) return } @@ -345,7 +354,12 @@ private fun WarningText(warning: IcsParseWarning) { } @Composable -private fun CenteredMessage(message: String, onClose: (() -> Unit)?) { +private fun CenteredMessage( + message: String, + onClose: (() -> Unit)?, + actionLabel: String? = null, + onAction: (() -> Unit)? = null, +) { Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Column( Modifier.padding(24.dp), @@ -356,6 +370,9 @@ private fun CenteredMessage(message: String, onClose: (() -> Unit)?) { if (onClose != null) { Button(onClick = onClose) { Text(stringResource(R.string.import_close)) } } + if (actionLabel != null && onAction != null) { + Button(onClick = onAction) { Text(actionLabel) } + } } } }