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))