From 61345f3b676624402668e18ff41529cdb249f2b0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 6 Jan 2020 21:57:45 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/config/WebDavConfigFragment.kt | 12 ++++++------ .../main/java/io/legado/app/ui/main/MainActivity.kt | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt index 0f70be7ef..b269f7a95 100644 --- a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt @@ -124,9 +124,7 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), private fun backup() { val backupPath = getPrefString(PreferKey.backupPath) - if (backupPath?.isEmpty() == true) { - selectBackupFolder() - } else { + if (backupPath?.isNotEmpty() == true) { val uri = Uri.parse(backupPath) val doc = DocumentFile.fromTreeUri(requireContext(), uri) if (doc?.canWrite() == true) { @@ -136,6 +134,8 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), } else { selectBackupFolder() } + } else { + selectBackupFolder() } } @@ -161,9 +161,7 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), launch { if (!WebDavHelp.showRestoreDialog(requireContext())) { val backupPath = getPrefString(PreferKey.backupPath) - if (backupPath?.isEmpty() == true) { - selectRestoreFolder() - } else { + if (backupPath?.isNotEmpty() == true) { val uri = Uri.parse(backupPath) val doc = DocumentFile.fromTreeUri(requireContext(), uri) if (doc?.canWrite() == true) { @@ -172,6 +170,8 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), } else { selectBackupFolder() } + } else { + selectRestoreFolder() } } } diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index c37e93149..80db372ca 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -155,9 +155,7 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), fun backup() { val backupPath = getPrefString(PreferKey.backupPath) - if (backupPath?.isEmpty() == true) { - selectBackupFolder() - } else { + if (backupPath?.isNotEmpty() == true) { val uri = Uri.parse(backupPath) val doc = DocumentFile.fromTreeUri(this, uri) if (doc?.canWrite() == true) { @@ -167,6 +165,8 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), } else { selectBackupFolder() } + } else { + selectBackupFolder() } } @@ -174,9 +174,7 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), launch { if (!WebDavHelp.showRestoreDialog(this@MainActivity)) { val backupPath = getPrefString(PreferKey.backupPath) - if (backupPath?.isEmpty() == true) { - selectRestoreFolder() - } else { + if (backupPath?.isNotEmpty() == true) { val uri = Uri.parse(backupPath) val doc = DocumentFile.fromTreeUri(this@MainActivity, uri) if (doc?.canWrite() == true) { @@ -185,6 +183,8 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), } else { selectBackupFolder() } + } else { + selectRestoreFolder() } } }