Skip to content

Commit

Permalink
update example app
Browse files Browse the repository at this point in the history
  • Loading branch information
shw0471 committed Mar 24, 2022
1 parent 3ad6c25 commit da97b48
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions example/src/main/java/com/semicolon/example/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit da97b48

Please sign in to comment.