1 /*
2  * Copyright (C) 2007 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 public class TextMessage implements Parcelable {
24     public String title = "";
25     public String text = null;
26     public Bitmap icon = null;
27     public boolean iconSelfExplanatory = false;
28     public boolean isHighPriority = false;
29     public boolean responseNeeded = true;
30     public boolean userClear = false;
31     public Duration duration = null;
32 
TextMessage()33     TextMessage() {
34     }
35 
TextMessage(Parcel in)36     private TextMessage(Parcel in) {
37         title = in.readString();
38         text = in.readString();
39         icon = in.readParcelable(null);
40         iconSelfExplanatory = in.readInt() == 1 ? true : false;
41         isHighPriority = in.readInt() == 1 ? true : false;
42         responseNeeded = in.readInt() == 1 ? true : false;
43         userClear = in.readInt() == 1 ? true : false;
44         duration = in.readParcelable(null);
45     }
46 
47     @Override
describeContents()48     public int describeContents() {
49         return 0;
50     }
51 
52     @Override
writeToParcel(Parcel dest, int flags)53     public void writeToParcel(Parcel dest, int flags) {
54         dest.writeString(title);
55         dest.writeString(text);
56         dest.writeParcelable(icon, 0);
57         dest.writeInt(iconSelfExplanatory ? 1 : 0);
58         dest.writeInt(isHighPriority ? 1 : 0);
59         dest.writeInt(responseNeeded ? 1 : 0);
60         dest.writeInt(userClear ? 1 : 0);
61         dest.writeParcelable(duration, 0);
62     }
63 
64     public static final Parcelable.Creator<TextMessage> CREATOR = new Parcelable.Creator<TextMessage>() {
65         @Override
66         public TextMessage createFromParcel(Parcel in) {
67             return new TextMessage(in);
68         }
69 
70         @Override
71         public TextMessage[] newArray(int size) {
72             return new TextMessage[size];
73         }
74     };
75 }