diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/EditMessage.java | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditMessage.java b/src/main/java/de/pixart/messenger/ui/EditMessage.java index 479fd3445..46922b98a 100644 --- a/src/main/java/de/pixart/messenger/ui/EditMessage.java +++ b/src/main/java/de/pixart/messenger/ui/EditMessage.java @@ -21,22 +21,20 @@ import de.pixart.messenger.Config; public class EditMessage extends EditText { - private OnCommitContentListener mCommitContentListener = null; - private String[] mimeTypes = null; - - public interface OnCommitContentListener { - boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts, String[] mimeTypes); - } + private static final InputFilter SPAN_FILTER = new InputFilter() { - public EditMessage(Context context, AttributeSet attrs) { - super(context, attrs); - } + @Override + public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { + return source instanceof Spanned ? source.toString() : source; + } + }; + protected Handler mTypingHandler = new Handler(); + protected KeyboardListener keyboardListener; - public EditMessage(Context context) { - super(context); - } + private OnCommitContentListener mCommitContentListener = null; + private String[] mimeTypes = null; - protected Handler mTypingHandler = new Handler(); + private boolean isUserTyping = false; protected Runnable mTypingTimeout = new Runnable() { @Override @@ -48,11 +46,15 @@ public class EditMessage extends EditText { } }; - private boolean isUserTyping = false; - private boolean lastInputWasTab = false; - protected KeyboardListener keyboardListener; + public EditMessage(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public EditMessage(Context context) { + super(context); + } @Override public boolean onKeyDown(int keyCode, KeyEvent e) { @@ -98,28 +100,6 @@ public class EditMessage extends EditText { } } - public interface KeyboardListener { - boolean onEnterPressed(); - - void onTypingStarted(); - - void onTypingStopped(); - - void onTextDeleted(); - - void onTextChanged(); - - boolean onTabPressed(boolean repeated); - } - - private static final InputFilter SPAN_FILTER = new InputFilter() { - - @Override - public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { - return source instanceof Spanned ? source.toString() : source; - } - }; - @Override public boolean onTextContextMenuItem(int id) { if (id == android.R.id.paste) { @@ -168,4 +148,22 @@ public class EditMessage extends EditText { return ic; } } + + public interface OnCommitContentListener { + boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts, String[] mimeTypes); + } + + public interface KeyboardListener { + boolean onEnterPressed(); + + void onTypingStarted(); + + void onTypingStopped(); + + void onTextDeleted(); + + void onTextChanged(); + + boolean onTabPressed(boolean repeated); + } } |