com.sonyericsson.extras.liveware.aef.widget
Class Widget

java.lang.Object
  extended by com.sonyericsson.extras.liveware.aef.widget.Widget

public class Widget
extends java.lang.Object

The Widget API is a part of the Smart Extension API's

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:

  1. Initial Widget image
  2. How do Extensions find out correct Widget image size
  3. Refreshing the Widget image

Initial Widget image

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.

How do Extensions find out correct Widget image size

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.

Refreshing the Widget image

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

Widget

protected Widget()