From db178b64cbf4ee551073ee9f6aae15b82d1feab2 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 3 Sep 2021 17:10:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/help/storage/AppWebDav.kt | 2 +- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt b/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt index 795a89a55..f4a05a00d 100644 --- a/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt +++ b/app/src/main/java/io/legado/app/help/storage/AppWebDav.kt @@ -38,7 +38,7 @@ object AppWebDav { return url } - private suspend fun initWebDav(): Boolean { + suspend fun initWebDav(): Boolean { val account = appCtx.getPrefString(PreferKey.webDavAccount) val password = appCtx.getPrefString(PreferKey.webDavPassword) if (!account.isNullOrBlank() && !password.isNullOrBlank()) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 5669a5413..7533bf777 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -51,11 +51,8 @@ import io.legado.app.ui.replace.ReplaceRuleActivity import io.legado.app.ui.replace.edit.ReplaceEditActivity import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.utils.* +import kotlinx.coroutines.* import kotlinx.coroutines.Dispatchers.IO -import kotlinx.coroutines.Job -import kotlinx.coroutines.delay -import kotlinx.coroutines.isActive -import kotlinx.coroutines.launch class ReadBookActivity : ReadBookBaseActivity(), View.OnTouchListener, @@ -210,6 +207,10 @@ class ReadBookActivity : ReadBookBaseActivity(), } } } + launch { + menu.findItem(R.id.menu_get_progress)?.isVisible = + withContext(IO) { AppWebDav.initWebDav() } + } } }