From 8bfe9a3f76e15cf06c64d26e8d01098d8f2e5e16 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 31 Mar 2025 15:12:44 +0200 Subject: [PATCH] fix rotation in import backup screen --- .../conversations/ui/ImportBackupActivity.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/ImportBackupActivity.java b/src/main/java/eu/siacs/conversations/ui/ImportBackupActivity.java index 3a81fcd0a4921c4d55f97e71e47c0df07c209d41..3be499904e12bebe32d911a1b215e151ae767673 100644 --- a/src/main/java/eu/siacs/conversations/ui/ImportBackupActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ImportBackupActivity.java @@ -54,6 +54,7 @@ public class ImportBackupActivity extends ActionBarActivity private BackupFileAdapter backupFileAdapter; private LiveData inProgressImport; + private Uri currentRestoreDialog; private UUID currentWorkRequest; private final ActivityResultLauncher requestPermissions = @@ -92,12 +93,19 @@ public class ImportBackupActivity extends ActionBarActivity if (currentWorkRequest != null) { this.currentWorkRequest = UUID.fromString(currentWorkRequest); } + final var currentRestoreDialog = savedInstanceState.getString("current-restore-dialog"); + if (currentRestoreDialog != null) { + this.currentRestoreDialog = Uri.parse(currentRestoreDialog); + } } monitorWorkRequest(this.currentWorkRequest); this.backupFileAdapter = new BackupFileAdapter(); this.binding.list.setAdapter(this.backupFileAdapter); this.backupFileAdapter.setOnItemClickedListener(this); + if (this.currentRestoreDialog != null) { + openBackupFileFromUri(this.currentRestoreDialog, false); + } } @Override @@ -115,6 +123,9 @@ public class ImportBackupActivity extends ActionBarActivity if (this.currentWorkRequest != null) { bundle.putString("current-work-request", this.currentWorkRequest.toString()); } + if (this.currentRestoreDialog != null) { + bundle.putString("current-restore-dialog", this.currentRestoreDialog.toString()); + } super.onSaveInstanceState(bundle); } @@ -251,6 +262,7 @@ public class ImportBackupActivity extends ActionBarActivity private void showEnterPasswordDialog( final BackupFile backupFile, final boolean finishOnCancel) { + this.currentRestoreDialog = backupFile.getUri(); final DialogEnterPasswordBinding enterPasswordBinding = DataBindingUtil.inflate( LayoutInflater.from(this), R.layout.dialog_enter_password, null, false); @@ -265,6 +277,7 @@ public class ImportBackupActivity extends ActionBarActivity builder.setNegativeButton( R.string.cancel, (dialog, which) -> { + this.currentRestoreDialog = null; if (finishOnCancel) { finish(); }