diff --git a/app/src/main/java/com/ganjoor/android/ui/CategoryScreen.kt b/app/src/main/java/com/ganjoor/android/ui/CategoryScreen.kt index 8486df6..6c6b47c 100644 --- a/app/src/main/java/com/ganjoor/android/ui/CategoryScreen.kt +++ b/app/src/main/java/com/ganjoor/android/ui/CategoryScreen.kt @@ -60,7 +60,7 @@ fun CategoryScreen( key = fullUrl, block = { Ganjoor.category(fullUrl) }, // The bar stays up with Back already working; only the list waits. - placeholder = { LoadingCategory(onUp) }, + placeholder = { LoadingCategory(onUp, onHome) }, ) { cat -> // First lines are a separate, optional call; the list shows up without waiting for it. var excerpts by remember(cat.id) { mutableStateOf(emptyMap()) } @@ -132,7 +132,7 @@ fun CategoryScreen( /** The category screen while its list is on the way: the real top bar over a skeleton list. */ @OptIn(ExperimentalMaterial3Api::class) @Composable -private fun LoadingCategory(onUp: () -> Unit) { +private fun LoadingCategory(onUp: () -> Unit, onHome: () -> Unit) { Scaffold( topBar = { TopAppBar( @@ -142,6 +142,12 @@ private fun LoadingCategory(onUp: () -> Unit) { Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.back)) } }, + // Home and the reading settings belong to the app, not to this page, so they are + // there from the first frame. Downloading needs to know which poet this is. + actions = { + HomeAction(onHome) + ReadingSettingsAction() + }, ) } ) { insets -> 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 9fddf57..11a3d47 100644 --- a/app/src/main/java/com/ganjoor/android/ui/PoemScreen.kt +++ b/app/src/main/java/com/ganjoor/android/ui/PoemScreen.kt @@ -96,8 +96,9 @@ fun PoemScreen( Load( key = fullUrl, block = { Ganjoor.poem(fullUrl) }, - // The bar stays up with Back already working; only the text waits. - placeholder = { LoadingPoem(wide, onUp, navigationToggle) }, + // The bar stays up with Back, Home and the reading settings already working; only + // the text waits. Sharing and bookmarking need a poem, so they arrive with it. + placeholder = { LoadingPoem(wide, onUp, onHome, navigationToggle) }, ) { poem -> val prefs = LocalSettings.current.value val style = readingStyle(prefs.font, prefs.fontSize, prefs.fontWeight.weight) @@ -256,7 +257,12 @@ private data class WordTap(val word: String, val passage: Bookmark, val verse: I /** The poem screen while its poem is on the way: the real top bar, and the text as a skeleton. */ @OptIn(ExperimentalMaterial3Api::class) @Composable -private fun LoadingPoem(wide: Boolean, onUp: () -> Unit, navigationToggle: (@Composable () -> Unit)?) { +private fun LoadingPoem( + wide: Boolean, + onUp: () -> Unit, + onHome: () -> Unit, + navigationToggle: (@Composable () -> Unit)?, +) { Scaffold( topBar = { TopAppBar( @@ -269,6 +275,12 @@ private fun LoadingPoem(wide: Boolean, onUp: () -> Unit, navigationToggle: (@Com } } }, + // Going home and changing the reading settings do not depend on this poem, so + // they do not wait for it. Share and bookmark do, and appear when it lands. + actions = { + HomeAction(onHome) + ReadingSettingsAction() + }, ) } ) { insets ->