1 /*
2  * Copyright (C) 2006 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 com.android.internal.telephony.cat;
18 
19 import android.graphics.Bitmap;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 
23 /**
24  * Represents an Item COMPREHENSION-TLV object.
25  *
26  * {@hide}
27  */
28 public class Item implements Parcelable {
29     /** Identifier of the item. */
30     public int id;
31     /** Text string of the item. */
32     public String text;
33     /** Icon of the item */
34     public Bitmap icon;
35 
Item(int id, String text)36     public Item(int id, String text) {
37         this(id, text, null);
38     }
39 
Item(int id, String text, Bitmap icon)40     public Item(int id, String text, Bitmap icon) {
41         this.id = id;
42         this.text = text;
43         this.icon = icon;
44     }
45 
Item(Parcel in)46     public Item(Parcel in) {
47         id = in.readInt();
48         text = in.readString();
49         icon = in.readParcelable(Bitmap.class.getClassLoader());
50     }
51 
52     @Override
describeContents()53     public int describeContents() {
54         return 0;
55     }
56 
57     @Override
writeToParcel(Parcel dest, int flags)58     public void writeToParcel(Parcel dest, int flags) {
59         dest.writeInt(id);
60         dest.writeString(text);
61         dest.writeParcelable(icon, flags);
62     }
63 
64     public static final Parcelable.Creator<Item> CREATOR = new Parcelable.Creator<Item>() {
65         @Override
66         public Item createFromParcel(Parcel in) {
67             return new Item(in);
68         }
69 
70         @Override
71         public Item[] newArray(int size) {
72             return new Item[size];
73         }
74     };
75 
76     @Override
toString()77     public String toString() {
78         return text;
79     }
80 }
81