feat: 优化代码

pull/123/head
kunfei 5 years ago
parent f461806b0d
commit f1caa4abb1
  1. 14
      app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt

@ -78,9 +78,7 @@ object BackupRestoreUi {
}
fun selectBackupFolder(fragment: Fragment, requestCode: Int = selectFolderRequestCode) {
FilePicker.selectFolder(fragment, requestCode) {
backupUsePermission(fragment, requestCode = requestCode)
}
FilePicker.selectFolder(fragment, requestCode)
}
fun restore(fragment: Fragment) {
@ -97,13 +95,13 @@ object BackupRestoreUi {
Restore.restore(fragment.requireContext(), backupPath)
fragment.toast(R.string.restore_success)
} else {
selectRestoreFolder(fragment)
selectBackupFolder(fragment, restoreSelectRequestCode)
}
} else {
restoreUsePermission(fragment, backupPath)
}
} else {
selectRestoreFolder(fragment)
selectBackupFolder(fragment, restoreSelectRequestCode)
}
}
}
@ -124,12 +122,6 @@ object BackupRestoreUi {
.request()
}
private fun selectRestoreFolder(fragment: Fragment) {
FilePicker.selectFolder(fragment, restoreSelectRequestCode) {
restoreUsePermission(fragment)
}
}
fun importOldData(fragment: Fragment) {
FilePicker.selectFolder(fragment, oldDataRequestCode) {
importOldUsePermission(fragment)

Loading…
Cancel
Save