// Path: app/src/main/java/com/batsw/anonimitychat/chat/constants/ChatModelConstants.java
// public interface ChatModelConstants {
// 
//     public static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
// 
//     public static final String MESSAGE_EOL = System.getProperty("line.separator");
// 
//     public static final String CHAT_ACTIVITY_INTENT_EXTRA_KEY = "SESSION_ID";
// 
//     public static final long DEFAULT_SESSION_ID = 0L;
// 
//     public static final String MY_TOR_ADDRESS_NA_YET = "Not available yet !";
// 
//     ////////////
//     //PROTOCOL//
//     ///////////
// 
//     public static final String FIRST_CHAT_MESSAGE = "->START<-";
//     public static final String MESSAGE_END_CHAT = "->END<-";
// 
// }
// 
// Path: app/src/main/java/com/batsw/anonimitychat/chat/message/ChatMessage.java
// public class ChatMessage {
//     private String mMessage;
//     private ChatMessageType mChatMessageType;
//     private long mTimeStamp;
// 
//     public ChatMessage(String message, ChatMessageType messageType, long timeStamp) {
//         mMessage = message;
//         mChatMessageType = messageType;
//         mTimeStamp = timeStamp;
//     }
// 
//     public String getMessage() {
//         return mMessage;
//     }
// 
//     public ChatMessageType getChatMessageType() {
//         return mChatMessageType;
//     }
// 
//     public long getTimeStamp() {
//         return mTimeStamp;
//     }
// }
// 
// Path: app/src/main/java/com/batsw/anonimitychat/chat/message/ChatMessageType.java
// public enum ChatMessageType {
//     PARTNER, USER, SYNC, OTHER;
// }


import android.content.Context;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.batsw.anonimitychat.R;
import com.batsw.anonimitychat.chat.constants.ChatModelConstants;
import com.batsw.anonimitychat.chat.message.ChatMessage;
import com.batsw.anonimitychat.chat.message.ChatMessageType;
import java.util.ArrayList;
import java.util.List;
    public int getCount() {
        return mChatMessageList.size();
    }

    @Override
    public Object getItem(int position) {
        return mChatMessageList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        Log.i(LOG, "getView -> ENTER position=" + position + ", convertView=" + convertView + ", viewGroup=" + viewGroup);
        View retVal;
        ChatMessage message = mChatMessageList.get(position);

        if (message.getChatMessageType().equals(ChatMessageType.USER)) {
            retVal = displayMessage(convertView, message, R.layout.user_chat_item);
        } else {
            retVal = displayMessage(convertView, message, R.layout.partner_chat_item);
        }

        Log.i(LOG, "getView -> LEAVE retVal=" + retVal);
        return retVal;
    }

// Path: app/src/main/java/com/batsw/anonimitychat/chat/constants/ChatModelConstants.java
// public interface ChatModelConstants {
// 
//     public static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
// 
//     public static final String MESSAGE_EOL = System.getProperty("line.separator");
// 
//     public static final String CHAT_ACTIVITY_INTENT_EXTRA_KEY = "SESSION_ID";
// 
//     public static final long DEFAULT_SESSION_ID = 0L;
// 
//     public static final String MY_TOR_ADDRESS_NA_YET = "Not available yet !";
// 
//     ////////////
//     //PROTOCOL//
//     ///////////
// 
//     public static final String FIRST_CHAT_MESSAGE = "->START<-";
//     public static final String MESSAGE_END_CHAT = "->END<-";
// 
// }
// 
// Path: app/src/main/java/com/batsw/anonimitychat/chat/message/ChatMessage.java
// public class ChatMessage {
//     private String mMessage;
//     private ChatMessageType mChatMessageType;
//     private long mTimeStamp;
// 
//     public ChatMessage(String message, ChatMessageType messageType, long timeStamp) {
//         mMessage = message;
//         mChatMessageType = messageType;
//         mTimeStamp = timeStamp;
//     }
// 
//     public String getMessage() {
//         return mMessage;
//     }
// 
//     public ChatMessageType getChatMessageType() {
//         return mChatMessageType;
//     }
// 
//     public long getTimeStamp() {
//         return mTimeStamp;
//     }
// }
// 
// Path: app/src/main/java/com/batsw/anonimitychat/chat/message/ChatMessageType.java
// public enum ChatMessageType {
//     PARTNER, USER, SYNC, OTHER;
// }


// Path: app/src/main/java/com/batsw/anonimitychat/chat/ChatListAdapter.java
import android.content.Context;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.batsw.anonimitychat.R;
import com.batsw.anonimitychat.chat.constants.ChatModelConstants;
import com.batsw.anonimitychat.chat.message.ChatMessage;
import com.batsw.anonimitychat.chat.message.ChatMessageType;
import java.util.ArrayList;
import java.util.List;

    public int getCount() {
        return mChatMessageList.size();
    }

    @Override
    public Object getItem(int position) {
        return mChatMessageList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        Log.i(LOG, "getView -> ENTER position=" + position + ", convertView=" + convertView + ", viewGroup=" + viewGroup);
        View retVal;
        ChatMessage message = mChatMessageList.get(position);

        if (message.getChatMessageType().equals(ChatMessageType.USER)) {
            retVal = displayMessage(convertView, message, R.layout.user_chat_item);
        } else {
            retVal = displayMessage(convertView, message, R.layout.partner_chat_item);
        }

        Log.i(LOG, "getView -> LEAVE retVal=" + retVal);
        return retVal;
    }

    private View displayMessage(View convertView, ChatMessage message, int messageViewLayout) {