diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt index c0907f002..bc73aed3d 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt @@ -147,6 +147,10 @@ class ArrangeBookActivity : VMBaseActivity(R.layout.activi okButton { viewModel.deleteBook(*adapter.selectedBooks.toTypedArray()) } noButton { } }.show().applyTint() + R.id.menu_update_enable -> + viewModel.upCanUpdate(adapter.selectedBooks.toTypedArray(), true) + R.id.menu_update_disable -> + viewModel.upCanUpdate(adapter.selectedBooks.toTypedArray(), true) } return false } diff --git a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt index 4f4972de9..82ec712d2 100644 --- a/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookViewModel.kt @@ -8,6 +8,15 @@ import io.legado.app.data.entities.Book class ArrangeBookViewModel(application: Application) : BaseViewModel(application) { + fun upCanUpdate(books: Array, canUpdate: Boolean) { + execute { + books.forEach { + it.canUpdate = canUpdate + } + App.db.bookDao().update(*books) + } + } + fun updateBook(vararg book: Book) { execute { App.db.bookDao().update(*book)