2012-06-19 10:18:00 +00:00
|
|
|
package org.fox.ttrss.types;
|
2011-11-27 19:46:25 +00:00
|
|
|
import java.util.ArrayList;
|
2011-09-09 06:02:31 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2012-06-19 10:18:00 +00:00
|
|
|
|
2011-11-25 10:32:32 +00:00
|
|
|
import android.os.Parcel;
|
|
|
|
import android.os.Parcelable;
|
2011-09-09 06:02:31 +00:00
|
|
|
|
2011-11-28 14:40:48 +00:00
|
|
|
// TODO: serialize Labels
|
2011-11-25 10:32:32 +00:00
|
|
|
public class Article implements Parcelable {
|
2012-06-19 10:18:00 +00:00
|
|
|
public int id;
|
|
|
|
public boolean unread;
|
|
|
|
public boolean marked;
|
|
|
|
public boolean published;
|
|
|
|
public int updated;
|
|
|
|
public boolean is_updated;
|
|
|
|
public String title;
|
|
|
|
public String link;
|
|
|
|
public int feed_id;
|
|
|
|
public List<String> tags;
|
|
|
|
public List<Attachment> attachments;
|
|
|
|
public String content;
|
|
|
|
public List<List<String>> labels;
|
2012-10-09 15:36:23 +00:00
|
|
|
public String feed_title;
|
|
|
|
public int comments_count;
|
|
|
|
public String comments_link;
|
2012-10-10 12:45:33 +00:00
|
|
|
public boolean always_display_attachments;
|
2013-03-30 15:30:47 +00:00
|
|
|
public String author;
|
2011-11-25 10:32:32 +00:00
|
|
|
|
2011-11-25 20:34:40 +00:00
|
|
|
public Article(Parcel in) {
|
|
|
|
readFromParcel(in);
|
|
|
|
}
|
|
|
|
|
2012-09-04 12:28:50 +00:00
|
|
|
public Article() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-11-30 11:45:23 +00:00
|
|
|
public Article(int id) {
|
|
|
|
this.id = id;
|
|
|
|
this.title = "";
|
|
|
|
this.link = "";
|
|
|
|
this.tags = new ArrayList<String>();
|
|
|
|
}
|
|
|
|
|
2011-11-25 10:32:32 +00:00
|
|
|
@Override
|
|
|
|
public int describeContents() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void writeToParcel(Parcel out, int flags) {
|
|
|
|
out.writeInt(id);
|
|
|
|
out.writeInt(unread ? 1 : 0);
|
|
|
|
out.writeInt(marked ? 1 : 0);
|
|
|
|
out.writeInt(published ? 1 : 0);
|
|
|
|
out.writeInt(updated);
|
|
|
|
out.writeInt(is_updated ? 1 : 0);
|
|
|
|
out.writeString(title);
|
|
|
|
out.writeString(link);
|
|
|
|
out.writeInt(feed_id);
|
|
|
|
out.writeStringList(tags);
|
|
|
|
out.writeString(content);
|
2012-02-06 11:05:56 +00:00
|
|
|
out.writeList(attachments);
|
2012-06-20 10:16:24 +00:00
|
|
|
out.writeString(feed_title);
|
2012-10-10 12:45:33 +00:00
|
|
|
out.writeInt(comments_count);
|
|
|
|
out.writeString(comments_link);
|
|
|
|
out.writeInt(always_display_attachments ? 1 : 0);
|
2013-03-30 15:30:47 +00:00
|
|
|
out.writeString(author);
|
2011-11-25 10:32:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void readFromParcel(Parcel in) {
|
|
|
|
id = in.readInt();
|
|
|
|
unread = in.readInt() == 1;
|
|
|
|
marked = in.readInt() == 1;
|
|
|
|
published = in.readInt() == 1;
|
|
|
|
updated = in.readInt();
|
|
|
|
is_updated = in.readInt() == 1;
|
|
|
|
title = in.readString();
|
|
|
|
link = in.readString();
|
2011-11-27 19:46:25 +00:00
|
|
|
feed_id = in.readInt();
|
|
|
|
|
|
|
|
if (tags == null) tags = new ArrayList<String>();
|
2011-11-25 10:32:32 +00:00
|
|
|
in.readStringList(tags);
|
2011-11-27 19:46:25 +00:00
|
|
|
|
2011-11-25 10:32:32 +00:00
|
|
|
content = in.readString();
|
2012-02-06 11:05:56 +00:00
|
|
|
|
|
|
|
attachments = new ArrayList<Attachment>();
|
2012-02-07 05:21:55 +00:00
|
|
|
in.readList(attachments, Attachment.class.getClassLoader());
|
2012-06-20 10:16:24 +00:00
|
|
|
|
|
|
|
feed_title = in.readString();
|
2012-10-10 12:45:33 +00:00
|
|
|
|
|
|
|
comments_count = in.readInt();
|
|
|
|
comments_link = in.readString();
|
|
|
|
always_display_attachments = in.readInt() == 1;
|
2013-03-30 15:30:47 +00:00
|
|
|
author = in.readString();
|
2011-11-25 10:32:32 +00:00
|
|
|
}
|
2011-11-25 20:34:40 +00:00
|
|
|
|
2011-11-27 13:20:27 +00:00
|
|
|
@SuppressWarnings("rawtypes")
|
2011-11-25 20:34:40 +00:00
|
|
|
public static final Parcelable.Creator CREATOR =
|
|
|
|
new Parcelable.Creator() {
|
|
|
|
public Article createFromParcel(Parcel in) {
|
|
|
|
return new Article(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Article[] newArray(int size) {
|
|
|
|
return new Article[size];
|
|
|
|
}
|
|
|
|
};
|
2011-09-09 06:02:31 +00:00
|
|
|
}
|