Made preventing sending an empty message

This commit is contained in:
ChronosX88 2019-04-10 19:02:02 +04:00
parent beec4cf4e2
commit 07285c4845

View File

@ -50,6 +50,9 @@ public class ChatActivity extends AppCompatActivity implements IChatViewContract
messageTextEdit = findViewById(R.id.message_input); messageTextEdit = findViewById(R.id.message_input);
sendMessageButton = findViewById(R.id.send_button); sendMessageButton = findViewById(R.id.send_button);
sendMessageButton.setOnClickListener((v) -> { sendMessageButton.setOnClickListener((v) -> {
if(messageTextEdit.getText().toString().equals("")) {
return;
}
presenter.sendMessage(messageTextEdit.getText().toString()); presenter.sendMessage(messageTextEdit.getText().toString());
messageTextEdit.setText(""); messageTextEdit.setText("");
messageList.scrollToPosition(chatAdapter.getItemCount()-1); messageList.scrollToPosition(chatAdapter.getItemCount()-1);