From 485f9f5f4c5f0ad33f7c5e9ef4ff7f97b0db83f1 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 20 Dec 2017 17:48:47 +0100 Subject: [PATCH] Conversations message auto-scroll --- .../fragments/ConversationFragment.java | 7 +++++- ...nt_conversation_message_currentuser_bg.xml | 25 +++++++++++++++++++ ...ment_conversation_message_otheruser_bg.xml | 25 +++++++++++++++++++ .../main/res/layout/fragment_conversation.xml | 2 ++ .../fragment_conversation_message_item.xml | 8 +++--- app/src/main/res/values/colors.xml | 2 +- 6 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/drawable/fragment_conversation_message_currentuser_bg.xml create mode 100644 app/src/main/res/drawable/fragment_conversation_message_otheruser_bg.xml diff --git a/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java index a25ec27..8b44037 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationFragment.java @@ -72,6 +72,11 @@ public class ConversationFragment extends Fragment */ private ConversationRefreshRunnable refreshRunnable; + /** + * Converstion message listView + */ + private ListView convMessListView; + /** * Conversation messages helper */ @@ -121,7 +126,7 @@ public class ConversationFragment extends Fragment super.onViewCreated(view, savedInstanceState); //Conversation messages listView - ListView convMessListView = view.findViewById(R.id.fragment_conversation_messageslist); + convMessListView = view.findViewById(R.id.fragment_conversation_messageslist); //Need user ID int userID = new AccountUtils(getActivity()).get_current_user_id(); diff --git a/app/src/main/res/drawable/fragment_conversation_message_currentuser_bg.xml b/app/src/main/res/drawable/fragment_conversation_message_currentuser_bg.xml new file mode 100644 index 0000000..a4577fa --- /dev/null +++ b/app/src/main/res/drawable/fragment_conversation_message_currentuser_bg.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/fragment_conversation_message_otheruser_bg.xml b/app/src/main/res/drawable/fragment_conversation_message_otheruser_bg.xml new file mode 100644 index 0000000..b4b91da --- /dev/null +++ b/app/src/main/res/drawable/fragment_conversation_message_otheruser_bg.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_conversation.xml b/app/src/main/res/layout/fragment_conversation.xml index ee4cf7c..259bb99 100644 --- a/app/src/main/res/layout/fragment_conversation.xml +++ b/app/src/main/res/layout/fragment_conversation.xml @@ -9,6 +9,8 @@ android:layout_height="0dp" android:layout_weight="1" android:divider="@null" + android:stackFromBottom="true" + android:transcriptMode="alwaysScroll" /> \ No newline at end of file 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 ceb41b0..798fadf 100644 --- a/app/src/main/res/layout/fragment_conversation_message_item.xml +++ b/app/src/main/res/layout/fragment_conversation_message_item.xml @@ -34,7 +34,8 @@ android:layout_height="26dp" android:layout_gravity="center" android:layout_marginEnd="5dp" - android:src="@drawable/default_account_image" /> + android:src="@drawable/default_account_image" + android:contentDescription="@string/user_image_description"/> @@ -67,6 +68,7 @@ android:layout_alignParentEnd="true" android:layout_gravity="end" android:layout_marginStart="5dp" + android:contentDescription="@string/user_image_description" android:src="@drawable/default_account_image" /> #3F51B5 #FFFFFF - #aaa + #D8D8D8 #000000