Move app state banner to the very top (#8706)

This moves the banners to the root composable and so eliminates the need to
track the app states in every screen.
This commit is contained in:
Ivan Iskandar
2022-12-09 23:20:13 +07:00
committed by GitHub
parent a61e2799db
commit d97eab0328
24 changed files with 217 additions and 295 deletions

View File

@@ -45,8 +45,6 @@ fun LibraryContent(
getDisplayModeForPage: @Composable (Int) -> LibraryDisplayMode,
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
getLibraryForPage: (Int) -> List<LibraryItem>,
isDownloadOnly: Boolean,
isIncognitoMode: Boolean,
) {
Column(
modifier = Modifier.padding(
@@ -65,8 +63,6 @@ fun LibraryContent(
LibraryTabs(
categories = categories,
currentPageIndex = pagerState.currentPage,
isDownloadOnly = isDownloadOnly,
isIncognitoMode = isIncognitoMode,
getNumberOfMangaForCategory = getNumberOfMangaForCategory,
) { scope.launch { pagerState.animateScrollToPage(it) } }
}

View File

@@ -8,7 +8,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.dp
import eu.kanade.domain.category.model.Category
import eu.kanade.presentation.category.visualName
import eu.kanade.presentation.components.AppStateBanners
import eu.kanade.presentation.components.Divider
import eu.kanade.presentation.components.TabIndicator
import eu.kanade.presentation.components.TabText
@@ -17,8 +16,6 @@ import eu.kanade.presentation.components.TabText
fun LibraryTabs(
categories: List<Category>,
currentPageIndex: Int,
isDownloadOnly: Boolean,
isIncognitoMode: Boolean,
getNumberOfMangaForCategory: (Category) -> Int?,
onTabItemClick: (Int) -> Unit,
) {
@@ -47,7 +44,5 @@ fun LibraryTabs(
}
Divider()
AppStateBanners(isDownloadOnly, isIncognitoMode)
}
}

View File

@@ -32,8 +32,6 @@ fun LibraryToolbar(
hasActiveFilters: Boolean,
selectedCount: Int,
title: LibraryToolbarTitle,
incognitoMode: Boolean,
downloadedOnlyMode: Boolean,
onClickUnselectAll: () -> Unit,
onClickSelectAll: () -> Unit,
onClickInvertSelection: () -> Unit,
@@ -46,8 +44,6 @@ fun LibraryToolbar(
) = when {
selectedCount > 0 -> LibrarySelectionToolbar(
selectedCount = selectedCount,
incognitoMode = incognitoMode,
downloadedOnlyMode = downloadedOnlyMode,
onClickUnselectAll = onClickUnselectAll,
onClickSelectAll = onClickSelectAll,
onClickInvertSelection = onClickInvertSelection,
@@ -55,8 +51,6 @@ fun LibraryToolbar(
else -> LibraryRegularToolbar(
title = title,
hasFilters = hasActiveFilters,
incognitoMode = incognitoMode,
downloadedOnlyMode = downloadedOnlyMode,
searchQuery = searchQuery,
onSearchQueryChange = onSearchQueryChange,
onClickFilter = onClickFilter,
@@ -70,8 +64,6 @@ fun LibraryToolbar(
fun LibraryRegularToolbar(
title: LibraryToolbarTitle,
hasFilters: Boolean,
incognitoMode: Boolean,
downloadedOnlyMode: Boolean,
searchQuery: String?,
onSearchQueryChange: (String?) -> Unit,
onClickFilter: () -> Unit,
@@ -123,8 +115,6 @@ fun LibraryRegularToolbar(
)
}
},
incognitoMode = incognitoMode,
downloadedOnlyMode = downloadedOnlyMode,
scrollBehavior = scrollBehavior,
)
}
@@ -132,8 +122,6 @@ fun LibraryRegularToolbar(
@Composable
fun LibrarySelectionToolbar(
selectedCount: Int,
incognitoMode: Boolean,
downloadedOnlyMode: Boolean,
onClickUnselectAll: () -> Unit,
onClickSelectAll: () -> Unit,
onClickInvertSelection: () -> Unit,
@@ -150,8 +138,6 @@ fun LibrarySelectionToolbar(
},
isActionMode = true,
onCancelActionMode = onClickUnselectAll,
incognitoMode = incognitoMode,
downloadedOnlyMode = downloadedOnlyMode,
)
}