added binding.sendButton.setOnClickListener to MessagesFragment.kt

This commit is contained in:
andrekir
2021-08-31 11:39:55 -03:00
parent 56c8fcddfb
commit 5b26714a1e
2 changed files with 11 additions and 1 deletions

View File

@@ -228,6 +228,17 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.sendButton.setOnClickListener {
debug("sendButton click")
val str = binding.messageInputText.text.toString().trim()
if (str.isNotEmpty())
model.messagesState.sendMessage(str)
binding.messageInputText.setText("") // blow away the string the user just entered
// requireActivity().hideKeyboard()
}
binding.messageInputText.on(EditorInfo.IME_ACTION_DONE) {
debug("did IME action")