diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 33952c6..99202cc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,36 +1,16 @@ - - - - - @@ -45,17 +25,7 @@ - - - - - - - - - - - + diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationFragment.java index 3d910ed..b8e4168 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationFragment.java @@ -354,9 +354,7 @@ public class ConversationFragment extends Fragment display_not_msg_notice(false); //Add the messages to the the main list of messages - for(ConversationMessage message : newMessages){ - messagesList.add(message); - } + messagesList.addAll(newMessages); convMessAdapter.notifyDataSetChanged(); last_message_id = lastID; @@ -654,6 +652,11 @@ public class ConversationFragment extends Fragment } + @Override + public void onReachBottom() { + + } + /** * Actions to do once we downloaded older messages from the server * diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/OnScrollChangeDetectListener.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/OnScrollChangeDetectListener.java index 2a3aa46..d3d1a79 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/OnScrollChangeDetectListener.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/OnScrollChangeDetectListener.java @@ -16,4 +16,9 @@ public interface OnScrollChangeDetectListener { */ void onReachTop(); + /** + * This method is triggered when the user reach the bottom (last item) of the list view + */ + void onReachBottom(); + } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/ScrollListView.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/ScrollListView.java index 87d5abc..f4bd55f 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/ScrollListView.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/ScrollListView.java @@ -79,9 +79,16 @@ public class ScrollListView extends android.widget.ListView { visibleItemCount, totalItemCount); + //Check if the user reached the top of the view if(onScrollChangeDetectListener != null && firstVisibleItem == 0 && visibleItemCount > 0) onScrollChangeDetectListener.onReachTop(); + + + //Check if the user reached the bottom of the view + if(onScrollChangeDetectListener != null && totalItemCount > 0 && + firstVisibleItem + visibleItemCount == totalItemCount) + onScrollChangeDetectListener.onReachBottom(); } });