Show empty screen when a category is empty (#8690)

* Show empty screen when a category is empty

* Review changes

* Review changes #2

Co-authored-by: arkon <arkon@users.noreply.github.com>
This commit is contained in:
zbue
2022-12-08 22:15:10 +08:00
committed by GitHub
parent ed5e013874
commit 01c6e46a71
8 changed files with 60 additions and 11 deletions

View File

@@ -58,6 +58,7 @@ import eu.kanade.tachiyomi.util.system.LocaleHelper
fun ExtensionScreen(
state: ExtensionsState,
contentPadding: PaddingValues,
searchQuery: String? = null,
onLongClickItem: (Extension) -> Unit,
onClickItemCancel: (Extension) -> Unit,
onInstallExtension: (Extension.Available) -> Unit,
@@ -75,10 +76,17 @@ fun ExtensionScreen(
) {
when {
state.isLoading -> LoadingScreen(modifier = Modifier.padding(contentPadding))
state.isEmpty -> EmptyScreen(
textResource = R.string.empty_screen,
modifier = Modifier.padding(contentPadding),
)
state.isEmpty -> {
val msg = if (!searchQuery.isNullOrEmpty()) {
R.string.no_results_found
} else {
R.string.empty_screen
}
EmptyScreen(
textResource = msg,
modifier = Modifier.padding(contentPadding),
)
}
else -> {
ExtensionContent(
state = state,