Advertisement
nurrohim11

ResultItem

Jul 15th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.35 KB | None | 0 0
  1. package com.example.nurrohim.moviedicoding.model.search;
  2.  
  3. import android.database.Cursor;
  4. import android.os.Parcel;
  5. import android.os.Parcelable;
  6.  
  7. import com.google.gson.annotations.SerializedName;
  8.  
  9. import java.util.List;
  10.  
  11. import static android.provider.BaseColumns._ID;
  12. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.FavoriteColumns.COLUMN_BACKDROP;
  13. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.FavoriteColumns.COLUMN_OVERVIEW;
  14. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.FavoriteColumns.COLUMN_POSTER;
  15. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.FavoriteColumns.COLUMN_RELEASE_DATE;
  16. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.FavoriteColumns.COLUMN_TITLE;
  17. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.FavoriteColumns.COLUMN_VOTE;
  18. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.getColumnDouble;
  19. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.getColumnInt;
  20. import static com.example.nurrohim.moviedicoding.db.DatabaseConstract.getColumnString;
  21.  
  22. public class ResultsItem implements Parcelable {
  23.  
  24.     @SerializedName("overview")
  25.     private String overview;
  26.  
  27.     @SerializedName("original_language")
  28.     private String originalLanguage;
  29.  
  30.     @SerializedName("original_title")
  31.     private String originalTitle;
  32.  
  33.     @SerializedName("video")
  34.     private boolean video;
  35.  
  36.     @SerializedName("title")
  37.     private String title;
  38.  
  39.     @SerializedName("genre_ids")
  40.     private List<Integer> genreIds;
  41.  
  42.     @SerializedName("poster_path")
  43.     private String posterPath;
  44.  
  45.     @SerializedName("runtime")
  46.     private int runtime;
  47.  
  48.     @SerializedName("backdrop_path")
  49.     private String backdropPath;
  50.  
  51.     @SerializedName("release_date")
  52.     private String releaseDate;
  53.  
  54.     @SerializedName("vote_average")
  55.     private double voteAverage;
  56.  
  57.     @SerializedName("popularity")
  58.     private double popularity;
  59.  
  60.     @SerializedName("id")
  61.     private int id;
  62.  
  63.     @SerializedName("adult")
  64.     private boolean adult;
  65.  
  66.     @SerializedName("vote_count")
  67.     private int voteCount;
  68.  
  69.     public void setOverview(String overview) {
  70.         this.overview = overview;
  71.     }
  72.  
  73.     public String getOverview() {
  74.         return overview;
  75.     }
  76.  
  77.     public void setOriginalLanguage(String originalLanguage) {
  78.         this.originalLanguage = originalLanguage;
  79.     }
  80.  
  81.     public String getOriginalLanguage() {
  82.         return originalLanguage;
  83.     }
  84.  
  85.     public void setOriginalTitle(String originalTitle) {
  86.         this.originalTitle = originalTitle;
  87.     }
  88.  
  89.     public String getOriginalTitle() {
  90.         return originalTitle;
  91.     }
  92.  
  93.     public void setVideo(boolean video) {
  94.         this.video = video;
  95.     }
  96.  
  97.     public boolean isVideo() {
  98.         return video;
  99.     }
  100.  
  101.     public void setTitle(String title) {
  102.         this.title = title;
  103.     }
  104.  
  105.     public String getTitle() {
  106.         return title;
  107.     }
  108.  
  109.     public void setGenreIds(List<Integer> genreIds) {
  110.         this.genreIds = genreIds;
  111.     }
  112.  
  113.     public List<Integer> getGenreIds() {
  114.         return genreIds;
  115.     }
  116.  
  117.     public void setPosterPath(String posterPath) {
  118.         this.posterPath = posterPath;
  119.     }
  120.  
  121.     public String getPosterPath() {
  122.         return posterPath;
  123.     }
  124.  
  125.     public void setBackdropPath(String backdropPath) {
  126.         this.backdropPath = backdropPath;
  127.     }
  128.  
  129.     public String getBackdropPath() {
  130.         return backdropPath;
  131.     }
  132.  
  133.     public void setReleaseDate(String releaseDate) {
  134.         this.releaseDate = releaseDate;
  135.     }
  136.  
  137.     public String getReleaseDate() {
  138.         return releaseDate;
  139.     }
  140.  
  141.     public void setVoteAverage(double voteAverage) {
  142.         this.voteAverage = voteAverage;
  143.     }
  144.  
  145.     public double getVoteAverage() {
  146.         return voteAverage;
  147.     }
  148.  
  149.     public void setPopularity(double popularity) {
  150.         this.popularity = popularity;
  151.     }
  152.  
  153.     public double getPopularity() {
  154.         return popularity;
  155.     }
  156.  
  157.     public void setId(int id) {
  158.         this.id = id;
  159.     }
  160.  
  161.     public int getId() {
  162.         return id;
  163.     }
  164.  
  165.     public void setAdult(boolean adult) {
  166.         this.adult = adult;
  167.     }
  168.  
  169.     public boolean isAdult() {
  170.         return adult;
  171.     }
  172.  
  173.     public void setVoteCount(int voteCount) {
  174.         this.voteCount = voteCount;
  175.     }
  176.  
  177.     public int getVoteCount() {
  178.         return voteCount;
  179.     }
  180.  
  181.     public int getRuntime() {
  182.         return runtime;
  183.     }
  184.  
  185.     public void setRuntime(int runtime) {
  186.         this.runtime = runtime;
  187.     }
  188.  
  189.     public ResultsItem(Cursor cursor) {
  190.         this.id = getColumnInt(cursor, _ID);
  191.         this.title = getColumnString(cursor, COLUMN_TITLE);
  192.         this.backdropPath = getColumnString(cursor, COLUMN_BACKDROP);
  193.         this.posterPath = getColumnString(cursor, COLUMN_POSTER);
  194.         this.releaseDate = getColumnString(cursor, COLUMN_RELEASE_DATE);
  195.         this.voteAverage = getColumnDouble(cursor, COLUMN_VOTE);
  196.         this.overview = getColumnString(cursor, COLUMN_OVERVIEW);
  197.     }
  198.  
  199.     @Override
  200.     public String toString() {
  201.         return
  202.                 "ResultsItem{" +
  203.                         "overview = '" + overview + '\'' +
  204.                         ",original_language = '" + originalLanguage + '\'' +
  205.                         ",original_title = '" + originalTitle + '\'' +
  206.                         ",video = '" + video + '\'' +
  207.                         ",title = '" + title + '\'' +
  208.                         ",genre_ids = '" + genreIds + '\'' +
  209.                         ",poster_path = '" + posterPath + '\'' +
  210.                         ",backdrop_path = '" + backdropPath + '\'' +
  211.                         ",release_date = '" + releaseDate + '\'' +
  212.                         ",vote_average = '" + voteAverage + '\'' +
  213.                         ",popularity = '" + popularity + '\'' +
  214.                         ",id = '" + id + '\'' +
  215.                         ",adult = '" + adult + '\'' +
  216.                         ",vote_count = '" + voteCount + '\'' +
  217.                         ",runtime = '" + runtime + '\'' +
  218.                         "}";
  219.     }
  220.  
  221.     @Override
  222.     public int describeContents() {
  223.         return 0;
  224.     }
  225.  
  226.     @Override
  227.     public void writeToParcel(Parcel dest, int flags) {
  228.         dest.writeString(this.title);
  229.         dest.writeString(this.overview);
  230.         dest.writeString(this.releaseDate);
  231.         dest.writeString(this.posterPath);
  232.         dest.writeString(this.backdropPath);
  233.         dest.writeDouble(this.voteAverage);
  234.         dest.writeInt(this.id);
  235.  
  236.     }
  237.  
  238.     protected ResultsItem(Parcel in) {
  239.         this.title = in.readString();
  240.         this.overview = in.readString();
  241.         this.releaseDate = in.readString();
  242.         this.posterPath = in.readString();
  243.         this.backdropPath = in.readString();
  244.         this.voteAverage = in.readDouble();
  245.         this.id = in.readInt();
  246.     }
  247.  
  248.     public static final Parcelable.Creator<ResultsItem> CREATOR = new Parcelable.Creator<ResultsItem>() {
  249.         @Override
  250.         public ResultsItem createFromParcel(Parcel source) {
  251.             return new ResultsItem(source);
  252.         }
  253.  
  254.         @Override
  255.         public ResultsItem[] newArray(int size) {
  256.             return new ResultsItem[size];
  257.         }
  258.     };
  259. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement