add data structures for categories
This commit is contained in:
parent
2e3f278fd1
commit
8771803965
44
src/org/fox/ttrss/FeedCategory.java
Normal file
44
src/org/fox/ttrss/FeedCategory.java
Normal file
@ -0,0 +1,44 @@
|
||||
package org.fox.ttrss;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class FeedCategory implements Parcelable {
|
||||
int id;
|
||||
String title;
|
||||
int unread;
|
||||
|
||||
public FeedCategory(Parcel in) {
|
||||
readFromParcel(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeInt(id);
|
||||
out.writeString(title);
|
||||
out.writeInt(unread);
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
id = in.readInt();
|
||||
title = in.readString();
|
||||
unread = in.readInt();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Parcelable.Creator CREATOR =
|
||||
new Parcelable.Creator() {
|
||||
public FeedCategory createFromParcel(Parcel in) {
|
||||
return new FeedCategory(in);
|
||||
}
|
||||
|
||||
public FeedCategory[] newArray(int size) {
|
||||
return new FeedCategory[size];
|
||||
}
|
||||
};
|
||||
}
|
51
src/org/fox/ttrss/FeedCategoryList.java
Normal file
51
src/org/fox/ttrss/FeedCategoryList.java
Normal file
@ -0,0 +1,51 @@
|
||||
package org.fox.ttrss;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FeedCategoryList extends ArrayList<FeedCategory> implements Parcelable {
|
||||
|
||||
public FeedCategoryList() { }
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeInt(this.size());
|
||||
for (FeedCategory feed : this) {
|
||||
out.writeParcelable(feed, flags);
|
||||
}
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
int length = in.readInt();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
FeedCategory feed = in.readParcelable(Feed.class.getClassLoader());
|
||||
this.add(feed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public FeedCategoryList(Parcel in) {
|
||||
readFromParcel(in);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Parcelable.Creator CREATOR =
|
||||
new Parcelable.Creator() {
|
||||
public FeedCategoryList createFromParcel(Parcel in) {
|
||||
return new FeedCategoryList(in);
|
||||
}
|
||||
|
||||
public FeedCategoryList[] newArray(int size) {
|
||||
return new FeedCategoryList[size];
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user