@Override
 public int getItemViewType(int position) {
   EMMessage message = mConversation.getAllMessages().get(position);
   MessageViewType type = MessageViewType.parse(message);
   if (type != null) {
     return type.ordinal();
   }
   return 0;
 }
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   EMMessage data = (EMMessage) getItem(position);
   MessageViewType type = MessageViewType.parse(data);
   if (convertView == null) {
     convertView = LayoutInflater.from(mContext).inflate(getItemLayoutByType(type), null);
   }
   bindView(convertView, data, position);
   return convertView;
 }