Fix emoji going crazy and fix tabs being visible when library is empty (#7811)

fixes #7792
fixes #7791

(cherry picked from commit 47b56644dee9a097cfce384ca030ddb75ddadfe5)
This commit is contained in:
Andreas 2022-08-19 13:22:46 +02:00 committed by Jobobby04
parent 114ed8836b
commit ec210de6c5
4 changed files with 8 additions and 7 deletions

View File

@ -38,12 +38,11 @@ fun EmptyScreen(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
)
show(message, actions)
}
},
modifier = Modifier
.align(Alignment.Center),
) { view ->
view.show(message, actions)
}
)
}
}

View File

@ -93,7 +93,7 @@ fun LibraryScreen(
state = presenter,
contentPadding = paddingValues,
currentPage = { presenter.activeCategory },
isLibraryEmpty = { presenter.loadedManga.isEmpty() },
isLibraryEmpty = presenter.isLibraryEmpty,
showPageTabs = presenter.tabVisibility,
showMangaCount = presenter.mangaCountVisibility,
onChangeCurrentPage = { presenter.activeCategory = it },

View File

@ -37,7 +37,7 @@ fun LibraryContent(
state: LibraryState,
contentPadding: PaddingValues,
currentPage: () -> Int,
isLibraryEmpty: () -> Boolean,
isLibraryEmpty: Boolean,
isDownloadOnly: Boolean,
isIncognitoMode: Boolean,
showPageTabs: Boolean,
@ -66,7 +66,7 @@ fun LibraryContent(
val scope = rememberCoroutineScope()
var isRefreshing by remember(pagerState.currentPage) { mutableStateOf(false) }
if (showPageTabs && categories.size > 1) {
if (isLibraryEmpty.not() && showPageTabs && categories.size > 1) {
LibraryTabs(
state = pagerState,
categories = categories,
@ -115,7 +115,7 @@ fun LibraryContent(
)
},
) {
if (state.searchQuery.isNullOrEmpty() && isLibraryEmpty()) {
if (state.searchQuery.isNullOrEmpty() && isLibraryEmpty) {
val handler = LocalUriHandler.current
EmptyScreen(
R.string.information_empty_library,

View File

@ -144,6 +144,8 @@ class LibraryPresenter(
var loadedManga by mutableStateOf(emptyMap<Long, List<LibraryItem>>())
private set
val isLibraryEmpty by derivedStateOf { loadedManga.isEmpty() }
val tabVisibility by preferences.categoryTabs().asState()
val mangaCountVisibility by preferences.categoryNumberOfItems().asState()