From da97b48f0468798befe4932f9f46ca19cc3e9d49 Mon Sep 17 00:00:00 2001 From: shw0471 Date: Thu, 24 Mar 2022 20:22:41 +0900 Subject: [PATCH] update example app --- .../java/com/semicolon/example/MainActivity.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/example/src/main/java/com/semicolon/example/MainActivity.kt b/example/src/main/java/com/semicolon/example/MainActivity.kt index e187aaf..ed82861 100644 --- a/example/src/main/java/com/semicolon/example/MainActivity.kt +++ b/example/src/main/java/com/semicolon/example/MainActivity.kt @@ -24,15 +24,24 @@ class MainActivity : AppCompatActivity() { rvChat.adapter = chatListAdapter btnSendBroadcast.setOnClickListener { val broadcastMessage = binding.etSendBroadcast.text.toString() - if (broadcastMessage.isNotEmpty()) viewModel.sendBroadcastMessage(broadcastMessage) + if (broadcastMessage.isNotEmpty()) { + binding.etSendBroadcast.setText("") + viewModel.sendBroadcastMessage(broadcastMessage) + } } btnJoinRoom.setOnClickListener { val roomId = binding.etJoinRoom.text.toString() - if (roomId.isNotEmpty()) viewModel.joinChatRoom(roomId) + if (roomId.isNotEmpty()) { + binding.etJoinRoom.setText("") + viewModel.joinChatRoom(roomId) + } } btnSendMessage.setOnClickListener { val roomMessage = binding.etSendMassage.text.toString() - if (roomMessage.isNotEmpty()) viewModel.sendRoomMessage(roomMessage) + if (roomMessage.isNotEmpty()) { + binding.etSendMassage.setText("") + viewModel.sendRoomMessage(roomMessage) + } } } observe()