From 2c032ff70d607f0e0197091e53763491775a0ab3 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 17 Nov 2023 09:46:13 -0500 Subject: [PATCH] Address more Compose lint warnings --- .../presentation/browse/BrowseSourceScreen.kt | 2 +- .../browse/ExtensionDetailsScreen.kt | 71 ++++++++-------- .../presentation/browse/ExtensionsScreen.kt | 2 +- .../presentation/browse/GlobalSearchScreen.kt | 2 +- .../presentation/browse/MigrateMangaScreen.kt | 2 +- .../browse/MigrateSourceScreen.kt | 2 +- .../browse/SourcesFilterScreen.kt | 4 +- .../browse/components/BaseSourceItem.kt | 2 +- .../browse/components/BrowseSourceToolbar.kt | 63 ++++++++------ .../presentation/category/CategoryScreen.kt | 3 +- .../category/components/CategoryListItem.kt | 2 +- .../presentation/components/AdaptiveSheet.kt | 2 +- .../kanade/presentation/components/AppBar.kt | 3 +- .../components/RelativeDateHeader.kt | 2 +- .../presentation/components/TabbedDialog.kt | 5 +- .../presentation/components/TabbedScreen.kt | 6 +- .../presentation/history/HistoryScreen.kt | 3 +- .../history/HistoryUiModelProviders.kt | 13 --- .../history/components/HistoryItem.kt | 2 +- .../library/LibrarySettingsDialog.kt | 3 +- .../library/components/LibraryToolbar.kt | 5 +- .../manga/ChapterSettingsDialog.kt | 3 +- .../manga/components/MangaCoverDialog.kt | 29 +++---- .../manga/components/MangaToolbar.kt | 85 ++++++++++--------- .../settings/screen/SettingsMainScreen.kt | 3 +- .../about/OpenSourceLibraryLicenseScreen.kt | 3 +- .../screen/advanced/ClearDatabaseScreen.kt | 3 +- .../screen/debug/BackupSchemaScreen.kt | 3 +- .../settings/screen/debug/WorkerInfoScreen.kt | 3 +- .../reader/appbars/ReaderAppBars.kt | 57 ++++++++----- .../reader/settings/ReaderSettingsDialog.kt | 3 +- .../presentation/track/TrackInfoDialogHome.kt | 4 +- .../track/TrackInfoDialogSelector.kt | 2 +- .../presentation/updates/UpdatesScreen.kt | 7 +- .../presentation/updates/UpdatesUiItem.kt | 2 +- .../eu/kanade/presentation/util/Navigator.kt | 3 + .../webview/WebViewScreenContent.kt | 7 +- .../kanade/tachiyomi/ui/browse/BrowseTab.kt | 3 +- .../ui/browse/extension/ExtensionsTab.kt | 3 +- .../migration/sources/MigrateSourceTab.kt | 3 +- .../tachiyomi/ui/browse/source/SourcesTab.kt | 3 +- .../ui/download/DownloadQueueScreen.kt | 3 +- 42 files changed, 238 insertions(+), 193 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/presentation/history/HistoryUiModelProviders.kt diff --git a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt index d778390819..abf3d3d218 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt @@ -146,7 +146,7 @@ fun BrowseSourceContent( } @Composable -fun MissingSourceScreen( +internal fun MissingSourceScreen( source: StubSource, navigateUp: () -> Unit, ) { diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt index 715e93b52f..698c801ce9 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt @@ -55,6 +55,7 @@ import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreenModel import eu.kanade.tachiyomi.util.system.LocaleHelper +import kotlinx.collections.immutable.persistentListOf import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.padding @@ -80,40 +81,42 @@ fun ExtensionDetailsScreen( navigateUp = navigateUp, actions = { AppBarActions( - actions = buildList { - if (state.extension?.isUnofficial == false) { - add( - AppBar.Action( - title = stringResource(R.string.whats_new), - icon = Icons.Outlined.History, - onClick = onClickWhatsNew, - ), - ) - add( - AppBar.Action( - title = stringResource(R.string.action_faq_and_guides), - icon = Icons.AutoMirrored.Outlined.HelpOutline, - onClick = onClickReadme, + actions = persistentListOf().builder() + .apply { + if (state.extension?.isUnofficial == false) { + add( + AppBar.Action( + title = stringResource(R.string.whats_new), + icon = Icons.Outlined.History, + onClick = onClickWhatsNew, + ), + ) + add( + AppBar.Action( + title = stringResource(R.string.action_faq_and_guides), + icon = Icons.AutoMirrored.Outlined.HelpOutline, + onClick = onClickReadme, + ), + ) + } + addAll( + listOf( + AppBar.OverflowAction( + title = stringResource(R.string.action_enable_all), + onClick = onClickEnableAll, + ), + AppBar.OverflowAction( + title = stringResource(R.string.action_disable_all), + onClick = onClickDisableAll, + ), + AppBar.OverflowAction( + title = stringResource(R.string.pref_clear_cookies), + onClick = onClickClearCookies, + ), ), ) } - addAll( - listOf( - AppBar.OverflowAction( - title = stringResource(R.string.action_enable_all), - onClick = onClickEnableAll, - ), - AppBar.OverflowAction( - title = stringResource(R.string.action_disable_all), - onClick = onClickDisableAll, - ), - AppBar.OverflowAction( - title = stringResource(R.string.pref_clear_cookies), - onClick = onClickClearCookies, - ), - ), - ) - }, + .build(), ) }, scrollBehavior = scrollBehavior, @@ -320,10 +323,10 @@ private fun DetailsHeader( @Composable private fun InfoText( - modifier: Modifier, primaryText: String, - primaryTextStyle: TextStyle = MaterialTheme.typography.bodyLarge, secondaryText: String, + modifier: Modifier = Modifier, + primaryTextStyle: TextStyle = MaterialTheme.typography.bodyLarge, onClick: (() -> Unit)? = null, ) { val interactionSource = remember { MutableInteractionSource() } @@ -363,10 +366,10 @@ private fun InfoDivider() { @Composable private fun SourceSwitchPreference( - modifier: Modifier = Modifier, source: ExtensionSourceItem, onClickSourcePreferences: (sourceId: Long) -> Unit, onClickSource: (sourceId: Long) -> Unit, + modifier: Modifier = Modifier, ) { val context = LocalContext.current diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt index 28069f974a..fd10ea191b 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt @@ -214,12 +214,12 @@ private fun ExtensionContent( @Composable private fun ExtensionItem( - modifier: Modifier = Modifier, item: ExtensionUiModel.Item, onClickItem: (Extension) -> Unit, onLongClickItem: (Extension) -> Unit, onClickItemCancel: (Extension) -> Unit, onClickItemAction: (Extension) -> Unit, + modifier: Modifier = Modifier, ) { val (extension, installStep) = item BaseBrowseItem( diff --git a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt index 508bffe2d2..b067968486 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt @@ -60,13 +60,13 @@ fun GlobalSearchScreen( @Composable internal fun GlobalSearchContent( - fromSourceId: Long? = null, items: Map, contentPadding: PaddingValues, getManga: @Composable (Manga) -> State, onClickSource: (CatalogueSource) -> Unit, onClickItem: (Manga) -> Unit, onLongClickItem: (Manga) -> Unit, + fromSourceId: Long? = null, ) { LazyColumn( contentPadding = contentPadding, diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt index a896fb525c..a1ffea4e19 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateMangaScreen.kt @@ -70,10 +70,10 @@ private fun MigrateMangaContent( @Composable private fun MigrateMangaItem( - modifier: Modifier = Modifier, manga: Manga, onClickItem: (Manga) -> Unit, onClickCover: (Manga) -> Unit, + modifier: Modifier = Modifier, ) { BaseMangaListItem( modifier = modifier, diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt index 0733fc43e0..93ed0a1c0b 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt @@ -144,11 +144,11 @@ private fun MigrateSourceList( @Composable private fun MigrateSourceItem( - modifier: Modifier = Modifier, source: Source, count: Long, onClickItem: () -> Unit, onLongClickItem: () -> Unit, + modifier: Modifier = Modifier, ) { BaseSourceItem( modifier = modifier, diff --git a/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt index d72f8692e0..8cab0f571d 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/SourcesFilterScreen.kt @@ -94,10 +94,10 @@ private fun SourcesFilterContent( @Composable private fun SourcesFilterHeader( - modifier: Modifier, language: String, enabled: Boolean, onClickItem: (String) -> Unit, + modifier: Modifier = Modifier, ) { SwitchPreferenceWidget( modifier = modifier, @@ -109,10 +109,10 @@ private fun SourcesFilterHeader( @Composable private fun SourcesFilterItem( - modifier: Modifier, source: Source, enabled: Boolean, onClickItem: (Source) -> Unit, + modifier: Modifier = Modifier, ) { BaseSourceItem( modifier = modifier, diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BaseSourceItem.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BaseSourceItem.kt index b8b9e0d7a3..eebb35253d 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BaseSourceItem.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BaseSourceItem.kt @@ -16,8 +16,8 @@ import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable fun BaseSourceItem( - modifier: Modifier = Modifier, source: Source, + modifier: Modifier = Modifier, showLanguageInContent: Boolean = true, onClickItem: () -> Unit = {}, onLongClickItem: () -> Unit = {}, diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt index 02e0e1befe..0e57fcdc71 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt @@ -20,6 +20,7 @@ import eu.kanade.presentation.components.SearchToolbar import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.Source +import kotlinx.collections.immutable.persistentListOf import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.source.local.LocalSource @@ -53,32 +54,44 @@ fun BrowseSourceToolbar( onClickCloseSearch = navigateUp, actions = { AppBarActions( - actions = listOfNotNull( - AppBar.Action( - title = stringResource(R.string.action_display_mode), - icon = if (displayMode == LibraryDisplayMode.List) { - Icons.AutoMirrored.Filled.ViewList + actions = persistentListOf().builder() + .apply { + add( + AppBar.Action( + title = stringResource(R.string.action_display_mode), + icon = if (displayMode == LibraryDisplayMode.List) { + Icons.AutoMirrored.Filled.ViewList + } else { + Icons.Filled.ViewModule + }, + onClick = { selectingDisplayMode = true }, + ), + ) + if (isLocalSource) { + add( + AppBar.OverflowAction( + title = stringResource(R.string.label_help), + onClick = onHelpClick, + ), + ) } else { - Icons.Filled.ViewModule - }, - onClick = { selectingDisplayMode = true }, - ), - if (isLocalSource) { - AppBar.OverflowAction( - title = stringResource(R.string.label_help), - onClick = onHelpClick, - ) - } else { - AppBar.OverflowAction( - title = stringResource(R.string.action_open_in_web_view), - onClick = onWebViewClick, - ) - }, - AppBar.OverflowAction( - title = stringResource(R.string.action_settings), - onClick = onSettingsClick, - ).takeIf { isConfigurableSource }, - ), + add( + AppBar.OverflowAction( + title = stringResource(R.string.action_open_in_web_view), + onClick = onWebViewClick, + ), + ) + } + if (isConfigurableSource) { + add( + AppBar.OverflowAction( + title = stringResource(R.string.action_settings), + onClick = onSettingsClick, + ), + ) + } + } + .build(), ) DropdownMenu( diff --git a/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt b/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt index 7d43278141..10ff0788dc 100644 --- a/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt @@ -19,6 +19,7 @@ import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBarActions import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.category.CategoryScreenState +import kotlinx.collections.immutable.persistentListOf import tachiyomi.domain.category.model.Category import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.padding @@ -45,7 +46,7 @@ fun CategoryScreen( navigateUp = navigateUp, actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_sort), icon = Icons.Outlined.SortByAlpha, diff --git a/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt b/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt index 9068708a4c..e2cebe25d1 100644 --- a/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/category/components/CategoryListItem.kt @@ -27,7 +27,6 @@ import tachiyomi.presentation.core.components.material.padding @Composable fun CategoryListItem( - modifier: Modifier = Modifier, category: Category, canMoveUp: Boolean, canMoveDown: Boolean, @@ -35,6 +34,7 @@ fun CategoryListItem( onMoveDown: (Category) -> Unit, onRename: () -> Unit, onDelete: () -> Unit, + modifier: Modifier = Modifier, ) { ElevatedCard( modifier = modifier, diff --git a/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt b/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt index 1a4f2b9ee7..b3d07c1c3c 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt @@ -71,10 +71,10 @@ fun NavigatorAdaptiveSheet( */ @Composable fun AdaptiveSheet( + onDismissRequest: () -> Unit, modifier: Modifier = Modifier, tonalElevation: Dp = 1.dp, enableSwipeDismiss: Boolean = true, - onDismissRequest: () -> Unit, content: @Composable () -> Unit, ) { val isTabletUi = isTabletUi() diff --git a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt index a8db1790f5..72fc17a30f 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt @@ -51,6 +51,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import eu.kanade.tachiyomi.R +import kotlinx.collections.immutable.ImmutableList import tachiyomi.presentation.core.util.clearFocusOnSoftKeyboardHide import tachiyomi.presentation.core.util.runOnEnterKeyPressed import tachiyomi.presentation.core.util.secondaryItemAlpha @@ -184,7 +185,7 @@ fun AppBarTitle( @Composable fun AppBarActions( - actions: List, + actions: ImmutableList, ) { var showMenu by remember { mutableStateOf(false) } diff --git a/app/src/main/java/eu/kanade/presentation/components/RelativeDateHeader.kt b/app/src/main/java/eu/kanade/presentation/components/RelativeDateHeader.kt index 2466e2eedf..c291890e34 100644 --- a/app/src/main/java/eu/kanade/presentation/components/RelativeDateHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/components/RelativeDateHeader.kt @@ -11,10 +11,10 @@ import java.util.Date @Composable fun RelativeDateHeader( - modifier: Modifier = Modifier, date: Date, relativeTime: Boolean, dateFormat: DateFormat, + modifier: Modifier = Modifier, ) { val context = LocalContext.current ListGroupHeader( diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt index 88dc527035..70a6b48aac 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEachIndexed import eu.kanade.tachiyomi.R +import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.launch import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.material.TabText @@ -39,9 +40,9 @@ object TabbedDialogPaddings { @Composable fun TabbedDialog( - modifier: Modifier = Modifier, onDismissRequest: () -> Unit, - tabTitles: List, + tabTitles: ImmutableList, + modifier: Modifier = Modifier, tabOverflowMenuContent: (@Composable ColumnScope.(() -> Unit) -> Unit)? = null, pagerState: PagerState = rememberPagerState { tabTitles.size }, content: @Composable (Int) -> Unit, diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt index 72329aca6b..18221cbdd1 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt @@ -21,6 +21,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.res.stringResource +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.launch import tachiyomi.presentation.core.components.HorizontalPager import tachiyomi.presentation.core.components.material.Scaffold @@ -29,7 +31,7 @@ import tachiyomi.presentation.core.components.material.TabText @Composable fun TabbedScreen( @StringRes titleRes: Int, - tabs: List, + tabs: ImmutableList, startIndex: Int? = null, searchQuery: String? = null, onChangeSearchQuery: (String?) -> Unit = {}, @@ -97,6 +99,6 @@ data class TabContent( @StringRes val titleRes: Int, val badgeNumber: Int? = null, val searchEnabled: Boolean = false, - val actions: List = emptyList(), + val actions: ImmutableList = persistentListOf(), val content: @Composable (contentPadding: PaddingValues, snackbarHostState: SnackbarHostState) -> Unit, ) diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt index 08db8aa24e..9014072c0a 100644 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt @@ -23,6 +23,7 @@ import eu.kanade.presentation.history.components.HistoryItem import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.history.HistoryScreenModel +import kotlinx.collections.immutable.persistentListOf import tachiyomi.core.preference.InMemoryPreferenceStore import tachiyomi.domain.history.model.HistoryWithRelations import tachiyomi.presentation.core.components.FastScrollLazyColumn @@ -51,7 +52,7 @@ fun HistoryScreen( onChangeSearchQuery = onSearchQueryChange, actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.pref_clear_history), icon = Icons.Outlined.DeleteSweep, diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryUiModelProviders.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryUiModelProviders.kt deleted file mode 100644 index 16200635fb..0000000000 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryUiModelProviders.kt +++ /dev/null @@ -1,13 +0,0 @@ -package eu.kanade.presentation.history - -import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import java.time.Instant -import java.util.Date - -object HistoryUiModelProviders { - - class HeadNow : PreviewParameterProvider { - override val values: Sequence = - sequenceOf(HistoryUiModel.Header(Date.from(Instant.now()))) - } -} diff --git a/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt b/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt index 148a8e6933..12808941d2 100644 --- a/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt +++ b/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt @@ -35,11 +35,11 @@ private val HistoryItemHeight = 96.dp @Composable fun HistoryItem( - modifier: Modifier = Modifier, history: HistoryWithRelations, onClickCover: () -> Unit, onClickResume: () -> Unit, onClickDelete: () -> Unit, + modifier: Modifier = Modifier, ) { Row( modifier = modifier diff --git a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt index 4e0bd45d54..2c58b0e605 100644 --- a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt @@ -18,6 +18,7 @@ import eu.kanade.presentation.components.TabbedDialog import eu.kanade.presentation.components.TabbedDialogPaddings import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.library.LibrarySettingsScreenModel +import kotlinx.collections.immutable.persistentListOf import tachiyomi.core.preference.TriState import tachiyomi.domain.category.model.Category import tachiyomi.domain.library.model.LibraryDisplayMode @@ -40,7 +41,7 @@ fun LibrarySettingsDialog( ) { TabbedDialog( onDismissRequest = onDismissRequest, - tabTitles = listOf( + tabTitles = persistentListOf( stringResource(R.string.action_filter), stringResource(R.string.action_sort), stringResource(R.string.action_display), diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt index f19397e2f1..18a332d1ff 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt @@ -21,6 +21,7 @@ import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBarActions import eu.kanade.presentation.components.SearchToolbar import eu.kanade.tachiyomi.R +import kotlinx.collections.immutable.persistentListOf import tachiyomi.presentation.core.components.Pill import tachiyomi.presentation.core.theme.active @@ -95,7 +96,7 @@ private fun LibraryRegularToolbar( actions = { val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_filter), icon = Icons.Outlined.FilterList, @@ -132,7 +133,7 @@ private fun LibrarySelectionToolbar( titleContent = { Text(text = "$selectedCount") }, actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_select_all), icon = Icons.Outlined.SelectAll, diff --git a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt index e296681770..b4fed1b73d 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt @@ -32,6 +32,7 @@ import eu.kanade.domain.manga.model.forceDownloaded import eu.kanade.presentation.components.TabbedDialog import eu.kanade.presentation.components.TabbedDialogPaddings import eu.kanade.tachiyomi.R +import kotlinx.collections.immutable.persistentListOf import tachiyomi.core.preference.TriState import tachiyomi.domain.manga.model.Manga import tachiyomi.presentation.core.components.LabeledCheckbox @@ -64,7 +65,7 @@ fun ChapterSettingsDialog( TabbedDialog( onDismissRequest = onDismissRequest, - tabTitles = listOf( + tabTitles = persistentListOf( stringResource(R.string.action_filter), stringResource(R.string.action_sort), stringResource(R.string.action_display), diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt index 43e9ac1581..e8f7a77140 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCoverDialog.kt @@ -49,6 +49,7 @@ import eu.kanade.presentation.components.DropdownMenu import eu.kanade.presentation.manga.EditCoverAction import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView +import kotlinx.collections.immutable.persistentListOf import tachiyomi.domain.manga.model.Manga import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.util.clickableNoIndication @@ -91,22 +92,18 @@ fun MangaCoverDialog( Spacer(modifier = Modifier.weight(1f)) ActionsPill { AppBarActions( - actions = buildList { - add( - AppBar.Action( - title = stringResource(R.string.action_share), - icon = Icons.Outlined.Share, - onClick = onShareClick, - ), - ) - add( - AppBar.Action( - title = stringResource(R.string.action_save), - icon = Icons.Outlined.Save, - onClick = onSaveClick, - ), - ) - }, + actions = persistentListOf( + AppBar.Action( + title = stringResource(R.string.action_share), + icon = Icons.Outlined.Share, + onClick = onShareClick, + ), + AppBar.Action( + title = stringResource(R.string.action_save), + icon = Icons.Outlined.Save, + onClick = onSaveClick, + ), + ), ) if (onEditClick != null) { Box { diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt index b99d58b588..3b55c595c9 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaToolbar.kt @@ -30,6 +30,7 @@ import eu.kanade.presentation.components.DownloadDropdownMenu import eu.kanade.presentation.components.UpIcon import eu.kanade.presentation.manga.DownloadAction import eu.kanade.tachiyomi.R +import kotlinx.collections.immutable.persistentListOf import tachiyomi.presentation.core.theme.active @Composable @@ -72,7 +73,7 @@ fun MangaToolbar( actions = { if (isActionMode) { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_select_all), icon = Icons.Outlined.SelectAll, @@ -98,55 +99,57 @@ fun MangaToolbar( val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current AppBarActions( - actions = buildList { - if (onClickDownload != null) { + actions = persistentListOf().builder() + .apply { + if (onClickDownload != null) { + add( + AppBar.Action( + title = stringResource(R.string.manga_download), + icon = Icons.Outlined.Download, + onClick = { downloadExpanded = !downloadExpanded }, + ), + ) + } add( AppBar.Action( - title = stringResource(R.string.manga_download), - icon = Icons.Outlined.Download, - onClick = { downloadExpanded = !downloadExpanded }, + title = stringResource(R.string.action_filter), + icon = Icons.Outlined.FilterList, + iconTint = filterTint, + onClick = onClickFilter, ), ) - } - add( - AppBar.Action( - title = stringResource(R.string.action_filter), - icon = Icons.Outlined.FilterList, - iconTint = filterTint, - onClick = onClickFilter, - ), - ) - add( - AppBar.OverflowAction( - title = stringResource(R.string.action_webview_refresh), - onClick = onClickRefresh, - ), - ) - if (onClickEditCategory != null) { add( AppBar.OverflowAction( - title = stringResource(R.string.action_edit_categories), - onClick = onClickEditCategory, + title = stringResource(R.string.action_webview_refresh), + onClick = onClickRefresh, ), ) + if (onClickEditCategory != null) { + add( + AppBar.OverflowAction( + title = stringResource(R.string.action_edit_categories), + onClick = onClickEditCategory, + ), + ) + } + if (onClickMigrate != null) { + add( + AppBar.OverflowAction( + title = stringResource(R.string.action_migrate), + onClick = onClickMigrate, + ), + ) + } + if (onClickShare != null) { + add( + AppBar.OverflowAction( + title = stringResource(R.string.action_share), + onClick = onClickShare, + ), + ) + } } - if (onClickMigrate != null) { - add( - AppBar.OverflowAction( - title = stringResource(R.string.action_migrate), - onClick = onClickMigrate, - ), - ) - } - if (onClickShare != null) { - add( - AppBar.OverflowAction( - title = stringResource(R.string.action_share), - onClick = onClickShare, - ), - ) - } - }, + .build(), ) } }, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt index a499b0823a..2209e104b5 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt @@ -47,6 +47,7 @@ import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget import eu.kanade.presentation.util.LocalBackPress import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R +import kotlinx.collections.immutable.persistentListOf import tachiyomi.presentation.core.components.material.Scaffold import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen @@ -88,7 +89,7 @@ object SettingsMainScreen : Screen() { navigateUp = backPress::invoke, actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_search), icon = Icons.Outlined.Search, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt index 964f503b0c..9b0da494c4 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt @@ -20,6 +20,7 @@ import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBarActions import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R +import kotlinx.collections.immutable.persistentListOf import tachiyomi.presentation.core.components.material.Scaffold class OpenSourceLibraryLicenseScreen( @@ -41,7 +42,7 @@ class OpenSourceLibraryLicenseScreen( actions = { if (!website.isNullOrEmpty()) { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.website), icon = Icons.Default.Public, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt index 2c3d3337f3..036926f1ac 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt @@ -41,6 +41,7 @@ import eu.kanade.presentation.components.AppBarActions import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.toast +import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.update import tachiyomi.core.util.lang.launchIO @@ -106,7 +107,7 @@ class ClearDatabaseScreen : Screen() { actions = { if (s.items.isNotEmpty()) { AppBarActions( - actions = listOf( + actions = persistentListOf( AppBar.Action( title = stringResource(R.string.action_select_all), icon = Icons.Outlined.SelectAll, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt index 4c4d22a691..402dbb0a51 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/BackupSchemaScreen.kt @@ -21,6 +21,7 @@ import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.backup.models.Backup import eu.kanade.tachiyomi.util.system.copyToClipboard +import kotlinx.collections.immutable.persistentListOf import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator import tachiyomi.presentation.core.components.material.Scaffold @@ -44,7 +45,7 @@ class BackupSchemaScreen : Screen() { navigateUp = navigator::pop, actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_copy_to_clipboard), icon = Icons.Default.ContentCopy, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt index dc9f6e7de8..3e1e25c4f4 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/WorkerInfoScreen.kt @@ -33,6 +33,7 @@ import eu.kanade.presentation.util.ioCoroutineScope import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.workManager +import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn @@ -62,7 +63,7 @@ class WorkerInfoScreen : Screen() { navigateUp = navigator::pop, actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_copy_to_clipboard), icon = Icons.Default.ContentCopy, diff --git a/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt b/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt index aff4c8c3fa..a57d63cc93 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt @@ -29,6 +29,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode import eu.kanade.tachiyomi.ui.reader.viewer.Viewer import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer +import kotlinx.collections.immutable.persistentListOf private val animationSpec = tween(200) @@ -98,27 +99,43 @@ fun ReaderAppBars( navigateUp = navigateUp, actions = { AppBarActions( - listOfNotNull( - AppBar.Action( - title = stringResource( - if (bookmarked) R.string.action_remove_bookmark else R.string.action_bookmark, - ), - icon = if (bookmarked) Icons.Outlined.Bookmark else Icons.Outlined.BookmarkBorder, - onClick = onToggleBookmarked, - ), - onOpenInWebView?.let { - AppBar.OverflowAction( - title = stringResource(R.string.action_open_in_web_view), - onClick = it, + actions = persistentListOf().builder() + .apply { + add( + AppBar.Action( + title = stringResource( + if (bookmarked) { + R.string.action_remove_bookmark + } else { + R.string.action_bookmark + }, + ), + icon = if (bookmarked) { + Icons.Outlined.Bookmark + } else { + Icons.Outlined.BookmarkBorder + }, + onClick = onToggleBookmarked, + ), ) - }, - onShare?.let { - AppBar.OverflowAction( - title = stringResource(R.string.action_share), - onClick = it, - ) - }, - ), + onOpenInWebView?.let { + add( + AppBar.OverflowAction( + title = stringResource(R.string.action_open_in_web_view), + onClick = it, + ), + ) + } + onShare?.let { + add( + AppBar.OverflowAction( + title = stringResource(R.string.action_share), + onClick = it, + ), + ) + } + } + .build(), ) }, ) diff --git a/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt index 583708d982..08dc5ae5e2 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/settings/ReaderSettingsDialog.kt @@ -17,6 +17,7 @@ import eu.kanade.presentation.components.TabbedDialog import eu.kanade.presentation.components.TabbedDialogPaddings import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel +import kotlinx.collections.immutable.persistentListOf @Composable fun ReaderSettingsDialog( @@ -25,7 +26,7 @@ fun ReaderSettingsDialog( onHideMenus: () -> Unit, screenModel: ReaderSettingsScreenModel, ) { - val tabTitles = listOf( + val tabTitles = persistentListOf( stringResource(R.string.pref_category_reading_mode), stringResource(R.string.pref_category_general), stringResource(R.string.custom_filter), diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt index 7125adbc0b..a04f9de7e4 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt @@ -240,10 +240,10 @@ private fun TrackInfoItem( @Composable private fun TrackDetailsItem( - modifier: Modifier = Modifier, text: String?, - placeholder: String = "", onClick: () -> Unit, + modifier: Modifier = Modifier, + placeholder: String = "", ) { Box( modifier = modifier diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt index 2f4ecf11d4..0fcde4faf6 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt @@ -191,9 +191,9 @@ fun TrackDateSelector( private fun BaseSelector( title: String, content: @Composable BoxScope.() -> Unit, - thirdButton: @Composable (RowScope.() -> Unit)? = null, onConfirm: () -> Unit, onDismissRequest: () -> Unit, + thirdButton: @Composable (RowScope.() -> Unit)? = null, ) { AlertDialogContent( modifier = Modifier.windowInsetsPadding(WindowInsets.systemBars), diff --git a/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt b/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt index 5391d56bb0..492d6a3965 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesScreen.kt @@ -29,6 +29,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.ui.updates.UpdatesItem import eu.kanade.tachiyomi.ui.updates.UpdatesScreenModel +import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.delay import kotlinx.coroutines.launch import tachiyomi.presentation.core.components.FastScrollLazyColumn @@ -128,7 +129,6 @@ fun UpdateScreen( @Composable private fun UpdatesAppBar( - modifier: Modifier = Modifier, onUpdateLibrary: () -> Unit, // For action mode actionModeCounter: Int, @@ -136,13 +136,14 @@ private fun UpdatesAppBar( onInvertSelection: () -> Unit, onCancelActionMode: () -> Unit, scrollBehavior: TopAppBarScrollBehavior, + modifier: Modifier = Modifier, ) { AppBar( modifier = modifier, title = stringResource(R.string.label_recent_updates), actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_update_library), icon = Icons.Outlined.Refresh, @@ -155,7 +156,7 @@ private fun UpdatesAppBar( onCancelActionMode = onCancelActionMode, actionModeActions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_select_all), icon = Icons.Outlined.SelectAll, diff --git a/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt b/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt index 9be12b6bb0..f8b9c7ce09 100644 --- a/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt +++ b/app/src/main/java/eu/kanade/presentation/updates/UpdatesUiItem.kt @@ -131,7 +131,6 @@ internal fun LazyListScope.updatesUiItems( @Composable private fun UpdatesUiItem( - modifier: Modifier, update: UpdatesWithRelations, selected: Boolean, readProgress: String?, @@ -142,6 +141,7 @@ private fun UpdatesUiItem( // Download Indicator downloadStateProvider: () -> Download.State, downloadProgressProvider: () -> Int, + modifier: Modifier = Modifier, ) { val haptic = LocalHapticFeedback.current val textAlpha = if (update.read) ReadItemAlpha else 1f diff --git a/app/src/main/java/eu/kanade/presentation/util/Navigator.kt b/app/src/main/java/eu/kanade/presentation/util/Navigator.kt index bcbf7110f5..86311d8e05 100644 --- a/app/src/main/java/eu/kanade/presentation/util/Navigator.kt +++ b/app/src/main/java/eu/kanade/presentation/util/Navigator.kt @@ -1,5 +1,6 @@ package eu.kanade.presentation.util +import android.annotation.SuppressLint import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.ContentTransform @@ -27,6 +28,7 @@ import soup.compose.material.motion.animation.rememberSlideDistance /** * For invoking back press to the parent activity */ +@SuppressLint("ComposeCompositionLocalUsage") val LocalBackPress: ProvidableCompositionLocal<(() -> Unit)?> = staticCompositionLocalOf { null } interface Tab : cafe.adriel.voyager.navigator.tab.Tab { @@ -79,6 +81,7 @@ fun ScreenTransition( targetState = navigator.lastItem, transitionSpec = transition, modifier = modifier, + label = "transition", ) { screen -> navigator.saveableState("transition", screen) { content(screen) diff --git a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt index 34ab4dbafa..1ca4af791a 100644 --- a/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt +++ b/app/src/main/java/eu/kanade/presentation/webview/WebViewScreenContent.kt @@ -43,6 +43,7 @@ import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.getHtml import eu.kanade.tachiyomi.util.system.setDefaultSettings +import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.launch import tachiyomi.presentation.core.components.material.Scaffold @@ -51,11 +52,11 @@ fun WebViewScreenContent( onNavigateUp: () -> Unit, initialTitle: String?, url: String, - headers: Map = emptyMap(), - onUrlChange: (String) -> Unit = {}, onShare: (String) -> Unit, onOpenInBrowser: (String) -> Unit, onClearCookies: (String) -> Unit, + headers: Map = emptyMap(), + onUrlChange: (String) -> Unit = {}, ) { val state = rememberWebViewState(url = url, additionalHttpHeaders = headers) val navigator = rememberWebViewNavigator() @@ -124,7 +125,7 @@ fun WebViewScreenContent( navigationIcon = Icons.Outlined.Close, actions = { AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_webview_back), icon = Icons.AutoMirrored.Outlined.ArrowBack, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt index 4466cb5672..1b8fa97696 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/BrowseTab.kt @@ -23,6 +23,7 @@ import eu.kanade.tachiyomi.ui.browse.migration.sources.migrateSourceTab import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen import eu.kanade.tachiyomi.ui.browse.source.sourcesTab import eu.kanade.tachiyomi.ui.main.MainActivity +import kotlinx.collections.immutable.persistentListOf data class BrowseTab( private val toExtensions: Boolean = false, @@ -54,7 +55,7 @@ data class BrowseTab( TabbedScreen( titleRes = R.string.browse, - tabs = listOf( + tabs = persistentListOf( sourcesTab(), extensionsTab(extensionsScreenModel), migrateSourceTab(), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt index b327b82e97..b62f3c27d8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsTab.kt @@ -14,6 +14,7 @@ import eu.kanade.presentation.components.TabContent import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreen +import kotlinx.collections.immutable.persistentListOf @Composable fun extensionsTab( @@ -26,7 +27,7 @@ fun extensionsTab( titleRes = R.string.label_extensions, badgeNumber = state.updates.takeIf { it > 0 }, searchEnabled = true, - actions = listOf( + actions = persistentListOf( AppBar.Action( title = stringResource(R.string.action_filter), icon = Icons.Outlined.Translate, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt index 8794c90789..3807c802e9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrateSourceTab.kt @@ -17,6 +17,7 @@ import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.TabContent import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreen +import kotlinx.collections.immutable.persistentListOf @Composable fun Screen.migrateSourceTab(): TabContent { @@ -27,7 +28,7 @@ fun Screen.migrateSourceTab(): TabContent { return TabContent( titleRes = R.string.label_migration, - actions = listOf( + actions = persistentListOf( AppBar.Action( title = stringResource(R.string.migration_help_guide), icon = Icons.AutoMirrored.Outlined.HelpOutline, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt index ffcd384d69..9720af18ec 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesTab.kt @@ -19,6 +19,7 @@ import eu.kanade.presentation.components.TabContent import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceScreen import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen +import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch @@ -30,7 +31,7 @@ fun Screen.sourcesTab(): TabContent { return TabContent( titleRes = R.string.label_sources, - actions = listOf( + actions = persistentListOf( AppBar.Action( title = stringResource(R.string.action_global_search), icon = Icons.Outlined.TravelExplore, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt index 0fc7f35762..f0807d5de3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/download/DownloadQueueScreen.kt @@ -55,6 +55,7 @@ import eu.kanade.presentation.components.NestedMenuItem import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.DownloadListBinding +import kotlinx.collections.immutable.persistentListOf import tachiyomi.core.util.lang.launchUI import tachiyomi.presentation.core.components.Pill import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton @@ -183,7 +184,7 @@ object DownloadQueueScreen : Screen() { } AppBarActions( - listOf( + persistentListOf( AppBar.Action( title = stringResource(R.string.action_sort), icon = Icons.AutoMirrored.Outlined.Sort,