diff options
author | ByteHamster <info@bytehamster.com> | 2022-07-30 21:42:07 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-07-30 21:50:14 +0200 |
commit | 8dc9dd888e1e1252fe422341720f7e45f05954cd (patch) | |
tree | b4b135a5d678ff533366c63ae8d3e2fa97dd39c4 /app | |
parent | 4f2ba0b58eadcda69693025319e96cfee79b2ce7 (diff) | |
download | AntennaPod-8dc9dd888e1e1252fe422341720f7e45f05954cd.zip |
Remove storage error activity
We fall back to the internal memory silently, so these code paths are
never actually called.
Diffstat (limited to 'app')
8 files changed, 2 insertions, 140 deletions
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"/> </receiver> - <activity android:name=".activity.StorageErrorActivity"> - </activity> <activity android:name=".activity.OpmlImportActivity" android:configChanges="keyboardHidden|orientation|screenSize" diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 19b08fc02..fe5d8733a 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -50,7 +50,6 @@ import de.danoeh.antennapod.event.MessageEvent; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.service.playback.PlaybackService; -import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.dialog.RatingDialog; import de.danoeh.antennapod.fragment.AddFeedFragment; @@ -112,7 +111,6 @@ public class MainActivity extends CastEnabledActivity { ensureGeneratedViewIdGreaterThan(savedInstanceState.getInt(KEY_GENERATED_VIEW_ID, 0)); } super.onCreate(savedInstanceState); - StorageUtils.checkStorageAvailability(this); setContentView(R.layout.main); recycledViewPool.setMaxRecycledViews(R.id.view_type_episode_item, 25); @@ -414,7 +412,6 @@ public class MainActivity extends CastEnabledActivity { @Override protected void onResume() { super.onResume(); - StorageUtils.checkStorageAvailability(this); handleNavIntent(); RatingDialog.check(); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 3b28a5e27..67647b999 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -56,7 +56,6 @@ import de.danoeh.antennapod.parser.feed.FeedHandler; import de.danoeh.antennapod.parser.feed.FeedHandlerResult; import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.core.util.IntentUtils; -import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.core.util.URLChecker; import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer; import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText; @@ -122,7 +121,6 @@ public class OnlineFeedViewActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { setTheme(UserPreferences.getTranslucentTheme()); super.onCreate(savedInstanceState); - StorageUtils.checkStorageAvailability(this); viewBinding = OnlinefeedviewActivityBinding.inflate(getLayoutInflater()); setContentView(viewBinding.getRoot()); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java deleted file mode 100644 index 4947f478a..000000000 --- a/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java +++ /dev/null @@ -1,79 +0,0 @@ -package de.danoeh.antennapod.activity; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Bundle; -import android.text.TextUtils; -import android.util.Log; -import android.widget.Button; -import androidx.appcompat.app.AppCompatActivity; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.util.StorageUtils; -import de.danoeh.antennapod.dialog.ChooseDataFolderDialog; - -/** - * Is show if there is now external storage available. - */ -public class StorageErrorActivity extends AppCompatActivity { - private static final String TAG = "StorageErrorActivity"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(UserPreferences.getTheme()); - super.onCreate(savedInstanceState); - - setContentView(R.layout.storage_error); - - Button btnChooseDataFolder = findViewById(R.id.btnChooseDataFolder); - btnChooseDataFolder.setOnClickListener(v -> - 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:gravity="center" - android:padding="16dp"> - - <ImageView - android:id="@+id/imageView1" - android:contentDescription="@string/external_storage_error_msg" - android:layout_width="36dp" - android:layout_height="36dp" - android:layout_margin="8dp" - app:srcCompat="@drawable/ic_storage" /> - - <TextView - android:id="@+id/textView1" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="8dp" - android:text="@string/external_storage_error_msg" /> - - <Button - android:id="@+id/btnChooseDataFolder" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="8dp" - android:text="@string/choose_data_directory"/> - -</LinearLayout> |