pull/298/head
gedoor 4 years ago
parent 9f6df2b27e
commit 512c458fbe
  1. 20
      app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt
  2. 1
      app/src/main/res/values-zh-rHK/strings.xml
  3. 1
      app/src/main/res/values-zh-rTW/strings.xml
  4. 1
      app/src/main/res/values-zh/strings.xml
  5. 1
      app/src/main/res/values/strings.xml

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

@ -731,4 +731,5 @@
<string name="e_ink_change_bg">E-Ink模式下只有白纸黑字,不显示其它背景</string>
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
</resources>

@ -731,5 +731,6 @@
<string name="e_ink_change_bg">E-Ink模式下只有白纸黑字,不显示其它背景</string>
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
</resources>

@ -731,4 +731,5 @@
<string name="e_ink_change_bg">E-Ink模式下只有白纸黑字,不显示其它背景</string>
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
</resources>

@ -732,5 +732,6 @@
<string name="e_ink_change_bg">E-Ink模式下只有白纸黑字,不显示其它背景</string>
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>
</resources>
Loading…
Cancel
Save