Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutocompleteResolver/Popover refactor #22

Open
vishna opened this issue Mar 4, 2015 · 0 comments
Open

AutocompleteResolver/Popover refactor #22

vishna opened this issue Mar 4, 2015 · 0 comments

Comments

@vishna
Copy link
Contributor

vishna commented Mar 4, 2015

The scope of this ticket is a refactor of the current ChipsEditText auto suggestions code in order to achieve higher configurability and modularity.

See the Notes app for the reference and files Edit.java & EditView.java for a working example.

Whenever user wants to add a bubble using Add Bubble button the AutocompletePopover.show gets called. A change in ChipsEditText.onTextChanged can trigger suggestion search using provided AutocompleteResolver which is maintained by AutocompleteManager. Once search is complete, the result is populated back to AutocompletePopover.

Limitations:

  • AutocompleteResolver interface currently only allows to resolve String types (see ArrayList<String> getSuggestions(String query)), other types are not supported. This is not really helpful, e.g. one can imagine a list of suggested users to type with their avatars on side which is not achievable at the moment.
  • AutocompleteManager is executing millions of threads right now as you type... or some number close to that - this is obviously not good. Two immediate optimisations that come into my mind: first one is using a single thread executor, second one is smart deferring/cancelling search queries as user is typing (optional). That said we could also have a background thread Handler instance running & collecting messages and prioritising them appropriately. Moreover rxJava has been made a dependency of this library so now we can use that as well. Pretty much anything will be an improvement here.
  • AutocompletePopover what's good about this class is that it sticks to the cursor as you type. What's not so great is that the layout R.layout.autocomplete_popover is pretty much frozen in the library and highly uncustomizable. We should have an option to generate any layout that suits our needs, e.g. if someone sets a different BubbleStyle on ChipsEditText then the popover should be able to reflect this. It would be also probably better if we could create this popover in getWindow().getDecorView() rather as it is now because we force users of this library to always use RelativeLayout whenever they want to have AutocompletePopover.

The task here is to propose something that overcomes above limitations, makes us more generic along with an updated working piece of code in the Notes app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant