fix: adjust preference change handling in SettingsActivity
Corrected the preference change handling logic by fixing spacing issues and updating the use of `Snackbar` to target the correct view. Enhanced readability by addressing minor formatting inconsistencies. These changes improve code clarity and maintain correct functionality of encryption and backup service settings.
This commit is contained in:
parent
d7b6de13c8
commit
e056503626
1 changed files with 8 additions and 8 deletions
|
@ -164,12 +164,12 @@ public class SettingsActivity extends BackgroundTaskActivity<ChangeEncryptionTas
|
||||||
key.equals(getString(R.string.settings_key_theme_mode)) ||
|
key.equals(getString(R.string.settings_key_theme_mode)) ||
|
||||||
key.equals(getString(R.string.settings_key_theme_black_auto))) {
|
key.equals(getString(R.string.settings_key_theme_black_auto))) {
|
||||||
recreate();
|
recreate();
|
||||||
} else if(key.equals(getString(R.string.settings_key_encryption))) {
|
} else if (key.equals(getString(R.string.settings_key_encryption))) {
|
||||||
if (settings.getEncryption() != EncryptionType.PASSWORD) {
|
if (settings.getEncryption() != EncryptionType.PASSWORD) {
|
||||||
if (settings.getAndroidBackupServiceEnabled()) {
|
if (settings.getAndroidBackupServiceEnabled()) {
|
||||||
UIHelper.showGenericDialog(this,
|
UIHelper.showGenericDialog(this,
|
||||||
R.string.settings_dialog_title_android_sync,
|
R.string.settings_dialog_title_android_sync,
|
||||||
R.string.settings_dialog_msg_android_sync_disabled_encryption
|
R.string.settings_dialog_msg_android_sync_disabled_encryption
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,12 +182,12 @@ public class SettingsActivity extends BackgroundTaskActivity<ChangeEncryptionTas
|
||||||
if (fragment.useAndroidSync != null)
|
if (fragment.useAndroidSync != null)
|
||||||
fragment.useAndroidSync.setEnabled(true);
|
fragment.useAndroidSync.setEnabled(true);
|
||||||
}
|
}
|
||||||
} else if(key.equals(getString(R.string.settings_key_enable_android_backup_service))) {
|
} else if (key.equals(getString(R.string.settings_key_enable_android_backup_service))) {
|
||||||
Log.d(SettingsActivity.class.getSimpleName(), "onSharedPreferenceChanged called modifying settings_key_enable_android_backup_service service is now: " +
|
Log.d(SettingsActivity.class.getSimpleName(), "onSharedPreferenceChanged called modifying settings_key_enable_android_backup_service service is now: " +
|
||||||
(settings.getAndroidBackupServiceEnabled() ? "enabled" : "disabled"));
|
(settings.getAndroidBackupServiceEnabled() ? "enabled" : "disabled"));
|
||||||
|
|
||||||
int message = settings.getAndroidBackupServiceEnabled() ? R.string.settings_toast_android_sync_enabled : R.string.settings_toast_android_sync_disabled;
|
int message = settings.getAndroidBackupServiceEnabled() ? R.string.settings_toast_android_sync_enabled : R.string.settings_toast_android_sync_disabled;
|
||||||
Snackbar.make(fragment.getView(), message, BaseTransientBottomBar.LENGTH_SHORT).show();
|
Snackbar.make(findViewById(android.R.id.content), message, BaseTransientBottomBar.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment.updateAutoBackup();
|
fragment.updateAutoBackup();
|
||||||
|
@ -460,12 +460,12 @@ public class SettingsActivity extends BackgroundTaskActivity<ChangeEncryptionTas
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
useAutoBackup = (ListPreference)findPreference(getString(R.string.settings_key_auto_backup_password_enc));
|
useAutoBackup = (ListPreference) findPreference(getString(R.string.settings_key_auto_backup_password_enc));
|
||||||
updateAutoBackup();
|
updateAutoBackup();
|
||||||
|
|
||||||
useAndroidSync = (CheckBoxPreference) findPreference(getString(R.string.settings_key_enable_android_backup_service));
|
useAndroidSync = (CheckBoxPreference) findPreference(getString(R.string.settings_key_enable_android_backup_service));
|
||||||
useAndroidSync.setEnabled(settings.getEncryption() == EncryptionType.PASSWORD);
|
useAndroidSync.setEnabled(settings.getEncryption() == EncryptionType.PASSWORD);
|
||||||
if(!useAndroidSync.isEnabled())
|
if (!useAndroidSync.isEnabled())
|
||||||
useAndroidSync.setChecked(false);
|
useAndroidSync.setChecked(false);
|
||||||
|
|
||||||
if (sharedPref.contains(getString(R.string.settings_key_special_features)) &&
|
if (sharedPref.contains(getString(R.string.settings_key_special_features)) &&
|
||||||
|
@ -497,7 +497,7 @@ public class SettingsActivity extends BackgroundTaskActivity<ChangeEncryptionTas
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Remove Theme Mode selection option for devices below Android 10. Disable theme selection if Theme Mode is set auto
|
// Remove Theme Mode selection option for devices below Android 10. Disable theme selection if Theme Mode is set auto
|
||||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||||
catUI.removePreference(themeMode);
|
catUI.removePreference(themeMode);
|
||||||
catUI.removePreference(themeBlack);
|
catUI.removePreference(themeBlack);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue