diff --git a/.idea/misc.xml b/.idea/misc.xml
index 33952c6..503aca7 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -55,7 +55,7 @@
-
+
diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessage.java b/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessage.java
index 5f9ba07..fee1a7e 100644
--- a/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessage.java
+++ b/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessage.java
@@ -127,9 +127,8 @@ public class ConversationMessage {
*
* @return The content
*/
- @NonNull
public String getContent() {
- return content != null ? content : "";
+ return content;
}
/**
diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessageAdapter.java b/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessageAdapter.java
index 99ffc7f..d32e4b2 100644
--- a/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessageAdapter.java
+++ b/app/src/main/java/org/communiquons/android/comunic/client/data/conversations/ConversationMessageAdapter.java
@@ -1,14 +1,20 @@
package org.communiquons.android.comunic.client.data.conversations;
import android.content.Context;
+import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.util.Log;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
+import android.widget.ImageView;
import android.widget.TextView;
+import org.communiquons.android.comunic.client.R;
+
import java.util.ArrayList;
/**
@@ -20,14 +26,58 @@ import java.util.ArrayList;
public class ConversationMessageAdapter extends ArrayAdapter {
+ /**
+ * Debug tag
+ */
+ private static final String TAG = "ConversationMessageAdap";
+
+ /**
+ * Possible colors for the message
+ */
+ private int usercolorText;
+ private int usercolorBackground;
+ private int otherusercolorText;
+ private int otherusercolorBackground;
+
+ /**
+ * The ID of the current user
+ */
+ private int userID;
+
/**
* Public class constructor
*
* @param context The context of execution of the application
* @param list The dataset
+ * @param userID The ID of the current user
*/
- public ConversationMessageAdapter(Context context, ArrayList list){
+ public ConversationMessageAdapter(Context context, ArrayList list,
+ int userID){
super(context, 0, list);
+
+ //Set user ID
+ this.userID = userID;
+
+ //Get the color codes
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ usercolorText = getContext().getResources().
+ getColor(R.color.conversation_user_messages_textColor, getContext().getTheme());
+ usercolorBackground = getContext().getResources().
+ getColor(R.color.conversation_user_messages_background, getContext().getTheme());
+ otherusercolorText = getContext().getResources().
+ getColor(R.color.conversation_otheruser_messages_textColor, getContext().getTheme());
+ otherusercolorBackground = getContext().getResources().
+ getColor(R.color.conversation_otheruser_messages_background, getContext().getTheme());
+ } else {
+ usercolorText = getContext().getResources().
+ getColor(R.color.conversation_user_messages_textColor);
+ usercolorBackground = getContext().getResources().
+ getColor(R.color.conversation_user_messages_background);
+ otherusercolorText = getContext().getResources().
+ getColor(R.color.conversation_otheruser_messages_textColor);
+ otherusercolorBackground = getContext().getResources().
+ getColor(R.color.conversation_otheruser_messages_background);
+ }
}
@@ -35,11 +85,51 @@ public class ConversationMessageAdapter extends ArrayAdapter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 2b15758..1beb41b 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -8,4 +8,10 @@
#aaa
#5b5b5b
#303F9F
+
+
+ #3F51B5
+ #FFFFFF
+ #aaa
+ #000000