implement duplicate checking for headlinesrequest
This commit is contained in:
parent
390c529728
commit
66d78b6602
@ -44,6 +44,14 @@ public class ArticleList extends ArrayList<Article> implements Parcelable {
|
||||
readFromParcel(in);
|
||||
}
|
||||
|
||||
public boolean containsId(int id) {
|
||||
for (Article a : this) {
|
||||
if (a.id == id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Parcelable.Creator CREATOR =
|
||||
new Parcelable.Creator() {
|
||||
|
@ -11,6 +11,7 @@ import org.fox.ttrss.types.Article;
|
||||
import org.fox.ttrss.types.ArticleList;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
@ -49,7 +50,8 @@ public class HeadlinesRequest extends ApiRequest {
|
||||
m_articles.remove(m_articles.size()-1); // remove previous placeholder
|
||||
|
||||
for (Article f : articles)
|
||||
m_articles.add(f);
|
||||
if (!m_articles.containsId(f.id))
|
||||
m_articles.add(f);
|
||||
|
||||
if (articles.size() == HEADLINES_REQUEST_SIZE) {
|
||||
Article placeholder = new Article(-1);
|
||||
|
Loading…
Reference in New Issue
Block a user