One side panel at a time, and a narrower one for the dictionary

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) <noreply@anthropic.com>
This commit is contained in:
anas 2026-10-07 18:25:13 +02:00
parent c3b22fdf0e
commit f60f9b4079
2 changed files with 18 additions and 1 deletions

View File

@ -97,6 +97,14 @@ fun PoemScreen(
// finds, so the couplet's own actions live at its foot rather than behind a tap between words. // finds, so the couplet's own actions live at its foot rather than behind a tap between words.
var tapped by remember { mutableStateOf<WordTap?>(null) } var tapped by remember { mutableStateOf<WordTap?>(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( Load(
key = fullUrl, key = fullUrl,
block = { Ganjoor.poem(fullUrl) }, block = { Ganjoor.poem(fullUrl) },

View File

@ -48,6 +48,15 @@ import com.ganjoor.android.data.LocalAssistant
import com.ganjoor.android.data.Pronunciation import com.ganjoor.android.data.Pronunciation
import com.ganjoor.android.ui.theme.readingStyle 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. */ /** English prose inside an otherwise right-to-left sheet. */
@Composable @Composable
private fun LeftToRight(content: @Composable () -> Unit) { private fun LeftToRight(content: @Composable () -> Unit) {
@ -102,7 +111,7 @@ fun WordPanel(word: String, onDismiss: () -> Unit, passage: Bookmark? = null) {
BackHandler(onBack = onDismiss) BackHandler(onBack = onDismiss)
Surface( Surface(
color = MaterialTheme.colorScheme.surfaceContainerLow, color = MaterialTheme.colorScheme.surfaceContainerLow,
modifier = Modifier.width(360.dp).fillMaxHeight(), modifier = Modifier.width(DictionaryPanelWidth).fillMaxHeight(),
) { ) {
Column(Modifier.statusBarsPadding()) { Column(Modifier.statusBarsPadding()) {
Row( Row(