From 7f3a6eca4d299b6daaf9f4bd439d306fa7c42577 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 20 Dec 2017 18:10:48 +0100 Subject: [PATCH] Conversation messages images are displayed --- .../conversations/ConversationMessage.java | 9 +++ .../ConversationMessageAdapter.java | 55 ++++++++++---- .../fragment_conversation_message_item.xml | 74 ++++++++++++++----- app/src/main/res/values/strings.xml | 1 + 4 files changed, 105 insertions(+), 34 deletions(-) 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 fee1a7e..c4a4253 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 @@ -100,6 +100,15 @@ public class ConversationMessage { return image_path; } + /** + * Check whether the message has an associated image or not + * + * @return TRUE if the message has an associated image / FALSE else + */ + public boolean hasImage(){ + return image_path != null; + } + /** * Get the path of the image associated with the 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 07cda97..5631605 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 @@ -88,8 +88,9 @@ public class ConversationMessageAdapter extends ArrayAdapter @@ -34,21 +33,40 @@ android:layout_height="26dp" android:layout_gravity="center" android:layout_marginEnd="5dp" - android:src="@drawable/default_account_image" - android:contentDescription="@string/user_image_description"/> + android:contentDescription="@string/user_image_description" + android:src="@drawable/default_account_image"/> - + android:orientation="vertical" + android:paddingBottom="5dp" + android:paddingEnd="15dp" + android:paddingStart="15dp"> + + + + + + + @@ -71,18 +89,38 @@ android:contentDescription="@string/user_image_description" android:src="@drawable/default_account_image" /> - + android:paddingStart="15dp"> + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a401bd6..15adaf2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -52,4 +52,5 @@ date_hours Couldn\'t get user information ! Could not load messages! + Conversation message image