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 3bc1fe4..527d85c 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(