From 3e7069af3a16c5448660ddb7a0b68eb20d76784c Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 18 Nov 2021 18:48:24 +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 --- .../java/io/legado/app/help/storage/Backup.kt | 4 +++- .../app/ui/config/BackupConfigFragment.kt | 17 +++++++++++------ app/src/main/res/values-es-rES/strings.xml | 4 ++-- app/src/main/res/values-ja-rJP/strings.xml | 4 ++-- app/src/main/res/values-pt-rBR/strings.xml | 4 ++-- app/src/main/res/values-zh-rHK/strings.xml | 2 +- app/src/main/res/values-zh-rTW/strings.xml | 4 ++-- app/src/main/res/values-zh/strings.xml | 4 ++-- app/src/main/res/values/strings.xml | 4 ++-- 9 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/storage/Backup.kt b/app/src/main/java/io/legado/app/help/storage/Backup.kt index 631684dab..85e7b23b6 100644 --- a/app/src/main/java/io/legado/app/help/storage/Backup.kt +++ b/app/src/main/java/io/legado/app/help/storage/Backup.kt @@ -4,6 +4,7 @@ import android.content.Context import android.net.Uri import androidx.documentfile.provider.DocumentFile import io.legado.app.R +import io.legado.app.constant.AppLog import io.legado.app.constant.PreferKey import io.legado.app.data.appDb import io.legado.app.help.DefaultData @@ -51,7 +52,8 @@ object Backup { Coroutine.async { backup(context, context.getPrefString(PreferKey.backupPath) ?: "", true) }.onError { - appCtx.toastOnUi(R.string.autobackup_fail) + AppLog.put("备份出错\n${it.localizedMessage}", it) + appCtx.toastOnUi(appCtx.getString(R.string.autobackup_fail, it.localizedMessage)) } } } diff --git a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt index 77e842228..7180fb0df 100644 --- a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt @@ -15,6 +15,7 @@ import androidx.preference.ListPreference import androidx.preference.Preference import io.legado.app.R import io.legado.app.base.BasePreferenceFragment +import io.legado.app.constant.AppLog import io.legado.app.constant.PreferKey import io.legado.app.help.AppConfig import io.legado.app.help.LocalConfig @@ -47,8 +48,8 @@ class BackupConfigFragment : BasePreferenceFragment(), } } } - private val backupDir = registerForActivityResult(HandleFileContract()) { - it.uri?.let { uri -> + private val backupDir = registerForActivityResult(HandleFileContract()) { result -> + result.uri?.let { uri -> if (uri.isContentScheme()) { AppConfig.backupPath = uri.toString() Coroutine.async { @@ -56,7 +57,8 @@ class BackupConfigFragment : BasePreferenceFragment(), }.onSuccess { appCtx.toastOnUi(R.string.backup_success) }.onError { - appCtx.toastOnUi(R.string.backup_fail) + AppLog.put("备份出错\n${it.localizedMessage}", it) + appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) } } else { uri.path?.let { path -> @@ -66,7 +68,8 @@ class BackupConfigFragment : BasePreferenceFragment(), }.onSuccess { appCtx.toastOnUi(R.string.backup_success) }.onError { - appCtx.toastOnUi(R.string.backup_fail) + AppLog.put("备份出错\n${it.localizedMessage}", it) + appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) } } } @@ -242,7 +245,8 @@ class BackupConfigFragment : BasePreferenceFragment(), }.onSuccess { appCtx.toastOnUi(R.string.backup_success) }.onError { - appCtx.toastOnUi(R.string.backup_fail) + AppLog.put("备份出错\n${it.localizedMessage}", it) + appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) } } else { backupDir.launch(null) @@ -264,7 +268,8 @@ class BackupConfigFragment : BasePreferenceFragment(), }.onSuccess { appCtx.toastOnUi(R.string.backup_success) }.onError { - appCtx.toastOnUi(R.string.backup_fail) + AppLog.put("备份出错\n${it.localizedMessage}", it) + appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) } } .request() diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 0173019c5..892a59490 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -114,7 +114,7 @@ Confirmar restauración La restauración de los datos de la estantería reemplazará a los datos de la actual. Respaldo completado - Error de respaldo + Error de respaldo\n%s Restaurando Restauración completada Restauración fallida @@ -857,7 +857,7 @@ La fuente del libro de cheques muestra un mensaje de depuración Muestra los pasos y el tiempo de la solicitud de red durante la verificación de la fuente del libro No export chapter names - Autobackup failed + Autobackup failed\n%s Background image blurring Blurring radius Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index cdc494ae4..b308ada13 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -118,7 +118,7 @@ Restore confirmation Restoring the bookshelf data will overwrite the current Bookshelf. Backup succeed - Backup failed + Backup failed\n%s Restoring Restore succeed Backup failed @@ -861,7 +861,7 @@ 及时翻页,翻页时会停顿一下 Check book source shows debug message Show network status and timestamp during source checking - Autobackup failed + Autobackup failed\n%s Background image blurring Blurring radius Disabled when 0, enable range from 1 to 25\nThe greater the radius, the stronger the effect of blurring diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index e8c7e94d1..5326f806e 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -118,7 +118,7 @@ Confirmação da Restauração A restauração dos dados da estante irá substituir a estante atual. Backup bem sucedido - O Backup falhou + O Backup falhou\n%s Restaurando Restauração bem sucedida A restauração falhou @@ -861,7 +861,7 @@ Marcando a fonte do livro mostra uma mensagem de depuração Mostrar o status da rede com a data e hora durante a verificação da fonte Não há nomes de capítulos de exportação - Auto-Backup falhou + Auto-Backup falhou\n%s Desfocagem da imagem de fundo Raio da desfocagem Desativado quando 0, Ativado entre 1 e 25\n Quanto maior o raio, mais forte o efeito de desfocagem diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index d8aeaec16..b36e44594 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -115,7 +115,7 @@ 確認還原嗎? 還原成功會覆蓋原有書架。 備份成功 - 備份失敗 + 備份失敗\n%s 正在還原 還原成功 還原失敗 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index bed8ce857..46dcab31e 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -117,7 +117,7 @@ 確認復原嗎? 復原書架會覆蓋現有書架。 備份成功 - 備份失敗 + 備份失敗\n%s 正在復原 復原成功 復原失敗 @@ -856,7 +856,7 @@ url為空 字典 未知錯誤 - 自動備份失敗 + 自動備份失敗\n%s 結束 關閉取代分組/開啟添加分組 媒體按鈕•上一首|下一首 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 8f2b322a3..3628cd445 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -117,7 +117,7 @@ 确认恢复吗? 恢复书架会覆盖现有书架。 备份成功 - 备份失败 + 备份失败\n%s 正在恢复 恢复成功 恢复失败 @@ -856,7 +856,7 @@ url为空 字典 未知错误 - 自动备份失败 + 自动备份失败\n%s 结束 关闭替换分组/开启添加分组 媒体按钮•上一首|下一首 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 608d691a2..eb6208c7c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -118,7 +118,7 @@ Restore confirmation Restoring the bookshelf data will overwrite the current Bookshelf. Backup succeed - Backup failed + Backup failed\n%s Restoring Restore succeed Backup failed @@ -858,7 +858,7 @@ dict unknown error No export chapter names - Autobackup failed + Autobackup failed\n%s end 关闭替换分组/开启添加分组 媒体按钮•上一首|下一首