|
|
@ -123,7 +123,7 @@ class BackupConfigFragment : BasePreferenceFragment(), |
|
|
|
upPreferenceSummary(PreferKey.webDavPassword, getPrefString(PreferKey.webDavPassword)) |
|
|
|
upPreferenceSummary(PreferKey.webDavPassword, getPrefString(PreferKey.webDavPassword)) |
|
|
|
upPreferenceSummary(PreferKey.backupPath, getPrefString(PreferKey.backupPath)) |
|
|
|
upPreferenceSummary(PreferKey.backupPath, getPrefString(PreferKey.backupPath)) |
|
|
|
findPreference<io.legado.app.ui.widget.prefs.Preference>("web_dav_restore") |
|
|
|
findPreference<io.legado.app.ui.widget.prefs.Preference>("web_dav_restore") |
|
|
|
?.onLongClick = { restoreDir.launch(null) } |
|
|
|
?.onLongClick = { restoreDir.launch() } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
@ -206,11 +206,11 @@ class BackupConfigFragment : BasePreferenceFragment(), |
|
|
|
|
|
|
|
|
|
|
|
override fun onPreferenceTreeClick(preference: Preference?): Boolean { |
|
|
|
override fun onPreferenceTreeClick(preference: Preference?): Boolean { |
|
|
|
when (preference?.key) { |
|
|
|
when (preference?.key) { |
|
|
|
PreferKey.backupPath -> selectBackupPath.launch(null) |
|
|
|
PreferKey.backupPath -> selectBackupPath.launch() |
|
|
|
PreferKey.restoreIgnore -> restoreIgnore() |
|
|
|
PreferKey.restoreIgnore -> restoreIgnore() |
|
|
|
"web_dav_backup" -> backup() |
|
|
|
"web_dav_backup" -> backup() |
|
|
|
"web_dav_restore" -> restore() |
|
|
|
"web_dav_restore" -> restore() |
|
|
|
"import_old" -> restoreOld.launch(null) |
|
|
|
"import_old" -> restoreOld.launch() |
|
|
|
} |
|
|
|
} |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
} |
|
|
|
} |
|
|
@ -234,7 +234,7 @@ class BackupConfigFragment : BasePreferenceFragment(), |
|
|
|
fun backup() { |
|
|
|
fun backup() { |
|
|
|
val backupPath = AppConfig.backupPath |
|
|
|
val backupPath = AppConfig.backupPath |
|
|
|
if (backupPath.isNullOrEmpty()) { |
|
|
|
if (backupPath.isNullOrEmpty()) { |
|
|
|
backupDir.launch(null) |
|
|
|
backupDir.launch() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (backupPath.isContentScheme()) { |
|
|
|
if (backupPath.isContentScheme()) { |
|
|
|
val uri = Uri.parse(backupPath) |
|
|
|
val uri = Uri.parse(backupPath) |
|
|
@ -249,7 +249,7 @@ class BackupConfigFragment : BasePreferenceFragment(), |
|
|
|
appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) |
|
|
|
appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
backupDir.launch(null) |
|
|
|
backupDir.launch() |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
backupUsePermission(backupPath) |
|
|
|
backupUsePermission(backupPath) |
|
|
@ -301,13 +301,13 @@ class BackupConfigFragment : BasePreferenceFragment(), |
|
|
|
Restore.restore(requireContext(), backupPath) |
|
|
|
Restore.restore(requireContext(), backupPath) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
restoreDir.launch(null) |
|
|
|
restoreDir.launch() |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
restoreUsePermission(backupPath) |
|
|
|
restoreUsePermission(backupPath) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
restoreDir.launch(null) |
|
|
|
restoreDir.launch() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|