From c49859529cde662c1272c0bc1f8ae8a0004f5f4d Mon Sep 17 00:00:00 2001 From: Artem Shipovskiy Date: Sun, 13 Mar 2016 19:06:58 +0500 Subject: Insert /me on long click send button --- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index ca996b505..6abf76c25 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -320,6 +320,16 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } } }; + private View.OnLongClickListener mSendButtonLongListener = new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + final String body = mEditMessage.getText().toString(); + if (body.length() == 0) { + mEditMessage.getText().insert(0, "/me "); + } + return true; + } + }; private OnClickListener clickToMuc = new OnClickListener() { @Override @@ -445,6 +455,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa mSendButton = (ImageButton) view.findViewById(R.id.textSendButton); mSendButton.setOnClickListener(this.mSendButtonListener); + mSendButton.setOnLongClickListener(this.mSendButtonLongListener); snackbar = (RelativeLayout) view.findViewById(R.id.snackbar); snackbarMessage = (TextView) view.findViewById(R.id.snackbar_message); -- cgit v1.2.3