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(); + } + +}