Show LibraryScreen toolbar early to match other main screens (#8285)
This commit is contained in:
parent
82b552ac9a
commit
a834ff3a44
@ -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,79 +37,79 @@ fun LibraryScreen(
|
|||||||
onClickFilter: () -> Unit,
|
onClickFilter: () -> Unit,
|
||||||
onClickRefresh: (Category?) -> Boolean,
|
onClickRefresh: (Category?) -> Boolean,
|
||||||
) {
|
) {
|
||||||
Crossfade(targetState = presenter.isLoading) { state ->
|
Scaffold(
|
||||||
when (state) {
|
topBar = { scrollBehavior ->
|
||||||
true -> LoadingScreen()
|
val title by presenter.getToolbarTitle()
|
||||||
false -> Scaffold(
|
val tabVisible = presenter.tabVisibility && presenter.categories.size > 1
|
||||||
topBar = { scrollBehavior ->
|
LibraryToolbar(
|
||||||
val title by presenter.getToolbarTitle()
|
state = presenter,
|
||||||
val tabVisible = presenter.tabVisibility && presenter.categories.size > 1
|
title = title,
|
||||||
LibraryToolbar(
|
incognitoMode = !tabVisible && presenter.isIncognitoMode,
|
||||||
state = presenter,
|
downloadedOnlyMode = !tabVisible && presenter.isDownloadOnly,
|
||||||
title = title,
|
onClickUnselectAll = onClickUnselectAll,
|
||||||
incognitoMode = !tabVisible && presenter.isIncognitoMode,
|
onClickSelectAll = onClickSelectAll,
|
||||||
downloadedOnlyMode = !tabVisible && presenter.isDownloadOnly,
|
onClickInvertSelection = onClickInvertSelection,
|
||||||
onClickUnselectAll = onClickUnselectAll,
|
onClickFilter = onClickFilter,
|
||||||
onClickSelectAll = onClickSelectAll,
|
onClickRefresh = { onClickRefresh(null) },
|
||||||
onClickInvertSelection = onClickInvertSelection,
|
scrollBehavior = scrollBehavior.takeIf { !tabVisible }, // For scroll overlay when no tab
|
||||||
onClickFilter = onClickFilter,
|
)
|
||||||
onClickRefresh = { onClickRefresh(null) },
|
},
|
||||||
scrollBehavior = scrollBehavior.takeIf { !tabVisible }, // For scroll overlay when no tab
|
bottomBar = {
|
||||||
)
|
LibraryBottomActionMenu(
|
||||||
},
|
visible = presenter.selectionMode,
|
||||||
bottomBar = {
|
onChangeCategoryClicked = onChangeCategoryClicked,
|
||||||
LibraryBottomActionMenu(
|
onMarkAsReadClicked = onMarkAsReadClicked,
|
||||||
visible = presenter.selectionMode,
|
onMarkAsUnreadClicked = onMarkAsUnreadClicked,
|
||||||
onChangeCategoryClicked = onChangeCategoryClicked,
|
onDownloadClicked = onDownloadClicked.takeIf { presenter.selection.none { it.manga.isLocal() } },
|
||||||
onMarkAsReadClicked = onMarkAsReadClicked,
|
onDeleteClicked = onDeleteClicked,
|
||||||
onMarkAsUnreadClicked = onMarkAsUnreadClicked,
|
)
|
||||||
onDownloadClicked = onDownloadClicked.takeIf { presenter.selection.none { it.manga.isLocal() } },
|
},
|
||||||
onDeleteClicked = onDeleteClicked,
|
) { paddingValues ->
|
||||||
)
|
if (presenter.isLoading) {
|
||||||
},
|
LoadingScreen()
|
||||||
) { paddingValues ->
|
return@Scaffold
|
||||||
val contentPadding = TachiyomiBottomNavigationView.withBottomNavPadding(paddingValues)
|
|
||||||
if (presenter.searchQuery.isNullOrEmpty() && presenter.isLibraryEmpty) {
|
|
||||||
val handler = LocalUriHandler.current
|
|
||||||
EmptyScreen(
|
|
||||||
textResource = R.string.information_empty_library,
|
|
||||||
modifier = Modifier.padding(contentPadding),
|
|
||||||
actions = listOf(
|
|
||||||
EmptyScreenAction(
|
|
||||||
stringResId = R.string.getting_started_guide,
|
|
||||||
icon = Icons.Default.HelpOutline,
|
|
||||||
onClick = { handler.openUri("https://tachiyomi.org/help/guides/getting-started") },
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
return@Scaffold
|
|
||||||
}
|
|
||||||
|
|
||||||
LibraryContent(
|
|
||||||
state = presenter,
|
|
||||||
contentPadding = contentPadding,
|
|
||||||
currentPage = { presenter.activeCategory },
|
|
||||||
isLibraryEmpty = presenter.isLibraryEmpty,
|
|
||||||
showPageTabs = presenter.tabVisibility,
|
|
||||||
showMangaCount = presenter.mangaCountVisibility,
|
|
||||||
onChangeCurrentPage = { presenter.activeCategory = it },
|
|
||||||
onMangaClicked = onMangaClicked,
|
|
||||||
onToggleSelection = { presenter.toggleSelection(it) },
|
|
||||||
onToggleRangeSelection = { presenter.toggleRangeSelection(it) },
|
|
||||||
onRefresh = onClickRefresh,
|
|
||||||
onGlobalSearchClicked = onGlobalSearchClicked,
|
|
||||||
getNumberOfMangaForCategory = { presenter.getMangaCountForCategory(it) },
|
|
||||||
getDisplayModeForPage = { presenter.categories[it].display },
|
|
||||||
getColumnsForOrientation = { presenter.getColumnsPreferenceForCurrentOrientation(it) },
|
|
||||||
getLibraryForPage = { presenter.getMangaForCategory(page = it) },
|
|
||||||
showDownloadBadges = presenter.showDownloadBadges,
|
|
||||||
showUnreadBadges = presenter.showUnreadBadges,
|
|
||||||
showLocalBadges = presenter.showLocalBadges,
|
|
||||||
showLanguageBadges = presenter.showLanguageBadges,
|
|
||||||
isIncognitoMode = presenter.isIncognitoMode,
|
|
||||||
isDownloadOnly = presenter.isDownloadOnly,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val contentPadding = TachiyomiBottomNavigationView.withBottomNavPadding(paddingValues)
|
||||||
|
if (presenter.searchQuery.isNullOrEmpty() && presenter.isLibraryEmpty) {
|
||||||
|
val handler = LocalUriHandler.current
|
||||||
|
EmptyScreen(
|
||||||
|
textResource = R.string.information_empty_library,
|
||||||
|
modifier = Modifier.padding(contentPadding),
|
||||||
|
actions = listOf(
|
||||||
|
EmptyScreenAction(
|
||||||
|
stringResId = R.string.getting_started_guide,
|
||||||
|
icon = Icons.Default.HelpOutline,
|
||||||
|
onClick = { handler.openUri("https://tachiyomi.org/help/guides/getting-started") },
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return@Scaffold
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryContent(
|
||||||
|
state = presenter,
|
||||||
|
contentPadding = contentPadding,
|
||||||
|
currentPage = { presenter.activeCategory },
|
||||||
|
isLibraryEmpty = presenter.isLibraryEmpty,
|
||||||
|
showPageTabs = presenter.tabVisibility,
|
||||||
|
showMangaCount = presenter.mangaCountVisibility,
|
||||||
|
onChangeCurrentPage = { presenter.activeCategory = it },
|
||||||
|
onMangaClicked = onMangaClicked,
|
||||||
|
onToggleSelection = { presenter.toggleSelection(it) },
|
||||||
|
onToggleRangeSelection = { presenter.toggleRangeSelection(it) },
|
||||||
|
onRefresh = onClickRefresh,
|
||||||
|
onGlobalSearchClicked = onGlobalSearchClicked,
|
||||||
|
getNumberOfMangaForCategory = { presenter.getMangaCountForCategory(it) },
|
||||||
|
getDisplayModeForPage = { presenter.categories[it].display },
|
||||||
|
getColumnsForOrientation = { presenter.getColumnsPreferenceForCurrentOrientation(it) },
|
||||||
|
getLibraryForPage = { presenter.getMangaForCategory(page = it) },
|
||||||
|
showDownloadBadges = presenter.showDownloadBadges,
|
||||||
|
showUnreadBadges = presenter.showUnreadBadges,
|
||||||
|
showLocalBadges = presenter.showLocalBadges,
|
||||||
|
showLanguageBadges = presenter.showLanguageBadges,
|
||||||
|
isIncognitoMode = presenter.isIncognitoMode,
|
||||||
|
isDownloadOnly = presenter.isDownloadOnly,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user