Added progress wheel while sending messages

This commit is contained in:
Pierre 2017-12-25 15:35:38 +01:00
parent fee72680ae
commit 197bd9fe40
2 changed files with 18 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ListView; import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast; import android.widget.Toast;
import org.communiquons.android.comunic.client.R; import org.communiquons.android.comunic.client.R;
@ -114,6 +115,11 @@ public class ConversationFragment extends Fragment
*/ */
private ImageButton send_button; private ImageButton send_button;
/**
* Conversation new message progress bar
*/
private ProgressBar new_message_progress_bar;
/** /**
* Conversation add image button * Conversation add image button
*/ */
@ -192,6 +198,7 @@ public class ConversationFragment extends Fragment
new_message_content = view.findViewById(R.id.fragment_conversation_newmessage_content); new_message_content = view.findViewById(R.id.fragment_conversation_newmessage_content);
pick_image_button = view.findViewById(R.id.fragment_conversation_newmessage_pickimage); pick_image_button = view.findViewById(R.id.fragment_conversation_newmessage_pickimage);
send_button = view.findViewById(R.id.fragment_conversation_newmessage_send); send_button = view.findViewById(R.id.fragment_conversation_newmessage_send);
new_message_progress_bar = view.findViewById(R.id.fragment_conversation_newmessage_loading);
//Make send button lives //Make send button lives
send_button.setOnClickListener(new View.OnClickListener() { send_button.setOnClickListener(new View.OnClickListener() {
@ -215,6 +222,9 @@ public class ConversationFragment extends Fragment
return true; return true;
} }
}); });
//Hide new message sending wheel
new_message_progress_bar.setVisibility(View.GONE);
} }
@Override @Override
@ -390,7 +400,8 @@ public class ConversationFragment extends Fragment
} }
//Hide the send button //Hide the send button
send_button.setVisibility(View.INVISIBLE); send_button.setVisibility(View.GONE);
new_message_progress_bar.setVisibility(View.VISIBLE);
//Get the message content //Get the message content
final String message_content = new_message_content.getText()+""; final String message_content = new_message_content.getText()+"";
@ -435,6 +446,7 @@ public class ConversationFragment extends Fragment
//Make the "send" button available again //Make the "send" button available again
send_button.setVisibility(View.VISIBLE); send_button.setVisibility(View.VISIBLE);
new_message_progress_bar.setVisibility(View.GONE);
} }
} }

View File

@ -42,6 +42,11 @@
android:src="@android:drawable/ic_menu_send" android:src="@android:drawable/ic_menu_send"
android:contentDescription="@string/conversation_message_send"/> android:contentDescription="@string/conversation_message_send"/>
<ProgressBar
android:id="@+id/fragment_conversation_newmessage_loading"
android:layout_width="@dimen/fragment_conversation_buttons_width"
android:layout_height="@dimen/fragment_conversation_buttons_height" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>