Hide bulkSelection’s “Select all” button when not used
(cherry picked from commit 8f8214f65467cde97161a5fd9edab5b1543b333e)
This commit is contained in:
parent
fddfe6280a
commit
097ce0e2c3
1 changed files with 27 additions and 19 deletions
|
|
@ -15,30 +15,38 @@ fun SelectionToolbar(
|
|||
selectedCount: Int,
|
||||
onClickClearSelection: () -> Unit,
|
||||
onChangeCategoryClicked: () -> Unit,
|
||||
onSelectAll: () -> Unit = {},
|
||||
onSelectAll: (() -> Unit)? = null,
|
||||
) {
|
||||
AppBar(
|
||||
titleContent = { Text(text = "$selectedCount") },
|
||||
actions = {
|
||||
AppBarActions(
|
||||
persistentListOf(
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_bookmark),
|
||||
icon = Icons.Filled.BookmarkAdd,
|
||||
onClick = {
|
||||
if (selectedCount > 0) {
|
||||
onChangeCategoryClicked()
|
||||
}
|
||||
},
|
||||
),
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_select_all),
|
||||
icon = Icons.Filled.SelectAll,
|
||||
onClick = {
|
||||
onSelectAll.invoke()
|
||||
},
|
||||
),
|
||||
),
|
||||
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
||||
.apply {
|
||||
if (onSelectAll != null) {
|
||||
add(
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_select_all),
|
||||
icon = Icons.Filled.SelectAll,
|
||||
onClick = {
|
||||
onSelectAll.invoke()
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
add(
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_bookmark),
|
||||
icon = Icons.Filled.BookmarkAdd,
|
||||
onClick = {
|
||||
if (selectedCount > 0) {
|
||||
onChangeCategoryClicked()
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
.build(),
|
||||
)
|
||||
},
|
||||
isActionMode = true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue