From 4ad73a9a80c1bf5239d89aa6bcfe41d1419e0533 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 3 Nov 2020 12:25:49 +0800 Subject: [PATCH 1/2] update log --- .../java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt index 8b309e870..779b73d8f 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivityHelp.kt @@ -4,7 +4,6 @@ import android.annotation.SuppressLint import android.app.Activity import android.content.Context import android.content.pm.ActivityInfo -import android.os.AsyncTask import android.os.Build import android.view.LayoutInflater import android.view.View @@ -17,6 +16,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.data.entities.Bookmark import io.legado.app.help.AppConfig import io.legado.app.help.ReadBookConfig +import io.legado.app.help.coroutine.Coroutine import io.legado.app.lib.dialogs.* import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ThemeStore @@ -149,7 +149,7 @@ object ReadBookActivityHelp { } yesButton { editText?.text?.toString()?.let { editContent -> - AsyncTask.execute { + Coroutine.async { val bookmark = Bookmark( bookUrl = book.bookUrl, bookName = book.name, From 91be3bbb0373d111933a07e6371678f2f6681d32 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 3 Nov 2020 12:29:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/book/local/ImportBookAdapter.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt index 6f61c6a5e..f19855e6c 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookAdapter.kt @@ -15,11 +15,11 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : SimpleRecyclerAdapter(context, R.layout.item_import_book) { var selectedUris = hashSetOf() var checkableCount = 0 - private var bookshelf = arrayListOf() + private var bookPaths = arrayListOf() fun upBookHas(uriList: List) { - bookshelf.clear() - bookshelf.addAll(uriList) + bookPaths.clear() + bookPaths.addAll(uriList) notifyDataSetChanged() upCheckableCount() } @@ -32,7 +32,7 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : private fun upCheckableCount() { checkableCount = 0 getItems().forEach { - if (!it.isDir && !bookshelf.contains(it.uri.toString())) { + if (!it.isDir && !bookPaths.contains(it.uri.toString())) { checkableCount++ } } @@ -42,7 +42,7 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : fun selectAll(selectAll: Boolean) { if (selectAll) { getItems().forEach { - if (!it.isDir && !bookshelf.contains(it.uri.toString())) { + if (!it.isDir && !bookPaths.contains(it.uri.toString())) { selectedUris.add(it.uri.toString()) } } @@ -84,7 +84,8 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : ll_brief.gone() cb_select.isChecked = false } else { - if (bookshelf.contains(item.uri.toString())) { + val path = if (item.uri.isContentPath()) item.uri.toString() else item.uri.path + if (bookPaths.contains(path)) { iv_icon.setImageResource(R.drawable.ic_book_has) iv_icon.visible() cb_select.invisible() @@ -110,7 +111,7 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : getItem(holder.layoutPosition)?.let { if (it.isDir) { callBack.nextDoc(it.uri) - } else if (!bookshelf.contains(it.uri.toString())) { + } else if (!bookPaths.contains(it.uri.toString())) { if (!selectedUris.contains(it.uri.toString())) { selectedUris.add(it.uri.toString()) } else {