Skip to content

Instantly share code, notes, and snippets.

@moizest89
Last active August 29, 2015 14:27
Show Gist options
  • Save moizest89/6465395ce9a44d79a391 to your computer and use it in GitHub Desktop.
Save moizest89/6465395ce9a44d79a391 to your computer and use it in GitHub Desktop.
package models;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
/**
* Created by @moizest89 in SV on 8/12/15.
*/
public class ArticlesModel implements Parcelable{
private final String TAG = ArticlesModel.class.getSimpleName();
public static final String CN_ARTICLES = "articles";
public static final String CN_ARTICLE = "article";
public static final String CN_PHOTOS = "photos";
public static final String CN_ARTICLE_VIDEOS = "article_videos";
public static final String CN_TITLE = "title";
public static final String CN_CONTENT = "content";
public static final String CN_SLUG = "slug";
public static final String CN_PUBLISHED = "published_at";
public static final String CN_EXCERPT = "excerpt";
public static final String CN_SHARE_URL = "share_url";
private String title = "";
private String content = "";
private String slug = "";
private String published_at = "";
private String excerpt = "";
private String share_url = "";
private LinkedList<ArticlesPhotosModel> Article_photos = new LinkedList<>();
private LinkedList<ArticlesVideosModel> Article_videos = new LinkedList<>();
public ArticlesModel() {
}
protected ArticlesModel(Parcel in) {
this.title = in.readString();
this.content = in.readString();
this.excerpt = in.readString();
this.share_url = in.readString();
this.published_at = in.readString();
this.share_url = in.readString();
in.readTypedList(Article_photos, ArticlesPhotosModel.CREATOR);
in.readTypedList(Article_videos, ArticlesVideosModel.CREATOR);
}
public String getTitle() {
Log.e(TAG, "getTitle: "+title);
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getSlug() {
return slug;
}
public void setSlug(String slug) {
this.slug = slug;
}
public String getPublished_at() {
return published_at;
}
public void setPublished_at(String published_at) {
this.published_at = published_at;
}
public String getExcerpt() {
return excerpt;
}
public void setExcerpt(String excerpt) {
this.excerpt = excerpt;
}
public String getShare_url() {
return share_url;
}
public void setShare_url(String share_url) {
this.share_url = share_url;
}
public LinkedList getArticle_photos() {
return Article_photos;
}
public void setArticle_photos(ArticlesPhotosModel article_photos) {
this.Article_photos.add(article_photos);
}
public LinkedList getArticle_videos() {
return Article_videos;
}
public void setArticle_videos(ArticlesVideosModel article_videos) {
Article_videos.add(article_videos);
}
/** Creator **/
public static final Creator<ArticlesModel> CREATOR = new Creator<ArticlesModel>() {
@Override
public ArticlesModel createFromParcel(Parcel in) {
return new ArticlesModel(in);
}
@Override
public ArticlesModel[] newArray(int size) {
return new ArticlesModel[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(getContent());
parcel.writeString(getTitle());
parcel.writeString(getSlug());
parcel.writeString(getPublished_at());
parcel.writeString(getExcerpt());
parcel.writeString(getShare_url());
parcel.writeTypedList(getArticle_photos());
parcel.writeTypedList(getArticle_videos());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment