diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-08-09 19:14:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-09 19:14:07 +0200 |
commit | 94c5b8aea5180dacfa81e2e7aa91a861255d148b (patch) | |
tree | 294d8207f4882c2542e6c7efc1e058175583b9d0 | |
parent | f7faf3c8c3fd1164ab0c6613aa895b1d50d7a7fb (diff) | |
download | AntennaPod-94c5b8aea5180dacfa81e2e7aa91a861255d148b.zip |
Catch people disabling system file manager (#7319)
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ImportExportPreferencesFragment.java | 21 |
1 files changed, 16 insertions, 5 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 5ffa7e57a..81da9c1ae 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 @@ -137,7 +137,8 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { try { chooseOpmlImportPathLauncher.launch("*/*"); } catch (ActivityNotFoundException e) { - Log.e(TAG, "No activity found. Should never happen..."); + Snackbar.make(getView(), R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG) + .show(); } return true; }); @@ -148,7 +149,12 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { }); findPreference(PREF_DATABASE_EXPORT).setOnPreferenceClickListener( preference -> { - backupDatabaseLauncher.launch(dateStampFilename(DATABASE_EXPORT_FILENAME)); + try { + backupDatabaseLauncher.launch(dateStampFilename(DATABASE_EXPORT_FILENAME)); + } catch (ActivityNotFoundException e) { + Snackbar.make(getView(), R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG) + .show(); + } return true; }); ((SwitchPreferenceCompat) findPreference(PREF_AUTOMATIC_DATABASE_EXPORT)) @@ -159,7 +165,6 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { try { automaticBackupLauncher.launch(null); } catch (ActivityNotFoundException e) { - e.printStackTrace(); Snackbar.make(getView(), R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG) .show(); } @@ -192,7 +197,12 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("*/*"); - restoreDatabaseLauncher.launch(intent); + try { + restoreDatabaseLauncher.launch(intent); + } catch (ActivityNotFoundException e) { + Snackbar.make(getView(), R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG) + .show(); + } }); // create and show the alert dialog @@ -271,7 +281,8 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat { result.launch(intentPickAction); return; } catch (ActivityNotFoundException e) { - Log.e(TAG, "No activity found. Should never happen..."); + Snackbar.make(getView(), R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG) + .show(); } // If we are using a SDK lower than API 21 or the implicit intent failed |