Commit 79588c77 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Hide keyboard on cancel reply

parent d36acffa
package chat.rocket.android.layouthelper.chatroom
import android.text.TextUtils
import android.view.View
import chat.rocket.android.widget.AbsoluteUrl
import chat.rocket.android.widget.message.MessageFormLayout
import chat.rocket.core.models.Message
......@@ -42,6 +40,7 @@ class MessageFormManager(private val messageFormLayout: MessageFormLayout, val c
messageFormLayout.setReplyCancelListener({
this.replyMarkDown = ""
messageFormLayout.clearReplyContent()
messageFormLayout.hideKeyboard()
})
}
......
......@@ -238,6 +238,18 @@ public class MessageFormLayout extends LinearLayout {
requestFocusAndShowKeyboard();
}
public void hideKeyboard() {
final EditText editor = getEditor();
editor.post(new Runnable() {
@Override
public void run() {
InputMethodManager inputMethodManager = (InputMethodManager) editor.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(editor.getWindowToken(), 0);
}
});
}
private void requestFocusAndShowKeyboard() {
final EditText editor = getEditor();
editor.post(new Runnable() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment