1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.leanbackjank.app.model;
18 
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 /**
23  * Movie class represents video entity with title, description, image thumbs and video url.
24  */
25 public class Movie implements Parcelable {
26     static final long serialVersionUID = 727566175075960653L;
27     private static int sCount = 0;
28     private String mId;
29     private String mTitle;
30     private String mDescription;
31     private String mStudio;
32     private String mCategory;
33 
Movie()34     public Movie() {
35     }
36 
Movie(Parcel in)37     public Movie(Parcel in){
38         String[] data = new String[5];
39 
40         in.readStringArray(data);
41         mId = data[0];
42         mTitle = data[1];
43         mDescription = data[2];
44         mStudio = data[3];
45         mCategory = data[4];
46     }
47 
getCount()48     public static String getCount() {
49         return Integer.toString(sCount);
50     }
51 
incrementCount()52     public static void incrementCount() {
53         sCount++;
54     }
55 
getId()56     public String getId() {
57         return mId;
58     }
59 
setId(String id)60     public void setId(String id) {
61         mId = id;
62     }
63 
getTitle()64     public String getTitle() {
65         return mTitle;
66     }
67 
setTitle(String title)68     public void setTitle(String title) {
69         mTitle = title;
70     }
71 
getDescription()72     public String getDescription() {
73         return mDescription;
74     }
75 
setDescription(String description)76     public void setDescription(String description) {
77         mDescription = description;
78     }
79 
getStudio()80     public String getStudio() {
81         return mStudio;
82     }
83 
setStudio(String studio)84     public void setStudio(String studio) {
85         mStudio = studio;
86     }
87 
getCategory()88     public String getCategory() {
89         return mCategory;
90     }
91 
setCategory(String category)92     public void setCategory(String category) {
93         mCategory = category;
94     }
95 
96     @Override
describeContents()97     public int describeContents() {
98         return 0;
99     }
100 
101     @Override
writeToParcel(Parcel dest, int flags)102     public void writeToParcel(Parcel dest, int flags) {
103         dest.writeStringArray(new String[] {mId,
104                 mTitle,
105                 mDescription,
106                 mStudio,
107                 mCategory});
108     }
109 
110     @Override
toString()111     public String toString() {
112         StringBuilder sb = new StringBuilder(200);
113         sb.append("Movie{");
114         sb.append("mId=" + mId);
115         sb.append(", mTitle='" + mTitle + '\'');
116         sb.append('}');
117         return sb.toString();
118     }
119 
120     public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
121         public Movie createFromParcel(Parcel in) {
122             return new Movie(in);
123         }
124 
125         public Movie[] newArray(int size) {
126             return new Movie[size];
127         }
128     };
129 }
130