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 33 TextMessage() { 34 } 35 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 public int describeContents() { 48 return 0; 49 } 50 51 public void writeToParcel(Parcel dest, int flags) { 52 dest.writeString(title); 53 dest.writeString(text); 54 dest.writeParcelable(icon, 0); 55 dest.writeInt(iconSelfExplanatory ? 1 : 0); 56 dest.writeInt(isHighPriority ? 1 : 0); 57 dest.writeInt(responseNeeded ? 1 : 0); 58 dest.writeInt(userClear ? 1 : 0); 59 dest.writeParcelable(duration, 0); 60 } 61 62 public static final Parcelable.Creator<TextMessage> CREATOR = new Parcelable.Creator<TextMessage>() { 63 public TextMessage createFromParcel(Parcel in) { 64 return new TextMessage(in); 65 } 66 67 public TextMessage[] newArray(int size) { 68 return new TextMessage[size]; 69 } 70 }; 71 }