diff --git a/src/org/fox/ttrss/types/ArticleList.java b/src/org/fox/ttrss/types/ArticleList.java index fe70a15c..c9b491ee 100644 --- a/src/org/fox/ttrss/types/ArticleList.java +++ b/src/org/fox/ttrss/types/ArticleList.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import android.os.Parcel; import android.os.Parcelable; +import android.util.Log; @SuppressWarnings("serial") public class ArticleList extends ArrayList
implements Parcelable { @@ -15,10 +16,7 @@ public class ArticleList extends ArrayList
implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { - out.writeInt(this.size()); - for (Article article : this) { - out.writeParcelable(article, flags); - } + out.writeList(this); } public Article findById(int id) { @@ -30,17 +28,12 @@ public class ArticleList extends ArrayList
implements Parcelable { } public void readFromParcel(Parcel in) { - int length = in.readInt(); - - for (int i = 0; i < length; i++) { - Article article = in.readParcelable(Article.class.getClassLoader()); - this.add(article); - } + in.readList(this, getClass().getClassLoader()); } public ArticleList() { } - public ArticleList(Parcel in) { + public ArticleList(Parcel in) { readFromParcel(in); } diff --git a/src/org/fox/ttrss/types/FeedCategoryList.java b/src/org/fox/ttrss/types/FeedCategoryList.java index 0b85ce3b..eb5331bc 100644 --- a/src/org/fox/ttrss/types/FeedCategoryList.java +++ b/src/org/fox/ttrss/types/FeedCategoryList.java @@ -18,20 +18,11 @@ public class FeedCategoryList extends ArrayList implements Parcela @Override public void writeToParcel(Parcel out, int flags) { - out.writeInt(this.size()); - for (FeedCategory feed : this) { - out.writeParcelable(feed, flags); - } + out.writeList(this); } public void readFromParcel(Parcel in) { - int length = in.readInt(); - - for (int i = 0; i < length; i++) { - FeedCategory feed = in.readParcelable(FeedCategory.class.getClassLoader()); - this.add(feed); - } - + in.readList(this, getClass().getClassLoader()); } public FeedCategoryList(Parcel in) { diff --git a/src/org/fox/ttrss/types/FeedList.java b/src/org/fox/ttrss/types/FeedList.java index 2d972919..350f45ad 100644 --- a/src/org/fox/ttrss/types/FeedList.java +++ b/src/org/fox/ttrss/types/FeedList.java @@ -18,20 +18,11 @@ public class FeedList extends ArrayList implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { - out.writeInt(this.size()); - for (Feed feed : this) { - out.writeParcelable(feed, flags); - } + out.writeList(this); } public void readFromParcel(Parcel in) { - int length = in.readInt(); - - for (int i = 0; i < length; i++) { - Feed feed = in.readParcelable(Feed.class.getClassLoader()); - this.add(feed); - } - + in.readList(this, getClass().getClassLoader()); } public FeedList(Parcel in) {