pchmn / MaterialChipsInput

Implementation of Material Design Chips component for Android
Apache License 2.0
2.63k stars 382 forks source link

hide the filterable list + request focus to open keyboard #98

Open crearo opened 6 years ago

crearo commented 6 years ago

For the most part of it, this library is great. However, I've been pulling my hair over simple issues.

  1. How do I hide the filterable list manually? Once it's open, there's no way to close it other than clicking an item. I've tried
    • mChipsInput.setFilterableList(new ArrayList<ChipInterface>());
    • mChipsInput.getEditText().getFilterableListView().fadeOut();
    • mChipsInput.getEditText().getFilterableListView().fadeOut();
    • mChipsInput.getFilterableList().clear(), and called mChipsInput.invalidate() afterwards

The view logic is just so poorly designed, none of these seem to work. I've been digging into the source code and see that fadeOut() is to hide it from within the library. Why doesn't it work when used as an api?

  1. Open the soft-keyboard automatically when the mChipsInput is clicked. I've tried the following:

    mChipsInput.requestFocus();
    mChipsInput.getEditText().requestFocus();
    openKeyboard(mChipsInput.getEditText());  // this uses the InputManager to open the keyboard on this view.
    mChipsInput.getEditText().performClick();

Again, none of these work!

crearo commented 6 years ago

Turns out it was a really silly line in the code that was causing the issue as for 1. I've sent a PR #99

It creates the edittext only once, instead of creating a new one each time getEditText is called.