|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sonyericsson.extras.liveware.aef.widget.Widget
public class Widget
Some of our advanced accessories will support the Widget API. The Widget API enables the Extension to display a live image on the main menu of the accessory, sort of a preview of what the Extension is about.
Topics covered here:
Widgets will usually be the building blocks for the main menu of the accessories
that support Widgets.
At certain occasions, the Host Application will request a Widget image from the
Extension, Widget.Intents.WIDGET_START_REFRESH_IMAGE_INTENT. E.g. when the user powers on the accessory,
or when a new Widget Extension is installed.
When the Extension receives this Intent it must send back a Widget image to the Host
Application, Widget.Intents.WIDGET_IMAGE_UPDATE_INTENT
The Extension can continue to update its image when it finds it appropriate as long as the intent
Widget.Intents.WIDGET_STOP_REFRESH_IMAGE_INTENT has not been received. The extension can resume updating
its image when Widget.Intents.WIDGET_START_REFRESH_IMAGE_INTENT has been received again.
Before an Extension sends the Widget image to the Host Application it has to figure out what size the image should be. This might vary between accessories as some have a larger display. This information can be found using the Registration & Capabilities API. Every Host Application will write down its parameters into the Capabilities database.
In order to allow the user to interact with the Widget, the Extension will get touch events
that occur when your Widget is in focus on the accessory display, Widget.Intents.WIDGET_ONTOUCH_INTENT
This way the Extension receives user feedback and can adapt, refresh Widget image.
As an example one could mention a media player controller Widget. The initial Widget image show a couple
of buttons, play/pause, previous, next, etc. When a user presses somewhere on on the Widget the
Widget.Intents.WIDGET_ONTOUCH_INTENT will be sent to the Extension. Since the Extension provided the
initial image it knows the exact layout/position of the buttons and can that way determine what button
that was pressed and take action. In this case it could be to start playing a song. The Extension can
also choose to update the Widget image so that it reflects the latest state, instead of play button,
it might show the pause button and the title of the playing song.
| Nested Class Summary | |
|---|---|
static interface |
Widget.Intents
Intents sent between Widget Extensions and Accessory Host Applications. |
| Constructor Summary | |
|---|---|
protected |
Widget()
|
| Method Summary |
|---|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Widget()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||