added binding.sendButton.setOnClickListener to MessagesFragment.kt

1.2-legacy
andrekir 2021-08-31 11:39:55 -03:00
rodzic 56c8fcddfb
commit 5b26714a1e
2 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -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")

Wyświetl plik

@ -34,7 +34,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:singleLine="true"
android:text="" />
</com.google.android.material.textfield.TextInputLayout>