Merge pull request #1 from AntennaPod/develop

catch up
This commit is contained in:
Matthieu 2019-03-08 16:40:28 +01:00 committed by GitHub
commit 26d7e61f4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 18 deletions

View File

@ -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 + "]");

View File

@ -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