no need using builder to create AppBarAction

This commit is contained in:
Cuong Tran 2024-03-09 23:58:46 +07:00
parent a7c6232a50
commit 89a5f2e702
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
4 changed files with 24 additions and 37 deletions

View file

@ -280,17 +280,13 @@ fun SourceFeedToolbar(
// KMK --> // KMK -->
actions = { actions = {
AppBarActions( AppBarActions(
actions = persistentListOf<AppBar.AppBarAction>().builder() actions = persistentListOf(
.apply {
add(
AppBar.Action( AppBar.Action(
title = stringResource(MR.strings.action_bulk_select), title = stringResource(MR.strings.action_bulk_select),
icon = Icons.Outlined.Checklist, icon = Icons.Outlined.Checklist,
onClick = toggleSelectionMode, onClick = toggleSelectionMode,
), ),
) )
}
.build(),
) )
persistentListOf( persistentListOf(
SourceSettingsButton(sourceId), SourceSettingsButton(sourceId),

View file

@ -65,17 +65,13 @@ fun GlobalSearchToolbar(
// KMK --> // KMK -->
actions = { actions = {
AppBarActions( AppBarActions(
actions = persistentListOf<AppBar.AppBarAction>().builder() actions = persistentListOf(
.apply {
add(
AppBar.Action( AppBar.Action(
title = stringResource(MR.strings.action_bulk_select), title = stringResource(MR.strings.action_bulk_select),
icon = Icons.Outlined.Checklist, icon = Icons.Outlined.Checklist,
onClick = toggleSelectionMode, onClick = toggleSelectionMode,
), ),
) )
}
.build(),
) )
}, },
// KMK <-- // KMK <--

View file

@ -17,14 +17,13 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.source.local.LocalSource import tachiyomi.source.local.LocalSource
// KMK -->
@Composable @Composable
fun SourceSettingsButton( fun SourceSettingsButton(
id: Long, id: Long,
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier @Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier
) { ) {
// Create a fake source // Create a fake source
val source = Source(id,"", "", supportsLatest = false, isStub = false) val source = Source(id, "", "", supportsLatest = false, isStub = false)
SourceSettingsButton(source = source) SourceSettingsButton(source = source)
} }
@ -38,8 +37,9 @@ fun SourceSettingsButton(
val navigator = LocalNavigator.currentOrThrow val navigator = LocalNavigator.currentOrThrow
IconButton(onClick = { IconButton(onClick = {
if (source.installedExtension !== null) if (source.installedExtension !== null) {
navigator.push(ExtensionDetailsScreen(source.installedExtension!!.pkgName)) navigator.push(ExtensionDetailsScreen(source.installedExtension!!.pkgName))
}
}) { }) {
Icon( Icon(
imageVector = Icons.Outlined.Settings, imageVector = Icons.Outlined.Settings,
@ -47,4 +47,3 @@ fun SourceSettingsButton(
) )
} }
} }
// KMK <--

View file

@ -85,17 +85,13 @@ data class SourceSearchScreen(
// KMK --> // KMK -->
actions = { actions = {
AppBarActions( AppBarActions(
actions = persistentListOf<AppBar.AppBarAction>().builder() actions = persistentListOf(
.apply {
add(
AppBar.Action( AppBar.Action(
title = stringResource(MR.strings.action_bulk_select), title = stringResource(MR.strings.action_bulk_select),
icon = Icons.Outlined.Checklist, icon = Icons.Outlined.Checklist,
onClick = bulkFavoriteScreenModel::toggleSelectionMode, onClick = bulkFavoriteScreenModel::toggleSelectionMode,
), ),
) )
}
.build(),
) )
}, },
// KMK <-- // KMK <--