Monday, June 27, 2011

Handling icons of sources and events

On the timeline (and on the source settings activity) small icons are used to identify the different sources and/or event. These icons could come from various sources (content uri, client application's app icon, default source icon).

Now Historify handles these different situations by defining the following fields:

- A Source could define an icon_uri field, which is a URI identifying the icon drawable associated with that source. Client applications could provide this value while registering their SharedSource. If no icon_uri has been provided by the client, Historify uses the client app's launcher icon.

- In case of certain Sources it might be necessary to use different icons for each event on the timelime. For example, QuickPost is a special source that stores Events from different applications, so it might be useful to display the icon provided by the caller application instead of the default QuickPost icon. To realize scenarios like this, the new icon_loading_strategy field has been added to the sources table, which could be set to useSourceIcon (default) or useEventIcon.

- If the icon loading strategy is set to useEventIcon, the icon shown on the timeline is not loaded from the Source's icon_uri field, but the Event's icon_uri field. So providers that define custom icons for each timelime event (like the QuickPost provider) could provide a value associated with the particular event instead of the source.

Based on these attributes, timeline icons could be fully customized, as shown on the figure below.

The first event is provided by the HelloSharedSource external source (launcher icon is used), while the second one is provided by the internal QuickPost provider (the icon of the LendMe app is used, since the post came from that application).

No comments:

Post a Comment