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 bc73aed3d..00ee621e4 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 @@ -32,6 +32,7 @@ class ArrangeBookActivity : VMBaseActivity(R.layout.activi get() = getViewModel(ArrangeBookViewModel::class.java) override val groupList: ArrayList = arrayListOf() private val groupRequestCode = 22 + private val addToGroupRequestCode = 34 private lateinit var adapter: ArrangeBookAdapter private var groupLiveData: LiveData>? = null private var booksLiveData: LiveData>? = null @@ -151,6 +152,7 @@ class ArrangeBookActivity : VMBaseActivity(R.layout.activi viewModel.upCanUpdate(adapter.selectedBooks.toTypedArray(), true) R.id.menu_update_disable -> viewModel.upCanUpdate(adapter.selectedBooks.toTypedArray(), true) + R.id.menu_add_to_group -> selectGroup(0, addToGroupRequestCode) } return false } @@ -182,6 +184,13 @@ class ArrangeBookActivity : VMBaseActivity(R.layout.activi viewModel.updateBook(it.copy(group = groupId)) } } + addToGroupRequestCode -> { + val books = arrayListOf() + adapter.selectedBooks.forEach { + books.add(it.copy(group = it.group or groupId)) + } + viewModel.updateBook(*books.toTypedArray()) + } } } diff --git a/app/src/main/res/menu/arrange_book_sel.xml b/app/src/main/res/menu/arrange_book_sel.xml index a4a3dc50d..880569d40 100644 --- a/app/src/main/res/menu/arrange_book_sel.xml +++ b/app/src/main/res/menu/arrange_book_sel.xml @@ -1,6 +1,10 @@ + + @@ -10,7 +14,7 @@ android:title="@string/disable_update" /> + android:id="@+id/menu_add_to_group" + android:title="@string/add_to_group" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 61e09e2a7..9c055c8d5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -638,4 +638,5 @@ 靠左 居中 隐藏 + 加入分组