-
-
Save logcat/8e1f5acd07502bcc08ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.graphics.Rect; | |
import android.support.v7.widget.AppCompatAutoCompleteTextView; | |
import android.util.AttributeSet; | |
import android.view.View; | |
public class InstantAutoCompleteTextView extends AppCompatAutoCompleteTextView { | |
public InstantAutoCompleteTextView(Context context) { | |
super(context); | |
} | |
public InstantAutoCompleteTextView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public InstantAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
} | |
@Override | |
public boolean enoughToFilter() { | |
return true; | |
} | |
@Override | |
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { | |
super.onFocusChanged(focused, direction, previouslyFocusedRect); | |
if (getWindowVisibility() == View.GONE) { | |
return; | |
} | |
if (focused && getAdapter() != null) { | |
performFiltering(getText(), 0); | |
showDropDown(); | |
} | |
} | |
@Override | |
public boolean performClick() { | |
showDropDown(); | |
return super.performClick(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment