Don't allow changing backup location while backup is running
This commit is contained in:
parent
0e4c37e796
commit
a4cccabc5e
2 changed files with 9 additions and 3 deletions
|
@ -91,8 +91,14 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
|
||||
backupLocation = findPreference("backup_location")!!
|
||||
backupLocation.setOnPreferenceClickListener {
|
||||
viewModel.chooseBackupLocation()
|
||||
true
|
||||
if (viewModel.isBackupRunning.value) {
|
||||
// don't allow changing backup destination while backup is running
|
||||
// TODO we could show toast or snackbar here
|
||||
false
|
||||
} else {
|
||||
viewModel.chooseBackupLocation()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
autoRestore = findPreference(PREF_KEY_AUTO_RESTORE)!!
|
||||
|
|
|
@ -80,7 +80,7 @@ internal class SettingsViewModel(
|
|||
|
||||
override val isRestoreOperation = false
|
||||
|
||||
private val isBackupRunning: StateFlow<Boolean>
|
||||
val isBackupRunning: StateFlow<Boolean>
|
||||
private val mBackupPossible = MutableLiveData(false)
|
||||
val backupPossible: LiveData<Boolean> = mBackupPossible
|
||||
|
||||
|
|
Loading…
Reference in a new issue