Address more Compose lint warnings

This commit is contained in:
arkon 2023-11-17 09:46:13 -05:00
parent 0af4703b78
commit 2c032ff70d
42 changed files with 238 additions and 193 deletions

View File

@ -146,7 +146,7 @@ fun BrowseSourceContent(
}
@Composable
fun MissingSourceScreen(
internal fun MissingSourceScreen(
source: StubSource,
navigateUp: () -> Unit,
) {

View File

@ -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,7 +81,8 @@ fun ExtensionDetailsScreen(
navigateUp = navigateUp,
actions = {
AppBarActions(
actions = buildList {
actions = persistentListOf<AppBar.AppBarAction>().builder()
.apply {
if (state.extension?.isUnofficial == false) {
add(
AppBar.Action(
@ -113,7 +115,8 @@ fun ExtensionDetailsScreen(
),
),
)
},
}
.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

View File

@ -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(

View File

@ -60,13 +60,13 @@ fun GlobalSearchScreen(
@Composable
internal fun GlobalSearchContent(
fromSourceId: Long? = null,
items: Map<CatalogueSource, SearchItemResult>,
contentPadding: PaddingValues,
getManga: @Composable (Manga) -> State<Manga>,
onClickSource: (CatalogueSource) -> Unit,
onClickItem: (Manga) -> Unit,
onLongClickItem: (Manga) -> Unit,
fromSourceId: Long? = null,
) {
LazyColumn(
contentPadding = contentPadding,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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 = {},

View File

@ -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,7 +54,9 @@ fun BrowseSourceToolbar(
onClickCloseSearch = navigateUp,
actions = {
AppBarActions(
actions = listOfNotNull(
actions = persistentListOf<AppBar.AppBarAction>().builder()
.apply {
add(
AppBar.Action(
title = stringResource(R.string.action_display_mode),
icon = if (displayMode == LibraryDisplayMode.List) {
@ -63,23 +66,33 @@ fun BrowseSourceToolbar(
},
onClick = { selectingDisplayMode = true },
),
)
if (isLocalSource) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.label_help),
onClick = onHelpClick,
),
)
} else {
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,
).takeIf { isConfigurableSource },
),
)
}
}
.build(),
)
DropdownMenu(
expanded = selectingDisplayMode,

View File

@ -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,

View File

@ -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,

View File

@ -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()

View File

@ -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<AppBar.AppBarAction>,
actions: ImmutableList<AppBar.AppBarAction>,
) {
var showMenu by remember { mutableStateOf(false) }

View File

@ -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(

View File

@ -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<String>,
tabTitles: ImmutableList<String>,
modifier: Modifier = Modifier,
tabOverflowMenuContent: (@Composable ColumnScope.(() -> Unit) -> Unit)? = null,
pagerState: PagerState = rememberPagerState { tabTitles.size },
content: @Composable (Int) -> Unit,

View File

@ -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<TabContent>,
tabs: ImmutableList<TabContent>,
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<AppBar.Action> = emptyList(),
val actions: ImmutableList<AppBar.Action> = persistentListOf(),
val content: @Composable (contentPadding: PaddingValues, snackbarHostState: SnackbarHostState) -> Unit,
)

View File

@ -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,

View File

@ -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<HistoryUiModel> {
override val values: Sequence<HistoryUiModel> =
sequenceOf(HistoryUiModel.Header(Date.from(Instant.now())))
}
}

View File

@ -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

View File

@ -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),

View File

@ -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,

View File

@ -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),

View File

@ -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(
actions = persistentListOf(
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,
),
)
},
),
)
if (onEditClick != null) {
Box {

View File

@ -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,7 +99,8 @@ fun MangaToolbar(
val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current
AppBarActions(
actions = buildList {
actions = persistentListOf<AppBar.AppBarAction>().builder()
.apply {
if (onClickDownload != null) {
add(
AppBar.Action(
@ -146,7 +148,8 @@ fun MangaToolbar(
),
)
}
},
}
.build(),
)
}
},

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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<IntOffset>(200)
@ -98,28 +99,44 @@ fun ReaderAppBars(
navigateUp = navigateUp,
actions = {
AppBarActions(
listOfNotNull(
actions = persistentListOf<AppBar.AppBarAction>().builder()
.apply {
add(
AppBar.Action(
title = stringResource(
if (bookmarked) R.string.action_remove_bookmark else R.string.action_bookmark,
if (bookmarked) {
R.string.action_remove_bookmark
} else {
R.string.action_bookmark
},
),
icon = if (bookmarked) Icons.Outlined.Bookmark else Icons.Outlined.BookmarkBorder,
icon = if (bookmarked) {
Icons.Outlined.Bookmark
} else {
Icons.Outlined.BookmarkBorder
},
onClick = onToggleBookmarked,
),
)
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(),
)
},
)
}

View File

@ -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),

View File

@ -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

View File

@ -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),

View File

@ -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,

View File

@ -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

View File

@ -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)

View File

@ -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<String, String> = emptyMap(),
onUrlChange: (String) -> Unit = {},
onShare: (String) -> Unit,
onOpenInBrowser: (String) -> Unit,
onClearCookies: (String) -> Unit,
headers: Map<String, String> = 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,

View File

@ -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(),

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,