Autocomplete @ mentions in the composer. Closes #103
This commit is contained in:
parent
8994d81c66
commit
74aa866647
5 changed files with 168 additions and 8 deletions
|
|
@ -18,18 +18,18 @@ package com.keylesspalace.tusky.view;
|
|||
import android.content.Context;
|
||||
import android.support.v13.view.inputmethod.EditorInfoCompat;
|
||||
import android.support.v13.view.inputmethod.InputConnectionCompat;
|
||||
import android.support.v7.widget.AppCompatEditText;
|
||||
import android.support.v7.widget.AppCompatMultiAutoCompleteTextView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
import com.keylesspalace.tusky.util.Assert;
|
||||
|
||||
public class EditTextTyped extends AppCompatEditText {
|
||||
public class EditTextTyped extends AppCompatMultiAutoCompleteTextView {
|
||||
|
||||
InputConnectionCompat.OnCommitContentListener onCommitContentListener;
|
||||
String[] mimeTypes;
|
||||
private OnPasteListener mOnPasteListener;
|
||||
private OnPasteListener onPasteListener;
|
||||
|
||||
public EditTextTyped(Context context) {
|
||||
super(context);
|
||||
|
|
@ -40,7 +40,7 @@ public class EditTextTyped extends AppCompatEditText {
|
|||
}
|
||||
|
||||
public void addOnPasteListener(OnPasteListener mOnPasteListener) {
|
||||
this.mOnPasteListener = mOnPasteListener;
|
||||
this.onPasteListener = mOnPasteListener;
|
||||
}
|
||||
|
||||
public void setMimeTypes(String[] types,
|
||||
|
|
@ -68,6 +68,7 @@ public class EditTextTyped extends AppCompatEditText {
|
|||
switch (id) {
|
||||
case android.R.id.paste:
|
||||
onPaste();
|
||||
break;
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
|
@ -76,8 +77,9 @@ public class EditTextTyped extends AppCompatEditText {
|
|||
* Text was pasted into the EditText.
|
||||
*/
|
||||
public void onPaste() {
|
||||
if (mOnPasteListener != null)
|
||||
mOnPasteListener.onPaste();
|
||||
if (onPasteListener != null) {
|
||||
onPasteListener.onPaste();
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnPasteListener {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue