HapeLee 5 месяцев назад
Родитель
Сommit
562af402d9

+ 1 - 0
app/src/main/java/io/legado/app/ui/book/manage/BookshelfManageScreen.kt

@@ -468,6 +468,7 @@ private fun BookshelfManageScreen(
                 searchKey = ""
             }
         },
+        onClearSelection = clearSelection,
         onSearchQueryChange = { searchKey = it },
         searchPlaceholder = "筛选书名/作者/书源/分组",
         topBarActions = {

+ 2 - 1
app/src/main/java/io/legado/app/ui/widget/components/list/ListScaffold.kt

@@ -55,6 +55,7 @@ fun <T> ListScaffold(
     topBarActions: @Composable RowScope.() -> Unit = {},
     bottomContent: @Composable (ColumnScope.(GlassTopAppBarScrollBehavior) -> Unit)? = null,
     dropDownMenuContent: @Composable (ColumnScope.(dismiss: () -> Unit) -> Unit)? = null,
+    onClearSelection: (() -> Unit)? = null,
     selectionActions: SelectionActions? = null,
     onAddClick: (() -> Unit)? = null,
     floatingActionButton: @Composable () -> Unit = {
@@ -99,7 +100,7 @@ fun <T> ListScaffold(
                 onSearchSubmit = onSearchSubmit,
                 searchTrailingIcon = searchTrailingIcon,
                 searchPlaceholder = searchPlaceholder,
-                onClearSelection = { selectionActions?.onClearSelection?.invoke() },
+                onClearSelection = { onClearSelection?.invoke() ?: selectionActions?.onClearSelection?.invoke() },
                 topBarActions = topBarActions,
                 dropDownMenuContent = dropDownMenuContent,
                 bottomContent = bottomContent