diff options
author | ByteHamster <info@bytehamster.com> | 2021-07-11 18:34:53 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-07-11 18:52:11 +0200 |
commit | 4f5449a0d3c8540b32a8d54c3c770d5fe91e554e (patch) | |
tree | f2af5ff84bb35bec470534c9b90b0136a75a1787 /app/src | |
parent | 55f7adb10609ad89627b56aafce7f8278dc884eb (diff) | |
download | AntennaPod-4f5449a0d3c8540b32a8d54c3c770d5fe91e554e.zip |
No longer show item-specific auto-download property to users
Diffstat (limited to 'app/src')
6 files changed, 7 insertions, 71 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java index afa86c9d7..dedf8e5e6 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/CancelDownloadActionButton.java @@ -3,7 +3,6 @@ package de.danoeh.antennapod.adapter.actionbutton; import android.content.Context; import androidx.annotation.DrawableRes; import androidx.annotation.StringRes; -import android.widget.Toast; import de.danoeh.antennapod.R; import de.danoeh.antennapod.model.feed.FeedItem; @@ -35,8 +34,8 @@ public class CancelDownloadActionButton extends ItemActionButton { FeedMedia media = item.getMedia(); DownloadRequester.getInstance().cancelDownload(context, media); if (UserPreferences.isEnableAutodownload()) { - DBWriter.setFeedItemAutoDownload(media.getItem(), false); - Toast.makeText(context, R.string.download_canceled_autodownload_enabled_msg, Toast.LENGTH_LONG).show(); + item.setAutoDownload(false); + DBWriter.setFeedItem(item); } } } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java index 80ab2b719..85bc3facf 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java @@ -11,7 +11,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.ListView; import android.widget.TextView; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; @@ -23,7 +22,6 @@ import de.danoeh.antennapod.adapter.DownloadLogAdapter; import de.danoeh.antennapod.core.event.DownloadEvent; import de.danoeh.antennapod.core.event.DownloadLogEvent; import de.danoeh.antennapod.core.event.DownloaderUpdate; -import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.download.DownloadStatus; @@ -34,6 +32,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.menuhandler.MenuItemUtils; import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.view.EmptyViewHandler; import io.reactivex.Observable; @@ -111,13 +110,11 @@ public class DownloadLogFragment extends ListFragment { DownloadRequest downloadRequest = ((Downloader) item).getDownloadRequest(); DownloadRequester.getInstance().cancelDownload(getActivity(), downloadRequest.getSource()); - if (downloadRequest.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA - && UserPreferences.isEnableAutodownload()) { + if (downloadRequest.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) { FeedMedia media = DBReader.getFeedMedia(downloadRequest.getFeedfileId()); - DBWriter.setFeedItemAutoDownload(media.getItem(), false); - - ((MainActivity) getActivity()).showSnackbarAbovePlayer( - R.string.download_canceled_autodownload_enabled_msg, Toast.LENGTH_SHORT); + FeedItem feedItem = media.getItem(); + feedItem.setAutoDownload(false); + DBWriter.setFeedItem(feedItem); } } else if (item instanceof DownloadStatus) { DownloadStatus status = (DownloadStatus) item; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java index 9e57497bf..dbc7f2ae3 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java @@ -1,7 +1,5 @@ package de.danoeh.antennapod.fragment; -import android.content.Context; -import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; @@ -16,7 +14,6 @@ import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreferenceCompat; import androidx.recyclerview.widget.RecyclerView; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.dialog.ConfirmationDialog; import de.danoeh.antennapod.core.event.settings.SkipIntroEndingChangedEvent; import de.danoeh.antennapod.core.event.settings.SpeedPresetChangedEvent; import de.danoeh.antennapod.core.event.settings.VolumeAdaptionChangedEvent; @@ -384,8 +381,6 @@ public class FeedSettingsFragment extends Fragment { feedPreferences.setAutoDownload(checked); DBWriter.setFeedPreferences(feedPreferences); updateAutoDownloadEnabled(); - ApplyToEpisodesDialog dialog = new ApplyToEpisodesDialog(getActivity(), checked); - dialog.createNewDialog().show(); pref.setChecked(checked); return false; }); @@ -417,22 +412,5 @@ public class FeedSettingsFragment extends Fragment { return false; }); } - - private class ApplyToEpisodesDialog extends ConfirmationDialog { - private final boolean autoDownload; - - ApplyToEpisodesDialog(Context context, boolean autoDownload) { - super(context, R.string.auto_download_apply_to_items_title, - R.string.auto_download_apply_to_items_message); - this.autoDownload = autoDownload; - setPositiveText(R.string.yes); - setNegativeText(R.string.no); - } - - @Override - public void onConfirmButtonPressed(DialogInterface dialog) { - DBWriter.setFeedsItemsAutoDownload(feed, autoDownload); - } - } } } diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index d478c581d..a9747e987 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -65,14 +65,6 @@ public class FeedItemMenuHandler { setItemVisibility(menu, R.id.mark_unread_item, selectedItem.isPlayed()); setItemVisibility(menu, R.id.reset_position, hasMedia && selectedItem.getMedia().getPosition() != 0); - if (!UserPreferences.isEnableAutodownload() || fileDownloaded || selectedItem.getFeed().isLocalFeed()) { - setItemVisibility(menu, R.id.activate_auto_download, false); - setItemVisibility(menu, R.id.deactivate_auto_download, false); - } else { - setItemVisibility(menu, R.id.activate_auto_download, !selectedItem.getAutoDownload()); - setItemVisibility(menu, R.id.deactivate_auto_download, selectedItem.getAutoDownload()); - } - // Display proper strings when item has no media if (hasMedia) { setItemTitle(menu, R.id.mark_read_item, R.string.mark_read_label); @@ -206,14 +198,6 @@ public class FeedItemMenuHandler { } DBWriter.markItemPlayed(selectedItem, FeedItem.UNPLAYED, true); break; - case R.id.activate_auto_download: - selectedItem.setAutoDownload(true); - DBWriter.setFeedItemAutoDownload(selectedItem, true); - break; - case R.id.deactivate_auto_download: - selectedItem.setAutoDownload(false); - DBWriter.setFeedItemAutoDownload(selectedItem, false); - break; case R.id.visit_website_item: IntentUtils.openInBrowser(context, FeedItemUtil.getLinkWithFallback(selectedItem)); break; diff --git a/app/src/main/res/menu/feeditem_options.xml b/app/src/main/res/menu/feeditem_options.xml index 5b33539e1..70400fe55 100644 --- a/app/src/main/res/menu/feeditem_options.xml +++ b/app/src/main/res/menu/feeditem_options.xml @@ -50,18 +50,6 @@ custom:showAsAction="collapseActionView" android:title="@string/reset_position"> </item> - - <item - android:id="@+id/activate_auto_download" - custom:showAsAction="collapseActionView" - android:title="@string/activate_auto_download"> - </item> - <item - android:id="@+id/deactivate_auto_download" - custom:showAsAction="collapseActionView" - android:title="@string/deactivate_auto_download"> - </item> - <item android:id="@+id/visit_website_item" android:icon="@drawable/ic_web" diff --git a/app/src/main/res/menu/feeditemlist_context.xml b/app/src/main/res/menu/feeditemlist_context.xml index 27f1af6ca..9afbd3bc3 100644 --- a/app/src/main/res/menu/feeditemlist_context.xml +++ b/app/src/main/res/menu/feeditemlist_context.xml @@ -51,16 +51,6 @@ android:title="@string/reset_position" /> <item - android:id="@+id/activate_auto_download" - android:menuCategory="container" - android:title="@string/activate_auto_download" /> - - <item - android:id="@+id/deactivate_auto_download" - android:menuCategory="container" - android:title="@string/deactivate_auto_download" /> - - <item android:id="@+id/visit_website_item" android:menuCategory="container" android:title="@string/visit_website_label" /> |