|
|
@@ -210,60 +210,6 @@ fun BookshelfScreen(
|
|
|
}
|
|
|
)
|
|
|
|
|
|
- if (uiState.groups.isEmpty()) {
|
|
|
- val scrollBehavior = GlassTopAppBarDefaults.defaultScrollBehavior()
|
|
|
- val onSearchClick = {
|
|
|
- if (BookshelfConfig.bookshelfSearchActionDirectToSearchState.value) {
|
|
|
- onNavigateToSearch(uiState.searchKey.trim())
|
|
|
- } else {
|
|
|
- viewModel.setSearchMode(!uiState.isSearch)
|
|
|
- }
|
|
|
- }
|
|
|
- AppScaffold(
|
|
|
- modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
|
|
|
- contentWindowInsets = WindowInsets(0),
|
|
|
- snackbarHost = {
|
|
|
- SnackbarHost(
|
|
|
- hostState = snackbarHostState,
|
|
|
- modifier = Modifier
|
|
|
- .padding(
|
|
|
-
|
|
|
- bottom = 72.dp + WindowInsets.navigationBars
|
|
|
- .asPaddingValues()
|
|
|
- .calculateBottomPadding()
|
|
|
- )
|
|
|
- )
|
|
|
- },
|
|
|
- topBar = {
|
|
|
- BookshelfTopBar(
|
|
|
- uiState = uiState,
|
|
|
- scrollBehavior = scrollBehavior,
|
|
|
- onSearchClick = onSearchClick,
|
|
|
- onSearchQueryChange = { viewModel.setSearchKey(it) },
|
|
|
- onSearchSubmit = { rawQuery ->
|
|
|
- rawQuery.trim()
|
|
|
- .takeIf { it.isNotEmpty() }
|
|
|
- ?.let(onNavigateToSearch)
|
|
|
- },
|
|
|
- onClearSearch = { viewModel.setSearchKey("") }
|
|
|
- )
|
|
|
- }
|
|
|
- ) { paddingValues ->
|
|
|
- if (!uiState.isInitialLoading) {
|
|
|
- EmptyMessage(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxSize()
|
|
|
- .padding(
|
|
|
- top = paddingValues.calculateTopPadding(),
|
|
|
- bottom = 120.dp
|
|
|
- ),
|
|
|
- messageResId = R.string.bookshelf_empty
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
val activeOverlay = uiState.activeOverlay
|
|
|
val showGroupMenu = activeOverlay == BookshelfOverlay.GroupMenu
|
|
|
val isEditMode = uiState.isEditMode
|
|
|
@@ -280,7 +226,7 @@ fun BookshelfScreen(
|
|
|
}
|
|
|
|
|
|
val pagerState = rememberPagerState(
|
|
|
- initialPage = uiState.selectedGroupIndex,
|
|
|
+ initialPage = uiState.selectedGroupIndex.coerceAtLeast(0),
|
|
|
pageCount = { uiState.groups.size }
|
|
|
)
|
|
|
val latestGroups by rememberUpdatedState(uiState.groups)
|
|
|
@@ -765,7 +711,19 @@ fun BookshelfScreen(
|
|
|
}
|
|
|
}
|
|
|
) { isRoot ->
|
|
|
- if (bookGroupStyle == 2 && isRoot && !isUsingStandaloneSearchGroup) {
|
|
|
+ if (uiState.groups.isEmpty() && !uiState.isSearch) {
|
|
|
+ if (!uiState.isInitialLoading) {
|
|
|
+ EmptyMessage(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize()
|
|
|
+ .padding(
|
|
|
+ top = paddingValues.calculateTopPadding(),
|
|
|
+ bottom = 120.dp
|
|
|
+ ),
|
|
|
+ messageResId = R.string.bookshelf_empty
|
|
|
+ )
|
|
|
+ }
|
|
|
+ } else if (bookGroupStyle == 2 && isRoot && !isUsingStandaloneSearchGroup) {
|
|
|
val folderColumns =
|
|
|
if (bookshelfFolderLayoutMode == 0) bookshelfFolderLayoutList else bookshelfFolderLayoutGrid
|
|
|
val isGridMode = bookshelfFolderLayoutMode != 0
|