Select All for GlobalSearch
(cherry picked from commit a28233735cac5bce5a630de84555b501ffcccc8d)
This commit is contained in:
parent
5d870559e7
commit
fddfe6280a
2 changed files with 23 additions and 0 deletions
|
|
@ -52,6 +52,20 @@ fun GlobalSearchScreen(
|
|||
selectedCount = bulkFavoriteState.selection.size,
|
||||
onClickClearSelection = bulkFavoriteScreenModel::toggleSelectionMode,
|
||||
onChangeCategoryClicked = bulkFavoriteScreenModel::addFavorite,
|
||||
onSelectAll = {
|
||||
state.filteredItems.forEach { (_, result) ->
|
||||
when (result) {
|
||||
is SearchItemResult.Success -> {
|
||||
result.result.map{manga ->
|
||||
|
||||
if (!bulkFavoriteState.selection.contains(manga))
|
||||
bulkFavoriteScreenModel.toggleSelection(manga)
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
} else {
|
||||
// KMK <--
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package eu.kanade.presentation.components
|
|||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.BookmarkAdd
|
||||
import androidx.compose.material.icons.filled.SelectAll
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
|
@ -14,6 +15,7 @@ fun SelectionToolbar(
|
|||
selectedCount: Int,
|
||||
onClickClearSelection: () -> Unit,
|
||||
onChangeCategoryClicked: () -> Unit,
|
||||
onSelectAll: () -> Unit = {},
|
||||
) {
|
||||
AppBar(
|
||||
titleContent = { Text(text = "$selectedCount") },
|
||||
|
|
@ -29,6 +31,13 @@ fun SelectionToolbar(
|
|||
}
|
||||
},
|
||||
),
|
||||
AppBar.Action(
|
||||
title = stringResource(MR.strings.action_select_all),
|
||||
icon = Icons.Filled.SelectAll,
|
||||
onClick = {
|
||||
onSelectAll.invoke()
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue