From cbca92d2099a9b3096b7ed6fbe0e5e8758f746fc Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Fri, 6 Mar 2015 22:22:50 +0100 Subject: [PATCH] fixed enter is send option --- .../eu/siacs/conversations/ui/ConversationFragment.java | 9 +++++++-- src/main/java/eu/siacs/conversations/ui/EditMessage.java | 7 +++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 3e0668be0..0bc4c1ef1 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1012,8 +1012,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } @Override - public void onEnterPressed() { - sendMessage(); + public boolean onEnterPressed() { + if (activity.enterIsSend()) { + sendMessage(); + return true; + } else { + return false; + } } @Override diff --git a/src/main/java/eu/siacs/conversations/ui/EditMessage.java b/src/main/java/eu/siacs/conversations/ui/EditMessage.java index 57fa72858..a58cf2b8b 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditMessage.java +++ b/src/main/java/eu/siacs/conversations/ui/EditMessage.java @@ -37,10 +37,9 @@ public class EditMessage extends EditText { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) { - if (keyboardListener != null) { - keyboardListener.onEnterPressed(); + if (keyboardListener != null && keyboardListener.onEnterPressed()) { + return true; } - return true; } return super.onKeyDown(keyCode, event); } @@ -70,7 +69,7 @@ public class EditMessage extends EditText { } public interface KeyboardListener { - public void onEnterPressed(); + public boolean onEnterPressed(); public void onTypingStarted(); public void onTypingStopped(); public void onTextDeleted();