17f3028385b0349cfc6c0d6784840be148943b296Dake Gu/* 27f3028385b0349cfc6c0d6784840be148943b296Dake Gu * Copyright (C) 2014 The Android Open Source Project 37f3028385b0349cfc6c0d6784840be148943b296Dake Gu * 47f3028385b0349cfc6c0d6784840be148943b296Dake Gu * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 57f3028385b0349cfc6c0d6784840be148943b296Dake Gu * in compliance with the License. You may obtain a copy of the License at 67f3028385b0349cfc6c0d6784840be148943b296Dake Gu * 77f3028385b0349cfc6c0d6784840be148943b296Dake Gu * http://www.apache.org/licenses/LICENSE-2.0 87f3028385b0349cfc6c0d6784840be148943b296Dake Gu * 97f3028385b0349cfc6c0d6784840be148943b296Dake Gu * Unless required by applicable law or agreed to in writing, software distributed under the License 107f3028385b0349cfc6c0d6784840be148943b296Dake Gu * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 117f3028385b0349cfc6c0d6784840be148943b296Dake Gu * or implied. See the License for the specific language governing permissions and limitations under 127f3028385b0349cfc6c0d6784840be148943b296Dake Gu * the License. 137f3028385b0349cfc6c0d6784840be148943b296Dake Gu */ 147f3028385b0349cfc6c0d6784840be148943b296Dake Gupackage com.example.android.leanback; 157f3028385b0349cfc6c0d6784840be148943b296Dake Gu 167f3028385b0349cfc6c0d6784840be148943b296Dake Guimport android.os.Parcel; 177f3028385b0349cfc6c0d6784840be148943b296Dake Guimport android.os.Parcelable; 187f3028385b0349cfc6c0d6784840be148943b296Dake Gu 197f3028385b0349cfc6c0d6784840be148943b296Dake Gupublic class PhotoItem implements Parcelable { 207f3028385b0349cfc6c0d6784840be148943b296Dake Gu 217f3028385b0349cfc6c0d6784840be148943b296Dake Gu private String mTitle; 22f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn private String mContent; 237f3028385b0349cfc6c0d6784840be148943b296Dake Gu private int mImageResourceId; 247f3028385b0349cfc6c0d6784840be148943b296Dake Gu 257f3028385b0349cfc6c0d6784840be148943b296Dake Gu public PhotoItem(String title, int imageResourceId) { 26f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn this(title, null, imageResourceId); 27f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn } 28f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn 29f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn public PhotoItem(String title, String content, int imageResourceId) { 307f3028385b0349cfc6c0d6784840be148943b296Dake Gu mTitle = title; 31f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn mContent = content; 327f3028385b0349cfc6c0d6784840be148943b296Dake Gu mImageResourceId = imageResourceId; 337f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 347f3028385b0349cfc6c0d6784840be148943b296Dake Gu 357f3028385b0349cfc6c0d6784840be148943b296Dake Gu public int getImageResourceId() { 367f3028385b0349cfc6c0d6784840be148943b296Dake Gu return mImageResourceId; 377f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 387f3028385b0349cfc6c0d6784840be148943b296Dake Gu 397f3028385b0349cfc6c0d6784840be148943b296Dake Gu public String getTitle() { 407f3028385b0349cfc6c0d6784840be148943b296Dake Gu return mTitle; 417f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 427f3028385b0349cfc6c0d6784840be148943b296Dake Gu 43f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn public String getContent() { 44f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn return mContent; 45f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn } 46f1f489269da4b349125df56d54d3259929d48a7dTim Kilbourn 477f3028385b0349cfc6c0d6784840be148943b296Dake Gu @Override 487f3028385b0349cfc6c0d6784840be148943b296Dake Gu public String toString() { 497f3028385b0349cfc6c0d6784840be148943b296Dake Gu return mTitle; 507f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 517f3028385b0349cfc6c0d6784840be148943b296Dake Gu 527f3028385b0349cfc6c0d6784840be148943b296Dake Gu @Override 537f3028385b0349cfc6c0d6784840be148943b296Dake Gu public int describeContents() { 547f3028385b0349cfc6c0d6784840be148943b296Dake Gu return 0; 557f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 567f3028385b0349cfc6c0d6784840be148943b296Dake Gu 577f3028385b0349cfc6c0d6784840be148943b296Dake Gu @Override 587f3028385b0349cfc6c0d6784840be148943b296Dake Gu public void writeToParcel(Parcel dest, int flags) { 597f3028385b0349cfc6c0d6784840be148943b296Dake Gu dest.writeString(mTitle); 607f3028385b0349cfc6c0d6784840be148943b296Dake Gu dest.writeInt(mImageResourceId); 617f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 627f3028385b0349cfc6c0d6784840be148943b296Dake Gu 637f3028385b0349cfc6c0d6784840be148943b296Dake Gu public static final Parcelable.Creator<PhotoItem> CREATOR 647f3028385b0349cfc6c0d6784840be148943b296Dake Gu = new Parcelable.Creator<PhotoItem>() { 657f3028385b0349cfc6c0d6784840be148943b296Dake Gu @Override 667f3028385b0349cfc6c0d6784840be148943b296Dake Gu public PhotoItem createFromParcel(Parcel in) { 677f3028385b0349cfc6c0d6784840be148943b296Dake Gu return new PhotoItem(in); 687f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 697f3028385b0349cfc6c0d6784840be148943b296Dake Gu 707f3028385b0349cfc6c0d6784840be148943b296Dake Gu @Override 717f3028385b0349cfc6c0d6784840be148943b296Dake Gu public PhotoItem[] newArray(int size) { 727f3028385b0349cfc6c0d6784840be148943b296Dake Gu return new PhotoItem[size]; 737f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 747f3028385b0349cfc6c0d6784840be148943b296Dake Gu }; 757f3028385b0349cfc6c0d6784840be148943b296Dake Gu 767f3028385b0349cfc6c0d6784840be148943b296Dake Gu private PhotoItem(Parcel in) { 777f3028385b0349cfc6c0d6784840be148943b296Dake Gu mTitle = in.readString(); 787f3028385b0349cfc6c0d6784840be148943b296Dake Gu mImageResourceId = in.readInt(); 797f3028385b0349cfc6c0d6784840be148943b296Dake Gu } 807f3028385b0349cfc6c0d6784840be148943b296Dake Gu} 81