修复 Fragment not attached to Activity

pull/1295/head
gedoor 3 years ago
parent 543ce0c04e
commit da6f786e72
  1. 8
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt

@ -236,9 +236,9 @@ class BackupConfigFragment : BasePreferenceFragment(),
Coroutine.async {
Backup.backup(requireContext(), backupPath)
}.onSuccess {
activity?.toastOnUi(R.string.backup_success)
appCtx.toastOnUi(R.string.backup_success)
}.onError {
activity?.toastOnUi(R.string.backup_fail)
appCtx.toastOnUi(R.string.backup_fail)
}
} else {
backupDir.launch(null)
@ -258,9 +258,9 @@ class BackupConfigFragment : BasePreferenceFragment(),
AppConfig.backupPath = path
Backup.backup(requireContext(), path)
}.onSuccess {
activity?.toastOnUi(R.string.backup_success)
appCtx.toastOnUi(R.string.backup_success)
}.onError {
activity?.toastOnUi(R.string.backup_fail)
appCtx.toastOnUi(R.string.backup_fail)
}
}
.request()

Loading…
Cancel
Save