From f660ca1f9c726c9b16e5bae2902bdb3638f7e5e7 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 31 Dec 2017 15:04:41 +0100 Subject: [PATCH] Improved messages appearance --- .../ConversationMessageAdapter.java | 93 ++++++----- .../comunic/client/data/utils/UiUtils.java | 31 ++++ .../fragment_conversation_message_item.xml | 146 +++++------------- 3 files changed, 128 insertions(+), 142 deletions(-) create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/data/utils/UiUtils.java 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 5631605..e3f5a38 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 @@ -5,16 +5,19 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.ArrayMap; 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.LinearLayout; import android.widget.TextView; import org.communiquons.android.comunic.client.R; import org.communiquons.android.comunic.client.data.ImageLoad.ImageLoadManager; import org.communiquons.android.comunic.client.data.UsersInfo.UserInfo; +import org.communiquons.android.comunic.client.data.utils.UiUtils; import java.util.ArrayList; @@ -87,48 +90,57 @@ public class ConversationMessageAdapter extends ArrayAdapter= Build.VERSION_CODES.M) { + return context.getResources().getColor(color_id, context.getTheme()); + } + else { + return context.getResources().getColor(color_id); + } + } +} diff --git a/app/src/main/res/layout/fragment_conversation_message_item.xml b/app/src/main/res/layout/fragment_conversation_message_item.xml index e4be02b..d1e380e 100644 --- a/app/src/main/res/layout/fragment_conversation_message_item.xml +++ b/app/src/main/res/layout/fragment_conversation_message_item.xml @@ -9,119 +9,57 @@ android:paddingStart="5dp" android:paddingTop="5dp"> - + + - - - - - - - - - - - - - - - - - - - - - - + android:orientation="horizontal" + android:padding="5dp" + android:background="@drawable/fragment_conversation_message_otheruser_bg"> + android:src="@drawable/default_account_image"/> - + android:layout_weight="1" + android:layout_gravity="center" + android:padding="5dp" + android:textColor="@color/conversation_otheruser_messages_textColor" + tools:text="A message" /> - + - - - - - - - - - \ No newline at end of file + + +