From e41536783edab8145e9882dfbf3647e93707c509 Mon Sep 17 00:00:00 2001 From: cos Date: Fri, 5 Jul 2024 09:41:53 +0200 Subject: Fix import failure, should not say "export" --- .../preferences/ImportExportPreferencesFragment.java | 18 +++++++++++++++--- ui/i18n/src/main/res/values/strings.xml | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ImportExportPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ImportExportPreferencesFragment.java index 81da9c1ae..451dc0c1c 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ImportExportPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ImportExportPreferencesFragment.java @@ -229,15 +229,27 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { .show(); } - private void showExportErrorDialog(final Throwable error) { + private void showImportExportErrorDialog(final Throwable error, boolean isImport) { progressDialog.dismiss(); final MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext()); alert.setPositiveButton(android.R.string.ok, (dialog, which) -> dialog.dismiss()); - alert.setTitle(R.string.export_error_label); + if (isImport) { + alert.setTitle(R.string.import_error_label); + } else { + alert.setTitle(R.string.export_error_label); + } alert.setMessage(error.getMessage()); alert.show(); } + private void showExportErrorDialog(final Throwable error) { + showImportExportErrorDialog(error, false); + } + + private void showImportErrorDialog(final Throwable error) { + showImportExportErrorDialog(error, true); + } + private void restoreDatabaseResult(final ActivityResult result) { if (result.getResultCode() != Activity.RESULT_OK || result.getData() == null) { return; @@ -250,7 +262,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { .subscribe(() -> { showDatabaseImportSuccessDialog(); progressDialog.dismiss(); - }, this::showExportErrorDialog); + }, this::showImportErrorDialog); } private void backupDatabaseResult(final Uri uri) { diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index 924421df8..ae6b3b743 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -601,6 +601,7 @@ Importing a database will replace all of your current subscriptions and playing history. You should export your current database as a backup. Do you want to replace? Please wait… Export error + Import error Export successful Access to external storage is required to read the OPML file Import successful -- cgit v1.2.3