From e393de6832726b770253bdc3d6589973bbfffc49 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 8 Nov 2017 13:25:38 +0100 Subject: [PATCH] disable auto fill on edit message box --- .../conversations/ui/widget/EditMessage.java | 79 ++++++++++--------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java b/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java index ca73564f5..2f183b371 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java @@ -21,23 +21,18 @@ import eu.siacs.conversations.Config; public class EditMessage extends EmojiEditText { - public interface OnCommitContentListener { - boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts, String[] mimeTypes); - } + 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; + } + }; + protected Handler mTypingHandler = new Handler(); + protected KeyboardListener keyboardListener; private OnCommitContentListener mCommitContentListener = null; private String[] mimeTypes = null; - - public EditMessage(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public EditMessage(Context context) { - super(context); - } - - protected Handler mTypingHandler = new Handler(); - + private boolean isUserTyping = false; protected Runnable mTypingTimeout = new Runnable() { @Override public void run() { @@ -47,12 +42,15 @@ public class EditMessage extends EmojiEditText { } } }; - - 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) { @@ -72,9 +70,14 @@ public class EditMessage extends EmojiEditText { return super.onKeyDown(keyCode, e); } + @Override + public int getAutofillType() { + return AUTOFILL_TYPE_NONE; + } + @Override public void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { - super.onTextChanged(text,start,lengthBefore,lengthAfter); + super.onTextChanged(text, start, lengthBefore, lengthAfter); lastInputWasTab = false; if (this.mTypingHandler != null && this.keyboardListener != null) { this.mTypingHandler.removeCallbacks(mTypingTimeout); @@ -98,23 +101,6 @@ public class EditMessage extends EmojiEditText { } } - 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) { @@ -157,9 +143,26 @@ public class EditMessage extends EmojiEditText { return EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes); } }); - } - else { + } else { 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); + } }