Wrap long event titles in the edit screen (#33) #65
@@ -519,13 +519,17 @@ private fun EventEditContent(
|
||||
.padding(start = 24.dp, end = 24.dp, top = 8.dp, bottom = 40.dp),
|
||||
) {
|
||||
// Title: borderless headline, mirroring the detail screen's title +
|
||||
// accent bar instead of a boxed Material text field.
|
||||
// accent bar instead of a boxed Material text field. Multi-line so long
|
||||
// titles wrap instead of scrolling off one line (#33); newlines are
|
||||
// stripped in setTitle, so this stays a single logical line — the Enter
|
||||
// key just has no effect.
|
||||
InlineField(
|
||||
value = form.title,
|
||||
onValueChange = viewModel::setTitle,
|
||||
placeholder = stringResource(R.string.event_edit_title_hint),
|
||||
textStyle = MaterialTheme.typography.headlineMedium
|
||||
.copy(fontWeight = FontWeight.SemiBold),
|
||||
singleLine = false,
|
||||
enabled = !locked,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
||||
@@ -336,7 +336,11 @@ class EventEditViewModel @Inject constructor(
|
||||
_revealed.value = _revealed.value + field
|
||||
}
|
||||
|
||||
fun setTitle(value: String) = update { it.copy(title = value) }
|
||||
// The title field wraps (multi-line) so long titles stay visible (#33), but
|
||||
// a title is one logical line: drop any newline the IME's Enter key or a
|
||||
// paste would introduce, so it never reaches the provider's TITLE column.
|
||||
fun setTitle(value: String) =
|
||||
update { it.copy(title = value.replace("\n", "").replace("\r", "")) }
|
||||
fun setLocation(value: String) = update { it.copy(location = value) }
|
||||
fun setDescription(value: String) = update { it.copy(description = value) }
|
||||
fun setAllDay(value: Boolean) {
|
||||
|
||||
Reference in New Issue
Block a user