Created
July 2, 2015 10:19
-
-
Save JSBerrocoso/9cf3c03aed06d1bc0076 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.atomic.android.utils.views; | |
import android.content.Context; | |
import android.graphics.Rect; | |
import android.util.AttributeSet; | |
import android.widget.AutoCompleteTextView; | |
/** | |
* Created by J. Santiago Berrocoso on 2/7/15. | |
* Atomic Internet S.L. | |
* [email protected] | |
*/ | |
public class InstantAutocomplete extends AutoCompleteTextView { | |
public InstantAutocomplete(Context context) { | |
super(context); | |
} | |
public InstantAutocomplete(Context arg0, AttributeSet arg1) { | |
super(arg0, arg1); | |
} | |
public InstantAutocomplete(Context arg0, AttributeSet arg1, int arg2) { | |
super(arg0, arg1, arg2); | |
} | |
@Override public boolean enoughToFilter() { | |
return true; | |
} | |
@Override | |
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { | |
super.onFocusChanged(focused, direction, previouslyFocusedRect); | |
if (focused && getAdapter() != null) { | |
performFiltering(getText(), 0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment