From 241776fbcbf87e365caad9858b944a14a1b2f08e Mon Sep 17 00:00:00 2001 From: zlj <390057892@qq.com> Date: Mon, 2 Dec 2019 16:20:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B9=A6=E7=B1=8D=E8=A2=AB?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/novel/read/activity/NovelReadActivity.kt | 3 ++- .../main/java/com/novel/read/fragment/BookFragment.kt | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt b/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt index ecaef6b..d4f2504 100644 --- a/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt +++ b/app/src/main/java/com/novel/read/activity/NovelReadActivity.kt @@ -80,7 +80,7 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene private val isRegistered = false private lateinit var mCollBook: CollBookBean - private var mBookId: String = "" + private lateinit var mBookId: String @SuppressLint("HandlerLeak") private val mHandler = object : Handler() { @@ -174,6 +174,7 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene } else { AccountManager.getInstance().getBookArticle(mBookId, "2", "1", "10000") } + } override fun initData() { diff --git a/app/src/main/java/com/novel/read/fragment/BookFragment.kt b/app/src/main/java/com/novel/read/fragment/BookFragment.kt index 5650b13..5c78b91 100644 --- a/app/src/main/java/com/novel/read/fragment/BookFragment.kt +++ b/app/src/main/java/com/novel/read/fragment/BookFragment.kt @@ -128,11 +128,12 @@ class BookFragment : NovelBaseFragment() { tv_delete.setOnClickListener { val deleteList = mAdapter.selectList - for (i in deleteList.indices) { - if (deleteList[i].isSaved) { - val count = deleteList[i].delete() - LitePal.deleteAll(BookRecordBean::class.java, "bookId=?", mList[i].id) - Log.e("count", "setOnClick: $count") + val iterator = deleteList.iterator() + while (iterator.hasNext()) { + val collBookBean = iterator.next() + if (collBookBean.isSaved) { + collBookBean.delete() + LitePal.deleteAll(BookRecordBean::class.java, "bookId=?", collBookBean.id) } } activity!!.showToast(getString(R.string.delete_success))