diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-07-31 13:26:05 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-07-31 13:26:05 +0200 |
commit | 27b306444bf11ca214e3fed7b54745bb323b31a9 (patch) | |
tree | 47856c92186f0a5680cb1214eb583f5b117f9dea /src/eu/siacs/conversations/ui/EditMessage.java | |
parent | e3cec50d1f5412cf0da4d00476e2f49b7059fd69 (diff) |
fixed #326 fixed #202
Diffstat (limited to 'src/eu/siacs/conversations/ui/EditMessage.java')
-rw-r--r-- | src/eu/siacs/conversations/ui/EditMessage.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/ui/EditMessage.java b/src/eu/siacs/conversations/ui/EditMessage.java new file mode 100644 index 00000000..f8302050 --- /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(); + } + +} |