From 27b306444bf11ca214e3fed7b54745bb323b31a9 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Thu, 31 Jul 2014 13:26:05 +0200 Subject: [PATCH] fixed #326 fixed #202 --- res/layout/fragment_conversation.xml | 8 +- .../ui/ConversationFragment.java | 101 ++++++++++++------ .../siacs/conversations/ui/EditMessage.java | 39 +++++++ 3 files changed, 110 insertions(+), 38 deletions(-) create mode 100644 src/eu/siacs/conversations/ui/EditMessage.java diff --git a/res/layout/fragment_conversation.xml b/res/layout/fragment_conversation.xml index 2d6129846..3f7f27e50 100644 --- a/res/layout/fragment_conversation.xml +++ b/res/layout/fragment_conversation.xml @@ -31,7 +31,7 @@ android:layout_alignParentLeft="true" android:background="@color/primarybackground" > - - + android:textColor="@color/primarytext" + android:imeOptions="flagNoExtractUi"> - + = 1) { messagesView.setSelection(size - 1); } - chatMsg.setText(""); + mEditMessage.setText(""); } protected void updateStatusMessages() { @@ -560,6 +593,6 @@ public class ConversationFragment extends Fragment { } public void clearInputField() { - this.chatMsg.setText(""); + this.mEditMessage.setText(""); } } diff --git a/src/eu/siacs/conversations/ui/EditMessage.java b/src/eu/siacs/conversations/ui/EditMessage.java new file mode 100644 index 000000000..f83020506 --- /dev/null +++ b/src/eu/siacs/conversations/ui/EditMessage.java @@ -0,0 +1,39 @@ +package eu.siacs.conversations.ui; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.KeyEvent; +import android.widget.EditText; + +public class EditMessage extends EditText { + + public EditMessage(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public EditMessage(Context context) { + super(context); + } + + protected OnEnterPressed mOnEnterPressed; + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_ENTER) { + if (mOnEnterPressed != null) { + mOnEnterPressed.onEnterPressed(); + } + return true; + } + return super.onKeyDown(keyCode, event); + } + + public void setOnEnterPressedListener(OnEnterPressed listener) { + this.mOnEnterPressed = listener; + } + + public interface OnEnterPressed { + public void onEnterPressed(); + } + +}