disable auto fill on edit message box
This commit is contained in:
parent
de46192a8d
commit
e393de6832
|
@ -21,23 +21,18 @@ import eu.siacs.conversations.Config;
|
||||||
|
|
||||||
public class EditMessage extends EmojiEditText {
|
public class EditMessage extends EmojiEditText {
|
||||||
|
|
||||||
public interface OnCommitContentListener {
|
private static final InputFilter SPAN_FILTER = new InputFilter() {
|
||||||
boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts, String[] mimeTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@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 OnCommitContentListener mCommitContentListener = null;
|
||||||
private String[] mimeTypes = null;
|
private String[] mimeTypes = null;
|
||||||
|
private boolean isUserTyping = false;
|
||||||
public EditMessage(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public EditMessage(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Handler mTypingHandler = new Handler();
|
|
||||||
|
|
||||||
protected Runnable mTypingTimeout = new Runnable() {
|
protected Runnable mTypingTimeout = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -47,12 +42,15 @@ public class EditMessage extends EmojiEditText {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean isUserTyping = false;
|
|
||||||
|
|
||||||
private boolean lastInputWasTab = false;
|
private boolean lastInputWasTab = false;
|
||||||
|
|
||||||
protected KeyboardListener keyboardListener;
|
public EditMessage(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditMessage(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent e) {
|
public boolean onKeyDown(int keyCode, KeyEvent e) {
|
||||||
|
@ -72,9 +70,14 @@ public class EditMessage extends EmojiEditText {
|
||||||
return super.onKeyDown(keyCode, e);
|
return super.onKeyDown(keyCode, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAutofillType() {
|
||||||
|
return AUTOFILL_TYPE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
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;
|
lastInputWasTab = false;
|
||||||
if (this.mTypingHandler != null && this.keyboardListener != null) {
|
if (this.mTypingHandler != null && this.keyboardListener != null) {
|
||||||
this.mTypingHandler.removeCallbacks(mTypingTimeout);
|
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
|
@Override
|
||||||
public boolean onTextContextMenuItem(int id) {
|
public boolean onTextContextMenuItem(int id) {
|
||||||
if (id == android.R.id.paste) {
|
if (id == android.R.id.paste) {
|
||||||
|
@ -157,9 +143,26 @@ public class EditMessage extends EmojiEditText {
|
||||||
return EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes);
|
return EditMessage.this.mCommitContentListener.onCommitContent(inputContentInfo, flags, opts, mimeTypes);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return ic;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue