From 5e94254837334d32035ffa83c732a75336f2bd99 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 6 Sep 2020 22:54:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=88=86=E7=BB=84=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/group/GroupManageDialog.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt index d5efe8126..b3fb5674d 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt @@ -22,10 +22,7 @@ import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.data.entities.BookGroup import io.legado.app.help.AppConfig import io.legado.app.help.ItemTouchCallback -import io.legado.app.lib.dialogs.alert -import io.legado.app.lib.dialogs.customView -import io.legado.app.lib.dialogs.noButton -import io.legado.app.lib.dialogs.yesButton +import io.legado.app.lib.dialogs.* import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.primaryColor @@ -171,6 +168,15 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener }.show().applyTint().requestInputMethod() } + private fun deleteGroup(bookGroup: BookGroup) { + alert(R.string.delete, R.string.sure_del) { + okButton { + viewModel.delGroup(bookGroup) + } + noButton() + }.show().applyTint() + } + private class GroupDiffCallBack( private val oldItems: List, private val newItems: List @@ -212,7 +218,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener override fun registerListener(holder: ItemViewHolder) { holder.itemView.apply { tv_edit.onClick { getItem(holder.layoutPosition)?.let { editGroup(it) } } - tv_del.onClick { getItem(holder.layoutPosition)?.let { viewModel.delGroup(it) } } + tv_del.onClick { getItem(holder.layoutPosition)?.let { deleteGroup(it) } } } }