Improve updating of saved articles list

This commit is contained in:
Alex Sytnyk 2018-04-11 14:53:34 +03:00
parent f85a67beec
commit 135352725d

View file

@ -122,6 +122,9 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Wiki
if (oldItem instanceof String && newItem instanceof String) {
return false;
} else if (oldItem instanceof WikivoyageArticle && newItem instanceof WikivoyageArticle) {
if (newItemPosition == newItems.size() - 1 && lastItemChanged()) {
return false;
}
WikivoyageArticle oldArticle = (WikivoyageArticle) oldItem;
WikivoyageArticle newArticle = (WikivoyageArticle) newItem;
return oldArticle.getCityId() == newArticle.getCityId()
@ -129,5 +132,9 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Wiki
}
return false;
}
private boolean lastItemChanged() {
return newItems.get(newItems.size() - 1) != oldItems.get(oldItems.size() - 1);
}
}
}