From f60f9b407919b7d465fa825cdefdd332ccbee80d Mon Sep 17 00:00:00 2001 From: anas Date: Wed, 7 Oct 2026 18:25:13 +0200 Subject: [PATCH] One side panel at a time, and a narrower one for the dictionary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes to the left of the reader. The dictionary and the reading settings both want that side of the screen, and opening the second put two panels there at once — or, where there was no longer room for two, left the dictionary as a sheet in the middle of the page while the settings sat beside it. Either way the reader is asked to look in two places. The settings now replace the dictionary; closing them leaves the poem, which is where the reader was. The dictionary also no longer takes the settings' full 360dp. It is read against the line it came from, so the verse should keep the width: 216dp, a little over half. The settings keep 360dp, which costs nothing — they fold the columns away and take the room that frees. Co-Authored-By: Claude Opus 5 (1M context) --- .../main/java/com/ganjoor/android/ui/PoemScreen.kt | 8 ++++++++ app/src/main/java/com/ganjoor/android/ui/WordSheet.kt | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/ganjoor/android/ui/PoemScreen.kt b/app/src/main/java/com/ganjoor/android/ui/PoemScreen.kt index 82a1ba2..b097389 100644 --- a/app/src/main/java/com/ganjoor/android/ui/PoemScreen.kt +++ b/app/src/main/java/com/ganjoor/android/ui/PoemScreen.kt @@ -97,6 +97,14 @@ fun PoemScreen( // finds, so the couplet's own actions live at its foot rather than behind a tap between words. var tapped by remember { mutableStateOf(null) } + // One side panel at a time. The dictionary and the reading settings both want the left of the + // screen, and opening the second put two panels there at once — or, where there was no longer + // room for two, left the dictionary as a sheet in the middle of the page while the settings + // sat beside it. Either way the reader is asked to look in two places. The settings replace + // the dictionary instead; closing them leaves the poem, which is where the reader was. + val sidePanelOpen = LocalSidePanelOpen.current + LaunchedEffect(sidePanelOpen) { if (sidePanelOpen) tapped = null } + Load( key = fullUrl, block = { Ganjoor.poem(fullUrl) }, diff --git a/app/src/main/java/com/ganjoor/android/ui/WordSheet.kt b/app/src/main/java/com/ganjoor/android/ui/WordSheet.kt index db88f04..692140e 100644 --- a/app/src/main/java/com/ganjoor/android/ui/WordSheet.kt +++ b/app/src/main/java/com/ganjoor/android/ui/WordSheet.kt @@ -48,6 +48,15 @@ import com.ganjoor.android.data.LocalAssistant import com.ganjoor.android.data.Pronunciation import com.ganjoor.android.ui.theme.readingStyle +/** + * How wide the dictionary sits beside the poem. + * + * Narrower than the reading settings, deliberately: the settings fold the columns away and take + * the room that frees, while the dictionary is read *against* the line it came from, so the verse + * keeps the width instead. A definition is short; a hemistich is not. + */ +val DictionaryPanelWidth = 216.dp + /** English prose inside an otherwise right-to-left sheet. */ @Composable private fun LeftToRight(content: @Composable () -> Unit) { @@ -102,7 +111,7 @@ fun WordPanel(word: String, onDismiss: () -> Unit, passage: Bookmark? = null) { BackHandler(onBack = onDismiss) Surface( color = MaterialTheme.colorScheme.surfaceContainerLow, - modifier = Modifier.width(360.dp).fillMaxHeight(), + modifier = Modifier.width(DictionaryPanelWidth).fillMaxHeight(), ) { Column(Modifier.statusBarsPadding()) { Row(