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,9 +91,15 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
backupLocation = findPreference("backup_location")!!
|
backupLocation = findPreference("backup_location")!!
|
||||||
backupLocation.setOnPreferenceClickListener {
|
backupLocation.setOnPreferenceClickListener {
|
||||||
|
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()
|
viewModel.chooseBackupLocation()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
autoRestore = findPreference(PREF_KEY_AUTO_RESTORE)!!
|
autoRestore = findPreference(PREF_KEY_AUTO_RESTORE)!!
|
||||||
autoRestore.onPreferenceChangeListener = OnPreferenceChangeListener { _, newValue ->
|
autoRestore.onPreferenceChangeListener = OnPreferenceChangeListener { _, newValue ->
|
||||||
|
|
|
@ -80,7 +80,7 @@ internal class SettingsViewModel(
|
||||||
|
|
||||||
override val isRestoreOperation = false
|
override val isRestoreOperation = false
|
||||||
|
|
||||||
private val isBackupRunning: StateFlow<Boolean>
|
val isBackupRunning: StateFlow<Boolean>
|
||||||
private val mBackupPossible = MutableLiveData(false)
|
private val mBackupPossible = MutableLiveData(false)
|
||||||
val backupPossible: LiveData<Boolean> = mBackupPossible
|
val backupPossible: LiveData<Boolean> = mBackupPossible
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue