blob: f830205068cc3ebe8bc3174e4134e6a3b2904ec8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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();
}
}
|