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 d4ed38a..f610926 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 @@ -98,6 +98,11 @@ public class ConversationFragment extends Fragment */ private ConversationRefreshRunnable refreshRunnable; + /** + * Fragment main progress bar + */ + private ProgressBar main_progress_bar; + /** * Converstion message listView */ @@ -200,6 +205,10 @@ public class ConversationFragment extends Fragment public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + //Main progress bar + main_progress_bar = view.findViewById(R.id.fragment_conversation_progressbar); + display_main_progress_bar(true); + //Conversation messages listView convMessListView = view.findViewById(R.id.fragment_conversation_messageslist); @@ -296,11 +305,17 @@ public class ConversationFragment extends Fragment @Override public void onNoMessage() { + //Hide main progress bar + display_main_progress_bar(false); + } @Override public void onAddMessage(int lastID, @NonNull ArrayList newMessages) { + //Remove main progress bar + display_main_progress_bar(false); + final ArrayList usersToFetch = new ArrayList<>(); //Add the messages to the the main list of messages @@ -525,4 +540,13 @@ public class ConversationFragment extends Fragment new_message_progress_bar.setVisibility(View.GONE); } + + /** + * Update the visibility status of the main progress bar of the fragment + * + * @param visible True to make the progress bar visible + */ + private void display_main_progress_bar(boolean visible){ + main_progress_bar.setVisibility(visible ? View.VISIBLE : View.GONE); + } } diff --git a/app/src/main/res/layout/fragment_conversation.xml b/app/src/main/res/layout/fragment_conversation.xml index 00a9f01..e222e45 100644 --- a/app/src/main/res/layout/fragment_conversation.xml +++ b/app/src/main/res/layout/fragment_conversation.xml @@ -3,6 +3,14 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> + + +