pull/32/head
kunfei 5 years ago
parent 0a179d3a58
commit 8882a0bdff
  1. 8
      app/src/main/java/io/legado/app/ui/booksource/GroupManageDialog.kt
  2. 8
      app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt

@ -64,7 +64,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
tool_bar.inflateMenu(R.menu.group_manage) tool_bar.inflateMenu(R.menu.group_manage)
tool_bar.menu.applyTint(requireContext(), false) tool_bar.menu.applyTint(requireContext(), false)
tool_bar.setOnMenuItemClickListener(this) tool_bar.setOnMenuItemClickListener(this)
adapter = GroupAdapter(requireContext(), this) adapter = GroupAdapter(requireContext())
recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.layoutManager = LinearLayoutManager(requireContext())
recycler_view.addItemDecoration( recycler_view.addItemDecoration(
DividerItemDecoration(requireContext(), RecyclerView.VERTICAL) DividerItemDecoration(requireContext(), RecyclerView.VERTICAL)
@ -129,14 +129,14 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
}.show().applyTint().requestInputMethod() }.show().applyTint().requestInputMethod()
} }
class GroupAdapter(context: Context, val dialog: GroupManageDialog) : private inner class GroupAdapter(context: Context) :
SimpleRecyclerAdapter<String>(context, R.layout.item_group_manage) { SimpleRecyclerAdapter<String>(context, R.layout.item_group_manage) {
override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) { override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) {
with(holder.itemView) { with(holder.itemView) {
tv_group.text = item tv_group.text = item
tv_edit.onClick { dialog.editGroup(item) } tv_edit.onClick { editGroup(item) }
tv_del.onClick { dialog.viewModel.delGroup(item) } tv_del.onClick { viewModel.delGroup(item) }
} }
} }
} }

@ -64,7 +64,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
tool_bar.inflateMenu(R.menu.group_manage) tool_bar.inflateMenu(R.menu.group_manage)
tool_bar.menu.applyTint(requireContext(), false) tool_bar.menu.applyTint(requireContext(), false)
tool_bar.setOnMenuItemClickListener(this) tool_bar.setOnMenuItemClickListener(this)
adapter = GroupAdapter(requireContext(), this) adapter = GroupAdapter(requireContext())
recycler_view.layoutManager = LinearLayoutManager(requireContext()) recycler_view.layoutManager = LinearLayoutManager(requireContext())
recycler_view.addItemDecoration( recycler_view.addItemDecoration(
DividerItemDecoration(requireContext(), RecyclerView.VERTICAL) DividerItemDecoration(requireContext(), RecyclerView.VERTICAL)
@ -129,14 +129,14 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
}.show().applyTint().requestInputMethod() }.show().applyTint().requestInputMethod()
} }
class GroupAdapter(context: Context, val dialog: GroupManageDialog) : private inner class GroupAdapter(context: Context) :
SimpleRecyclerAdapter<String>(context, R.layout.item_group_manage) { SimpleRecyclerAdapter<String>(context, R.layout.item_group_manage) {
override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) { override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) {
with(holder.itemView) { with(holder.itemView) {
tv_group.text = item tv_group.text = item
tv_edit.onClick { dialog.editGroup(item) } tv_edit.onClick { editGroup(item) }
tv_del.onClick { dialog.viewModel.delGroup(item) } tv_del.onClick { viewModel.delGroup(item) }
} }
} }
} }

Loading…
Cancel
Save