package com.spiddekauga.android.ui;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.AutoCompleteTextView;

/**
 * Instantly auto-complete whenever the field is focus, even when nothing has been written.
 */
public class InstantAutoComplete extends AutoCompleteTextView {

public InstantAutoComplete(Context context) {
	this(context, null);
}

public InstantAutoComplete(Context context, AttributeSet attrs) {
	super(context, attrs);
}

public InstantAutoComplete(Context context, AttributeSet attrs, int defStyleAttr) {
	super(context, attrs, defStyleAttr);
}

public InstantAutoComplete(
		Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
	super(context, attrs, defStyleAttr, defStyleRes);
}

@Override
public boolean enoughToFilter() {
	return true;
}

@Override
public void onFilterComplete(int count) {
	showDropDown();
}

@Override
protected void onFocusChanged(boolean focused, int direction,
							  Rect previouslyFocusedRect) {
	super.onFocusChanged(focused, direction, previouslyFocusedRect);
	if (focused) {
		performFiltering(getText(), 0);
	}
}

}
@@ -896,16 +896,37 @@
 ount) %7B%0A
+%09if (isFocused()) %7B%0A%09
 %09showDro
@@ -934,16 +934,19 @@
 Down();%0A
+%09%7D%0A
 %7D%0A%0A@Over

Fix InstantAutoComplete to not show list when changing the text programmatically