-
-
Save jezinka/6b62c8711f18036e37dd5401c33d31b9 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
final EditText filterEditText = (EditText) addIngredientView.findViewById(R.id.name_filter); | |
filterEditText.addTextChangedListener(new TextWatcher() { | |
@Override | |
public void onTextChanged(CharSequence s, int start, int before, int count) { | |
Filter filter = ingredientListAdapter.getFilter(); | |
filter.filter(s, new Filter.FilterListener() { | |
@Override | |
public void onFilterComplete(int count) { | |
int icon = count == 0 ? android.R.drawable.ic_menu_add : 0; | |
filterEditText.setCompoundDrawablesWithIntrinsicBounds(0, 0, icon, 0); | |
} | |
}); | |
} | |
@Override | |
public void beforeTextChanged(CharSequence s, int start, int count, int after) { | |
} | |
@Override | |
public void afterTextChanged(Editable s) { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment