mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 13:19:52 +01:00
Merge branch '1129-send-on-ctrl-enter' into 'master'
send message on ctrl + enter Closes #1129 See merge request akwizgran/briar!649
This commit is contained in:
@@ -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
|
|||||||
hideEmojiDrawer();
|
hideEmojiDrawer();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (keyCode == KEYCODE_ENTER && event.isCtrlPressed()) {
|
||||||
|
trySendMessage();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
ui.sendButton.setOnClickListener(v -> {
|
ui.sendButton.setOnClickListener(v -> trySendMessage());
|
||||||
if (listener != null) {
|
|
||||||
listener.onSendClick(ui.editText.getText().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
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()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user