Show LibraryScreen toolbar early to match other main screens (#8285)

This commit is contained in:
AntsyLich 2022-10-25 19:40:45 +06:00 committed by GitHub
parent 82b552ac9a
commit a834ff3a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.library package eu.kanade.presentation.library
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.HelpOutline import androidx.compose.material.icons.filled.HelpOutline
@ -38,10 +37,7 @@ fun LibraryScreen(
onClickFilter: () -> Unit, onClickFilter: () -> Unit,
onClickRefresh: (Category?) -> Boolean, onClickRefresh: (Category?) -> Boolean,
) { ) {
Crossfade(targetState = presenter.isLoading) { state -> Scaffold(
when (state) {
true -> LoadingScreen()
false -> Scaffold(
topBar = { scrollBehavior -> topBar = { scrollBehavior ->
val title by presenter.getToolbarTitle() val title by presenter.getToolbarTitle()
val tabVisible = presenter.tabVisibility && presenter.categories.size > 1 val tabVisible = presenter.tabVisibility && presenter.categories.size > 1
@ -69,6 +65,11 @@ fun LibraryScreen(
) )
}, },
) { paddingValues -> ) { paddingValues ->
if (presenter.isLoading) {
LoadingScreen()
return@Scaffold
}
val contentPadding = TachiyomiBottomNavigationView.withBottomNavPadding(paddingValues) val contentPadding = TachiyomiBottomNavigationView.withBottomNavPadding(paddingValues)
if (presenter.searchQuery.isNullOrEmpty() && presenter.isLibraryEmpty) { if (presenter.searchQuery.isNullOrEmpty() && presenter.isLibraryEmpty) {
val handler = LocalUriHandler.current val handler = LocalUriHandler.current
@ -111,6 +112,4 @@ fun LibraryScreen(
isDownloadOnly = presenter.isDownloadOnly, isDownloadOnly = presenter.isDownloadOnly,
) )
} }
}
}
} }