mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-25 18:22:17 -05:00
40 lines
835 B
Java
40 lines
835 B
Java
|
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();
|
||
|
}
|
||
|
|
||
|
}
|