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 -->
actions = {
AppBarActions(
actions = persistentListOf<AppBar.AppBarAction>().builder()
.apply {
add(
AppBar.Action(
title = stringResource(MR.strings.action_bulk_select),
icon = Icons.Outlined.Checklist,
onClick = toggleSelectionMode,
),
)
}
.build(),
actions = persistentListOf(
AppBar.Action(
title = stringResource(MR.strings.action_bulk_select),
icon = Icons.Outlined.Checklist,
onClick = toggleSelectionMode,
),
)
)
persistentListOf(
SourceSettingsButton(sourceId),

View file

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

View file

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

View file

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