diff --git a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteCard.kt b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteCard.kt index 8ce84e1..d9319bf 100644 --- a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteCard.kt +++ b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteCard.kt @@ -57,6 +57,28 @@ fun NoteCard( val haptics = LocalHapticFeedback.current var menuOpen by remember { mutableStateOf(false) } + // NAMED rather than written inline in the chain below, and not for taste: ktlint's + // chain-method-continuation wants the next `.` glued to the closing paren of a + // multiline element — `).background(…)` — which is worse to read than a modifier + // with a name. Every other multiline element in this codebase happens to be last + // in its chain, so this is the first place the rule bites. + val opening = + Modifier.combinedClickable( + onClickLabel = stringResource(R.string.board_open_note), + onLongClickLabel = stringResource(R.string.board_note_actions), + onLongClick = { + // Fired HERE rather than when the menu appears. A long press is + // confirmed by the system before the popup has laid out, and the whole + // point of the buzz is to say "that registered" at the moment your + // finger has been still long enough — a menu that arrives with no tick + // under it reads as a phone that missed the gesture and then changed + // its mind. + haptics.performHapticFeedback(HapticFeedbackType.LongPress) + menuOpen = true + }, + onClick = onOpen, + ) + // The Box exists only to anchor the menu. A DropdownMenu is a popup and takes no // space, so the card's size is still the Column's. Box { @@ -68,24 +90,11 @@ fun NoteCard( // separate a white card from a #fafafa board, and the web's own // `shadow-sm` is the value it is matching. .shadow(CARD_ELEVATION, RoundedCornerShape(CARD_RADIUS)) - // Clipped BEFORE clickable, so the ripple is bounded by the card's - // rounded corners instead of a rectangle overhanging them. + // Clipped BEFORE the click modifier, so the ripple is bounded by the + // card's rounded corners instead of a rectangle overhanging them — + // and BEFORE padding, so the padded edge is still a tap target. .clip(RoundedCornerShape(CARD_RADIUS)) - .combinedClickable( - onClickLabel = stringResource(R.string.board_open_note), - onLongClickLabel = stringResource(R.string.board_note_actions), - onLongClick = { - // Fired HERE rather than when the menu appears. A long press - // is confirmed by the system before the popup has laid out, - // and the whole point of the buzz is to say "that registered" - // at the moment your finger has been still long enough — a - // menu that arrives with no tick under it reads as a phone - // that missed the gesture and then changed its mind. - haptics.performHapticFeedback(HapticFeedbackType.LongPress) - menuOpen = true - }, - onClick = onOpen, - ) + .then(opening) .background(noteCardColor(note, dark)) // ONE grey edge on every card, regardless of its colour — the tint is // deliberately not consulted here. See CARD_EDGE_DARK. diff --git a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteEditorScreen.kt b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteEditorScreen.kt index edfe0b6..2d90551 100644 --- a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteEditorScreen.kt +++ b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/NoteEditorScreen.kt @@ -16,7 +16,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -25,9 +24,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import com.fabledsword.thoughtsync.R import com.fabledsword.thoughtsync.core.Label import com.fabledsword.thoughtsync.core.Note import kotlinx.coroutines.delay