1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
12 * the License.
13 */
14package com.example.android.leanback;
15
16import android.os.Parcel;
17import android.os.Parcelable;
18
19public class PhotoItem implements Parcelable {
20
21    private String mTitle;
22    private String mContent;
23    private int mImageResourceId;
24
25    public PhotoItem(String title, int imageResourceId) {
26        this(title, null, imageResourceId);
27    }
28
29    public PhotoItem(String title, String content, int imageResourceId) {
30        mTitle = title;
31        mContent = content;
32        mImageResourceId = imageResourceId;
33    }
34
35    public int getImageResourceId() {
36        return mImageResourceId;
37    }
38
39    public String getTitle() {
40        return mTitle;
41    }
42
43    public String getContent() {
44        return mContent;
45    }
46
47    @Override
48    public String toString() {
49        return mTitle;
50    }
51
52    @Override
53    public int describeContents() {
54        return 0;
55    }
56
57    @Override
58    public void writeToParcel(Parcel dest, int flags) {
59        dest.writeString(mTitle);
60        dest.writeInt(mImageResourceId);
61    }
62
63    public static final Parcelable.Creator<PhotoItem> CREATOR
64            = new Parcelable.Creator<PhotoItem>() {
65        @Override
66        public PhotoItem createFromParcel(Parcel in) {
67            return new PhotoItem(in);
68        }
69
70        @Override
71        public PhotoItem[] newArray(int size) {
72            return new PhotoItem[size];
73        }
74    };
75
76    private PhotoItem(Parcel in) {
77        mTitle = in.readString();
78        mImageResourceId = in.readInt();
79    }
80}
81