diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2019-03-08 12:15:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-08 12:15:23 +0100 |
commit | 6212455431916a8bdbfa7cdc23a27f0ba8380973 (patch) | |
tree | 4a4191618371ee34c567174588a4834f783a7ca2 | |
parent | 2818bb62ab44f37d7e4f84f093707f7b9d9ac287 (diff) | |
parent | f2306d295066874eb2cb467468a844f9d424f726 (diff) | |
download | AntennaPod-6212455431916a8bdbfa7cdc23a27f0ba8380973.zip |
Merge pull request #3048 from ByteHamster/new-episodes-download
Fixed download status update in NewEpisodesFragment
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java | 18 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java | 14 |
2 files changed, 14 insertions, 18 deletions
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 ef522d3b3..beca6ab5c 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -414,20 +414,26 @@ public class AllEpisodesFragment extends Fragment { public void onEventMainThread(FeedItemEvent event) { Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); - if(episodes == null || listAdapter == null) { + if (episodes == null || listAdapter == null) { return; } - for(int i=0, size = event.items.size(); i < size; i++) { - FeedItem item = event.items.get(i); + for (FeedItem item : event.items) { int pos = FeedItemUtil.indexOfItemWithId(episodes, item.getId()); - if(pos >= 0) { + if (pos >= 0) { episodes.remove(pos); - episodes.add(pos, item); - listAdapter.notifyItemChanged(pos); + if (shouldUpdatedItemRemainInList(item)) { + episodes.add(pos, item); + listAdapter.notifyItemChanged(pos); + } else { + listAdapter.notifyItemRemoved(pos); + } } } } + protected boolean shouldUpdatedItemRemainInList(FeedItem item) { + return true; + } public void onEventMainThread(DownloadEvent event) { Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java index 6695ba427..335ee224b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/NewEpisodesFragment.java @@ -41,18 +41,8 @@ public class NewEpisodesFragment extends AllEpisodesFragment { } @Override - public void onEventMainThread(FeedItemEvent event) { - Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); - if(episodes == null) { - return; - } - for(FeedItem item : event.items) { - int pos = FeedItemUtil.indexOfItemWithId(episodes, item.getId()); - if(pos >= 0 && item.isTagged(FeedItem.TAG_QUEUE)) { - episodes.remove(pos); - listAdapter.notifyItemRemoved(pos); - } - } + protected boolean shouldUpdatedItemRemainInList(FeedItem item) { + return item.isNew(); } @Override |