package com.ruenzuo.messageslistview.models;

import java.util.Date;

/**
 * Created by ruenzuo on 27/05/14.
 */
public class Message {

    private Date date;
    private String text;
    private MessageType type;

    public Message(MessageBuilder messageBuilder) {
        this.date = messageBuilder.date;
        this.text = messageBuilder.text;
        this.type = messageBuilder.type;
    }


    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public MessageType getType() {
        return type;
    }

    public void setType(MessageType type) {
        this.type = type;
    }

    public static class MessageBuilder {

        private final MessageType type;
        private Date date;
        private String text;

        public MessageBuilder(MessageType type) {
            this.type = type;
        }

        public MessageBuilder date(Date date) {
            this.date = date;
            return this;
        }

        public MessageBuilder text(String text) {
            this.text = text;
            return this;
        }

        public Message build() {
            return new Message(this);
        }

    }

}

@@ -50,95 +50,262 @@
 ort 
-java.util.Date;%0A%0A/**%0A * Created by ruenzuo on 27/05/14.%0A */%0Apublic class Message %7B%0A%0A   
+com.activeandroid.Model;%0Aimport com.activeandroid.annotation.Column;%0Aimport com.activeandroid.annotation.Table;%0A%0Aimport java.util.Date;%0A%0A/**%0A * Created by ruenzuo on 27/05/14.%0A */%0A@Table(name = %22Message%22)%0Apublic class Message extends Model %7B%0A%0A    @Column
  pri
@@ -320,24 +320,32 @@
 e date;%0A    
+@Column 
 private Stri
@@ -361,33 +361,146 @@
     
-private MessageType type;
+@Column private int msgType;%0A    @Column private String name;%0A    private MessageType type;%0A%0A    public Message() %7B%0A        super();%0A    %7D
 %0A%0A  
@@ -676,16 +676,103 @@
 pe;%0A
+        this.name = messageBuilder.name;%0A        this.msgType = messageBuilder.msgType;%0A
     %7D%0A%0A
-%0A
     
@@ -885,32 +885,167 @@
  = date;%0A    %7D%0A%0A
+    public String getName() %7B%0A        return this.name;%0A    %7D%0A%0A    public void setName(String name) %7B%0A        this.name = name;%0A    %7D%0A%0A
     public Strin
@@ -1208,20 +1208,96 @@
  return 
-type
+msgType == 0 ? MessageType.MESSAGE_TYPE_SENT : MessageType.MESSAGE_TYPE_RECEIVED
 ;%0A    %7D%0A
@@ -1511,16 +1511,74 @@
 ng text;
+%0A        private int msgType;%0A        private String name;
 %0A%0A      
@@ -1647,24 +1647,65 @@
 ype = type;%0A
+            this.msgType = type.toInt();%0A
         %7D%0A%0A 
@@ -1925,32 +1925,148 @@
 his;%0A        %7D%0A%0A
+        public MessageBuilder name(String name) %7B%0A            this.name = name;%0A            return this;%0A        %7D%0A%0A
         public M

integrate message with ActiveAndroid