修改书籍被删除时逻辑

old
zlj 5 years ago
parent 10ad6bcd46
commit 241776fbcb
  1. 3
      app/src/main/java/com/novel/read/activity/NovelReadActivity.kt
  2. 11
      app/src/main/java/com/novel/read/fragment/BookFragment.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() {

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

Loading…
Cancel
Save