From 469a1615db8295e8ccd2b3c76a31c47af7ffe407 Mon Sep 17 00:00:00 2001 From: Niffler Date: Thu, 22 Oct 2020 23:04:00 +0200 Subject: [PATCH] Update view after episode deletion when downloaded filter is enabled (#4560) --- .../antennapod/fragment/AllEpisodesFragment.java | 12 ++++++++++++ .../danoeh/antennapod/core/feed/FeedItemFilter.java | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java index 4a1c12e0a..0c75b7eea 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -89,6 +89,18 @@ public class AllEpisodesFragment extends EpisodesListFragment { filterDialog.openDialog(); } + @Override + protected boolean shouldUpdatedItemRemainInList(FeedItem item) { + SharedPreferences prefs = getActivity().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); + FeedItemFilter feedItemFilter = new FeedItemFilter(prefs.getString(PREF_FILTER, "")); + + if (feedItemFilter.isShowDownloaded() && (!item.hasMedia() || !item.getMedia().isDownloaded())) { + return false; + } + + return true; + } + @NonNull @Override protected List loadData() { diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java index d34e23506..e8e478a86 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java @@ -129,4 +129,8 @@ public class FeedItemFilter { return mProperties.clone(); } + public boolean isShowDownloaded() { + return showDownloaded; + } + }