diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt index 132b3147..a48deb23 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt @@ -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)!! diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt index 7981fed0..e1de8f1f 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsViewModel.kt @@ -80,7 +80,7 @@ internal class SettingsViewModel( override val isRestoreOperation = false - private val isBackupRunning: StateFlow + val isBackupRunning: StateFlow private val mBackupPossible = MutableLiveData(false) val backupPossible: LiveData = mBackupPossible