mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 15:59:29 +00:00
Added progress bar on conversation fragment
This commit is contained in:
parent
cd3570c114
commit
4d71757a92
@ -98,6 +98,11 @@ public class ConversationFragment extends Fragment
|
|||||||
*/
|
*/
|
||||||
private ConversationRefreshRunnable refreshRunnable;
|
private ConversationRefreshRunnable refreshRunnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragment main progress bar
|
||||||
|
*/
|
||||||
|
private ProgressBar main_progress_bar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converstion message listView
|
* Converstion message listView
|
||||||
*/
|
*/
|
||||||
@ -200,6 +205,10 @@ public class ConversationFragment extends Fragment
|
|||||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, 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
|
//Conversation messages listView
|
||||||
convMessListView = view.findViewById(R.id.fragment_conversation_messageslist);
|
convMessListView = view.findViewById(R.id.fragment_conversation_messageslist);
|
||||||
|
|
||||||
@ -296,11 +305,17 @@ public class ConversationFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onNoMessage() {
|
public void onNoMessage() {
|
||||||
|
|
||||||
|
//Hide main progress bar
|
||||||
|
display_main_progress_bar(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAddMessage(int lastID, @NonNull ArrayList<ConversationMessage> newMessages) {
|
public void onAddMessage(int lastID, @NonNull ArrayList<ConversationMessage> newMessages) {
|
||||||
|
|
||||||
|
//Remove main progress bar
|
||||||
|
display_main_progress_bar(false);
|
||||||
|
|
||||||
final ArrayList<Integer> usersToFetch = new ArrayList<>();
|
final ArrayList<Integer> usersToFetch = new ArrayList<>();
|
||||||
|
|
||||||
//Add the messages to the the main list of messages
|
//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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,14 @@
|
|||||||
android:orientation="vertical" android:layout_width="match_parent"
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- Loading wheel -->
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/fragment_conversation_progressbar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"/>
|
||||||
|
|
||||||
<!-- Messages -->
|
<!-- Messages -->
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/fragment_conversation_messageslist"
|
android:id="@+id/fragment_conversation_messageslist"
|
||||||
|
Loading…
Reference in New Issue
Block a user