From 4de8ed935f7988d54cc727353be23981a9f52062 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 8 Sep 2019 13:40:56 +0800 Subject: [PATCH] up --- .../legado/app/ui/booksource/BookSourceAdapter.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt index 9b4261e4c..ac683d367 100644 --- a/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/booksource/BookSourceAdapter.kt @@ -75,11 +75,19 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) : cb_book_source.text = String.format("%s (%s)", item.bookSourceName, item.bookSourceGroup) } - cb_book_source.isChecked = item.enabled - cb_book_source.setOnClickListener { - item.enabled = cb_book_source.isChecked + swt_enabled.isChecked = item.enabled + swt_enabled.onClick { + item.enabled = swt_enabled.isChecked callBack.update(item) } + cb_book_source.isChecked = selectedIds.contains(item.bookSourceUrl) + cb_book_source.setOnClickListener { + if (cb_book_source.isChecked) { + selectedIds.add(item.bookSourceUrl) + } else { + selectedIds.remove(item.bookSourceUrl) + } + } iv_edit.onClick { callBack.edit(item) } iv_menu_more.onClick { val popupMenu = PopupMenu(context, it)