package com.sogou.sogouchat.bean; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; public class TelNode implements Parcelable { public int mContactId; public String mName; public String mTel; public int mType; public int mMsgCnt; public int mNewMsgCnt; public long mLastDate; public String mLastBody; public ArrayList<MsgNode> mMsgList; @Override public int describeContents() { // TODO Auto-generated method stub return 0; } public TelNode(){ } TelNode(Parcel in){ // Log.i("TelNumNode", "TelNumNode" + mNum); mContactId = in.readInt(); mName = in.readString(); mTel = in.readString(); mType = in.readInt(); mMsgCnt = in.readInt(); mNewMsgCnt = in.readInt(); mLastDate = in.readLong(); mLastBody = in.readString(); if (mMsgCnt > 0){ mMsgList = new ArrayList<MsgNode>(); in.readTypedList(mMsgList, MsgNode.CREATOR); } } @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub // Log.i("TelNumNode", "writeToParcel" + mNum); dest.writeInt(mContactId); dest.writeString(mName); dest.writeString(mTel); dest.writeInt(mType); dest.writeInt(mMsgCnt); dest.writeInt(mNewMsgCnt); dest.writeLong(mLastDate); dest.writeString(mLastBody); if (mMsgCnt > 0){ dest.writeTypedList(mMsgList); } } public static final Parcelable.Creator<TelNode> CREATOR = new Parcelable.Creator<TelNode>() { public TelNode createFromParcel(Parcel in){ return new TelNode(in); } public TelNode[] newArray(int size){ return new TelNode[size]; } }; public void logTo(){ // Log.i("mNum", mNum); if (mMsgCnt>0){ Iterator<MsgNode> it = mMsgList.iterator(); while(it.hasNext()){ MsgNode node = it.next(); node.logTo(); } } } }