Wrap long event titles in the edit screen (#33)
The edit-screen title field was single-line, so long titles scrolled off one line instead of wrapping. Make it multi-line so it wraps and grows vertically, matching the detail screen and Google Calendar. A title is still one logical line: strip any newline the IME's Enter key or a paste would introduce in setTitle, so no line break reaches the provider's TITLE column. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -520,13 +520,17 @@ private fun EventEditContent(
|
|||||||
.padding(start = 24.dp, end = 24.dp, top = 8.dp, bottom = 40.dp),
|
.padding(start = 24.dp, end = 24.dp, top = 8.dp, bottom = 40.dp),
|
||||||
) {
|
) {
|
||||||
// Title: borderless headline, mirroring the detail screen's title +
|
// 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(
|
InlineField(
|
||||||
value = form.title,
|
value = form.title,
|
||||||
onValueChange = viewModel::setTitle,
|
onValueChange = viewModel::setTitle,
|
||||||
placeholder = stringResource(R.string.event_edit_title_hint),
|
placeholder = stringResource(R.string.event_edit_title_hint),
|
||||||
textStyle = MaterialTheme.typography.headlineMedium
|
textStyle = MaterialTheme.typography.headlineMedium
|
||||||
.copy(fontWeight = FontWeight.SemiBold),
|
.copy(fontWeight = FontWeight.SemiBold),
|
||||||
|
singleLine = false,
|
||||||
enabled = !locked,
|
enabled = !locked,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|||||||
@@ -336,7 +336,11 @@ class EventEditViewModel @Inject constructor(
|
|||||||
_revealed.value = _revealed.value + field
|
_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 setLocation(value: String) = update { it.copy(location = value) }
|
||||||
fun setDescription(value: String) = update { it.copy(description = value) }
|
fun setDescription(value: String) = update { it.copy(description = value) }
|
||||||
fun setAllDay(value: Boolean) {
|
fun setAllDay(value: Boolean) {
|
||||||
|
|||||||
Reference in New Issue
Block a user