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

Best way/component to display contact status #16

Closed
arthef opened this issue Oct 9, 2020 · 4 comments
Closed

Best way/component to display contact status #16

arthef opened this issue Oct 9, 2020 · 4 comments

Comments

@arthef
Copy link

arthef commented Oct 9, 2020

Hi,

I would like to indicate using colors or different icons contact's online status. That is a different icon or a color to be used when the contact is offline, online, busy, etc....

I could not find anything in the CodeRAD directly suitable for this purpose but maybe I am missing something. The closest thing, which I am going to base on my code would be TypingAnimation to have "pure" component or maybe better yet, something like LabelEntityView, so the view could react on entity changes.

Would you have any suggestions?

@shannah
Copy link
Owner

shannah commented Oct 10, 2020

There are ways to do this with both actions and views. With Views you can just set the UIID in the update method (but do a check to make sure that the UIID requires updating before calling setUIID() on underlying component). With Actions you can either create two actions, and use the UI.condition(...) directive to define when each should be visible. There are also variants of the UI.label(StringProvider) which allow you to provide a custom label depending on the entity context. I'm going to add similar variables to the UI.uiid() and UI.iconUiid() methods to allow for different UIIDs depending on entity context.

If you can elaborate on exactly what you are trying to do, or maybe suggest what your ideal API would look like for this, I may be able to provide further suggestions.

@arthef
Copy link
Author

arthef commented Oct 12, 2020

There will be, for sure more than 2 states. As this is for contacts, I would like to show when they are online, offline, busy, away, on call, etc...

To be honest I am not 100% sure what would be the best way to show their status.

Maybe it depends on where this information is shown. The most typical way is to show an icon (or a dot) in different colors. User offline - grey dot, online and available - green dot, online away - yellow, online busy - red dot. But maybe, instead of just a dot, it would be better to show an icon which may show a bit more, like user is online busy on call - red phone icon.

The thing is, there might be more than 2 states and I would like to use an icon to show each state. And maybe in some places where only user name is displayed, I could just show user's name in different colors, depending on his state but I am not sure if this is a good idea.

So, it looks to me like some form of Label (which can present either text or icon or both) would be best approach. Then, the label can have multiple UUID, different for each state? And what would be the best way to bind user's state or Entity state to a label UUID?

shannah added a commit to codenameone/CodenameOne that referenced this issue Oct 13, 2020
shannah added a commit to codenameone/CodenameOne that referenced this issue Oct 13, 2020
@shannah
Copy link
Owner

shannah commented Oct 13, 2020

I added a couple of samples that show different approaches.

  1. Using a View that contains a label which updates the text, UIID, and icon depending on model stats.
  2. Using an action whose text and UIID are dependent on the model state.

@arthef
Copy link
Author

arthef commented Oct 16, 2020

Thank you, with the provided examples I was able to implement something which works quite well.

@arthef arthef closed this as completed Oct 16, 2020
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

2 participants