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() } + } } }