wordpress-mobile/WordPress-Android — pull request #1984 by oguzkocer (2014-11-07 14:41:31+00:00)
Title: Add mentions to commenting

This PR implements mentions in Reader comments, notification comments, post page comments and comment page replies. Closes #1961.

A quick summary of architectural design:

* Suggestion model introduced to match what api returns. I've only added taxonomy field as an extra. This is not in the api yet and we only return mentions right now, however we thought it would be good to keep a field about it from the start, since we'll want to include hashtags, x-posts etc in the future.
* SuggestionTable handles CRUD operations for Suggestion model. It's reset at each application launch to keep the list up to date. We debated keeping a table just to keep track of when a particular site's suggestions are updated but we might change how we get the suggestions from the server later on, so we believe this is good enough of a solution for now. If you guys have any suggestions, we're all ears :)
* SuggestionService handles updating suggestions per siteId and calling SuggestionTable to handle insertions. It keeps track of which siteIds are updated in any given time to avoid duplicate requests and it will stop itself once there are no requests going on.
* SuggestionTokenizer handles when to show the autocomplete (only handles "@" sign right now)
* SuggestionAdapter has a filter to make sure we only show the relevant suggestions for the current text
* Activity/Fragments does a minimal setup using SuggestionUtils and listens for the broadcast in case the suggestion list is updated.
* SuggestionServiceConnectionManager handles binding/unbinding to SuggestionService from activity/fragments to make sure it doesn't try to bind multiple times, as well as to avoid from unbinding if the service stops itself. This could be refactored into ServiceConnectionManager to have a generic type and used in different places if necessary. (I was very surprised that there is no way to check if a service and context are bind or not, I feel like this should be a built-in mechanism)

There are a couple problems I couldn't fix yet:

* We want the username field to have the priority when the content doesn't fit but I was unable to fix this and full name gets the priority over username. Any help related to this would be much appreciated!
* While the user types and the suggestion list gets smaller, the animation kind of covers the textfield on the emulator. I am not sure if we'll have this problem in the device as well and I don't think it's something we can fix.

I've tried my best to follow the conventions in the existing code but please feel free to let me know if some things doesn't feel consistent. @maxme & @roundhill may I bother one of you to review this?

Here is a screenshot:
![screen shot 2014-11-07 at 16 41 13](https://cloud.githubusercontent.com/assets/662023/4954363/ca260a28-668b-11e4-9d5c-d906307f0315.png)

@alternatekev I've used similar colors and fonts we have in the rest of the app, could you take a look at the design and let me know what you think? :)