From 8dc9dd888e1e1252fe422341720f7e45f05954cd Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 30 Jul 2022 21:42:07 +0200 Subject: Remove storage error activity We fall back to the internal memory silently, so these code paths are never actually called. --- app/src/main/AndroidManifest.xml | 2 - .../danoeh/antennapod/activity/MainActivity.java | 3 - .../activity/OnlineFeedViewActivity.java | 2 - .../antennapod/activity/StorageErrorActivity.java | 79 ---------------------- .../antennapod/activity/VideoplayerActivity.java | 3 - .../config/ApplicationCallbacksImpl.java | 9 --- .../antennapod/dialog/ChooseDataFolderDialog.java | 11 +-- app/src/main/res/layout/storage_error.xml | 33 --------- 8 files changed, 2 insertions(+), 140 deletions(-) delete mode 100644 app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java delete mode 100644 app/src/main/res/layout/storage_error.xml (limited to 'app') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 93f1494f2..50ed82646 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -158,8 +158,6 @@ android:resource="@xml/player_widget_info"/> - - - ChooseDataFolderDialog.showDialog(this, path -> { - UserPreferences.setDataFolder(path); - leaveErrorState(); - })); - } - - @Override - protected void onResume() { - super.onResume(); - if (StorageUtils.storageAvailable()) { - leaveErrorState(); - } else { - registerReceiver(mediaUpdate, new IntentFilter(Intent.ACTION_MEDIA_MOUNTED)); - } - } - - @Override - protected void onPause() { - super.onPause(); - try { - unregisterReceiver(mediaUpdate); - } catch (IllegalArgumentException e) { - Log.e(TAG, Log.getStackTraceString(e)); - } - } - - private void leaveErrorState() { - finish(); - startActivity(new Intent(this, MainActivity.class)); - } - - private final BroadcastReceiver mediaUpdate = new BroadcastReceiver() { - - @Override - public void onReceive(Context context, Intent intent) { - if (TextUtils.equals(intent.getAction(), Intent.ACTION_MEDIA_MOUNTED)) { - if (intent.getBooleanExtra("read-only", true)) { - Log.d(TAG, "Media was mounted; Finishing activity"); - leaveErrorState(); - } else { - Log.d(TAG, "Media seemed to have been mounted read only"); - } - } - } - - }; - -} diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index 9ffade1ca..048d04939 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -50,7 +50,6 @@ import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.ShareUtils; -import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.core.util.gui.PictureInPictureUtil; import de.danoeh.antennapod.core.util.playback.PlaybackController; @@ -107,7 +106,6 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. super.onCreate(savedInstanceState); Log.d(TAG, "onCreate()"); - StorageUtils.checkStorageAvailability(this); getWindow().setFormat(PixelFormat.TRANSPARENT); viewBinding = VideoplayerActivityBinding.inflate(LayoutInflater.from(this)); @@ -120,7 +118,6 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. @Override protected void onResume() { super.onResume(); - StorageUtils.checkStorageAvailability(this); switchToAudioOnly = false; if (PlaybackService.isCasting()) { Intent intent = PlaybackService.getPlayerActivityIntent(this); diff --git a/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java index 008aacfa5..e9dfd66e0 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/ApplicationCallbacksImpl.java @@ -2,11 +2,8 @@ package de.danoeh.antennapod.config; import android.app.Application; -import android.content.Context; -import android.content.Intent; import de.danoeh.antennapod.PodcastApp; -import de.danoeh.antennapod.activity.StorageErrorActivity; import de.danoeh.antennapod.core.ApplicationCallbacks; public class ApplicationCallbacksImpl implements ApplicationCallbacks { @@ -15,10 +12,4 @@ public class ApplicationCallbacksImpl implements ApplicationCallbacks { public Application getApplicationInstance() { return PodcastApp.getInstance(); } - - @Override - public Intent getStorageErrorActivity(Context context) { - return new Intent(context, StorageErrorActivity.class); - } - } diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java index 2c375f5cd..fc34292cf 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java @@ -29,15 +29,8 @@ public class ChooseDataFolderDialog { }); ((RecyclerView) content.findViewById(R.id.recyclerView)).setAdapter(adapter); - if (adapter.getItemCount() > 0) { + if (adapter.getItemCount() != 0) { dialog.show(); - } else { - new AlertDialog.Builder(context) - .setTitle(R.string.error_label) - .setMessage(R.string.external_storage_error_msg) - .setPositiveButton(android.R.string.ok, null) - .show(); } } - -} \ No newline at end of file +} diff --git a/app/src/main/res/layout/storage_error.xml b/app/src/main/res/layout/storage_error.xml deleted file mode 100644 index 6a7fda341..000000000 --- a/app/src/main/res/layout/storage_error.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - -