From 512c458fbeb9e005913b74813df0ed1ae7c42ff3 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 7 Aug 2020 21:54:59 +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 --- .../io/legado/app/help/storage/WebDavHelp.kt | 20 +++++++++++-------- app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt b/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt index ad4c93a2a..a7f2d7f2b 100644 --- a/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt +++ b/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt @@ -4,8 +4,10 @@ import android.content.Context import android.os.Handler import android.os.Looper import io.legado.app.App +import io.legado.app.R import io.legado.app.constant.PreferKey import io.legado.app.help.coroutine.Coroutine +import io.legado.app.lib.dialogs.selector import io.legado.app.lib.webdav.WebDav import io.legado.app.lib.webdav.http.HttpAuth import io.legado.app.utils.FileUtils @@ -15,7 +17,6 @@ import io.legado.app.utils.getPrefString import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.withContext -import org.jetbrains.anko.selector import org.jetbrains.anko.toast import java.io.File import java.text.SimpleDateFormat @@ -28,16 +29,16 @@ object WebDavHelp { val rootWebDavUrl: String get() { - var url = App.INSTANCE.getPrefString(PreferKey.webDavUrl) - if (url.isNullOrEmpty()) { - url = defaultWebDavUrl - } + var url = App.INSTANCE.getPrefString(PreferKey.webDavUrl) + if (url.isNullOrEmpty()) { + url = defaultWebDavUrl + } if (!url.endsWith("/")) url = "${url}/" if (App.INSTANCE.getPrefBoolean(PreferKey.webDavCreateDir, true)) { url = "${url}legado/" } - return url - } + return url + } fun initWebDav(): Boolean { val account = App.INSTANCE.getPrefString(PreferKey.webDavAccount) @@ -73,7 +74,10 @@ object WebDavHelp { val names = withContext(IO) { getWebDavFileNames() } return if (names.isNotEmpty()) { withContext(Main) { - context.selector(title = "选择恢复文件", items = names) { _, index -> + context.selector( + title = context.getString(R.string.select_restore_file), + items = names + ) { _, index -> if (index in 0 until names.size) { restoreWebDav(names[index], restoreSuccess) } diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 0f81aabf4..1a9cd53fc 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -731,4 +731,5 @@ E-Ink模式下只有白纸黑字,不显示其它背景 默认启用替换净化 新加入书架的书是否启用替换净化 + 选择恢复文件 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 214049b79..700d90727 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -731,5 +731,6 @@ E-Ink模式下只有白纸黑字,不显示其它背景 默认启用替换净化 新加入书架的书是否启用替换净化 + 选择恢复文件 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 197cd7633..3e168a76d 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -731,4 +731,5 @@ E-Ink模式下只有白纸黑字,不显示其它背景 默认启用替换净化 新加入书架的书是否启用替换净化 + 选择恢复文件 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 444710bf5..669ccb904 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -732,5 +732,6 @@ E-Ink模式下只有白纸黑字,不显示其它背景 默认启用替换净化 新加入书架的书是否启用替换净化 + 选择恢复文件 \ No newline at end of file