Skip to content
Snippets Groups Projects
Commit 49a6f2af authored by akwizgran's avatar akwizgran
Browse files

Merge branch '1129-send-on-ctrl-enter' into 'master'

send message on ctrl + enter

Closes #1129

See merge request akwizgran/briar!649
parents a1cfc0ec 3d6c02c2
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ import javax.annotation.Nullable; ...@@ -28,6 +28,7 @@ import javax.annotation.Nullable;
import static android.content.Context.INPUT_METHOD_SERVICE; import static android.content.Context.INPUT_METHOD_SERVICE;
import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static android.view.KeyEvent.KEYCODE_BACK; import static android.view.KeyEvent.KEYCODE_BACK;
import static android.view.KeyEvent.KEYCODE_ENTER;
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT; import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
@UiThread @UiThread
...@@ -82,16 +83,22 @@ public class TextInputView extends KeyboardAwareLinearLayout ...@@ -82,16 +83,22 @@ public class TextInputView extends KeyboardAwareLinearLayout
hideEmojiDrawer(); hideEmojiDrawer();
return true; return true;
} }
return false; if (keyCode == KEYCODE_ENTER && event.isCtrlPressed()) {
}); trySendMessage();
ui.sendButton.setOnClickListener(v -> { return true;
if (listener != null) {
listener.onSendClick(ui.editText.getText().toString());
} }
return false;
}); });
ui.sendButton.setOnClickListener(v -> trySendMessage());
ui.emojiDrawer.setEmojiEventListener(this); ui.emojiDrawer.setEmojiEventListener(this);
} }
private void trySendMessage() {
if (listener != null) {
listener.onSendClick(ui.editText.getText().toString());
}
}
@Override @Override
public void setVisibility(int visibility) { public void setVisibility(int visibility) {
if (visibility == GONE && isKeyboardOpen()) { if (visibility == GONE && isKeyboardOpen()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment