Skip to main content
Samsung Developer Program

Edge API Structure

For details, see the online Look API Reference (http://img-developer.samsung.com/onlinedocs/sms/look/index.html).

For details about integrating Edge functionality, see Integrating Look Edge.

Edge Classes

SlookCocktailProvider Class

A convenience class that aids in implementing a cocktail provider by extending the BroadcastReceiver class.

Everything that can be done with an SlookCocktailProvider object can be done with a regular Android BroadcastReceiverclass. The SlookCocktailProvider object parses the relevant fields out of the intent received in onReceive(Context,Intent) and calls hook methods with the received extras.

To implement your own Edge panel or feed functionality, extend the Android BroadcastReceiver class methods by overriding them with one or more appropriate SlookCocktailProvider class methods.

Constructor  
SlookCocktailProvider() Instantiates an SlookCocktailProvider object for the associated Edge panel or feed.
Methods  

void

onReceive(Context context, Intent intent)

 

Implements the interface for receiving Edge broadcasts.BroadcastReceiver.onReceive(android.content.Context, android.content.Intent)
with their context and intent received in order to make the associated SlookCocktailProvider method calls for the associated Edge panel/feed:

context Name of the context in which the Edge panel/feed receiver is running.
intent Name of the intent, which identifies the onUpdate(), onEnabled(), onDisabled(), or onVisibilityChanged() method call to be initiated.

void

onUpdate(Context context,
SlookCocktailManager cocktailManager,
int[] cocktailIds)

Upon being notified by Look Edge that the item content of an Edge panel/feed needs periodic refreshment, this method must be called to specify the Edge panel/feed's SlookCocktailManager object and its panel/feed item(s) to be refreshed:

context Name of the context in which the Edge panel/feed receiver is running.
cocktailManager

Name of the SlookCocktailManager object you can call on for the Edge panel/feed's RemoteView object.

cocktailIds One or more IDs of the panel/feed item instance(s) to be updated.

Edge issues ACTION_COCKTAIL_UPDATE (for Edge Single panels and Edge feeds) or ACTION_COCKTAIL_UPDATE_V2 (for Edge Single Plus panels) broadcasts at intervals that are partially controlled by the updatePeriodMilli metadata. Your app must then call updateCocktail() via the cocktailManager parameter to refresh the content of panel/feed items that your app determines are to be refreshed. 

NOTE: Item updates occur in the background.

When a user makes available an Edge Single Plus panel, Edge Single, or Edge feed, your app must:

  • Call onUpdate() to update all of the Edge panel's content items.
  • When necessary, your app must perform all required Edge panel setup steps, such as defining event handlers for views and starting a temporary service.

CAUTION: If one or more panel/feed item IDs or the RemoteView name are not valid, the affected items will not be updated and will not be displayed in the Edge panel/feed.

void

onEnabled(Context context)

Upon being notified by Look Edge that the user has made an Edge panel/feed available, this method must be called to execute your app code for managing when the Edge panel or feed is instantiated (for example, opening a new database or performing panel setup):

context Name of the context in which the Edge panel/feed receiver is running.

This method is called when the receiver's Edge Single or Single Plus panel or Edge feed is made available (either via Edge settings or via the Edge panel or feed), in response to anACTION_COCKTAIL_ENABLED broadcast when the cocktail for this provider is instantiated.

To implement your own Edge panel/feed enabled functionality, override this method. 

void

onDisabled(Context context)

Enables the processing of your app code (for example, up any work done in onEnabled() such as deleting a temporary database) when the Edge panel or feed is deleted:

context Name of the context in which the Edge panel/feed receiver is running.

This method is called when the receiver's Edge Single or Single Plus panel or Edge feed is made unavailable (either via Edge settings or via the Edge panel or feed), in response to anACTION_COCKTAIL_DISABLED broadcast, which is sent when the cocktail instance for this provider is disabled in setting or Cocktail-Bar.

To implement your own Edge panel or feed disabled functionality, override this method.

void

onVisibilityChanged(Context context,
int cocktailId, int visibility)

When display status change notification is enabled and the display status changes, receives from Look Edge the current display status (shown/hidden) of the specified Edge Single or Single Plus Panel or Edge Feed:

context Name of the context in which the Edge panel/feed receiver is running.
cocktailId ID of the Edge panel/feed instance for which the display status has changed.

visibility

Value (boolean) of the current display status of the Edge panel/feed:

COCKTAIL_VISIBILITY_SHOW The Edge panel/feed is being shown.
COCKTAIL_VISIBIILTY_HIDE The Edge panel/feed is hidden.

This method is called when the Edge Single or Single Plus panel or Edge feed display status changes and change notification is enabled (when CocktailProviderInfo permitVisibilityChanged = true), in response to anACTION_COCKTAIL_VISIBILITY_CHANGED Edge broadcast, in order to take suitable action (such as refreshing panel/feed item content via onUpdate()).

To implement your own Edge panel or feed visibility change functionality, override this method.

SlookCocktailManager Class

Updates the cocktail’s state and gets information about the installed cocktail provider.

Methods    

static

SlookCocktailManager getInstance(Context context)

Returns the SlookCocktailManager instance for use by the specified Context object:

context Name of the context object

void

updateCocktail(int cocktailId, RemoteView view)

Specifies the RemoteViews to be used with the specified Edge panel or feed:

cocktailId ID of the Edge panel/feed instance for which RemoteViews is to be set.
view Name of the RemoteViews object to be displayed.

This method can be called from inside an ACTION_COCKTAIL_UPDATE Edge broadcast or outside of the handler.

CAUTION: This method will only work when called from the UID that owns the Cocktail provider object.

NOTE: The total bitmap memory used by the RemoteViews object cannot exceed that required to fill the screen 1.5 times (bytes, for example: screen width x screen height x 4 x 1.5).

Throws: If the specified RemoteViews is null, throws Java.lang.IllegalArgumentException.

void

updateCocktail(int cocktailId, RemoteView contentView,
RemoteViews helpView)

 

Specifies the content view and help view to be used with the specified panel item ID:

cocktailId

ID of the cocktail instance for which the RemoteViews are to be set.

contentView Name of the RemoteViews object with Edge panel/feed details.

helpView

Name of the RemoteViews object with user help information.

Supported Help view objects:
FrameLayout, LinearLayout, RelativeLayout, GridLayout,
Button, ImageButton, ImageView, ProgressBar, TextView,
ViewFlipper

This method can be called from inside an ACTION_COCKTAIL_UPDATE broadcast or outside of the handler.

CAUTION: This method will only work when called from the UID that owns the Cocktail provider object.

NOTE: The total bitmap memory used by the RemoteViews object cannot exceed that required to fill the screen 1.5 times (bytes, for example: screen width x screen height x 4 x 1.5).

Throws: If the specified RemoteViews is null, throws Java.lang.IllegalArgumentException.

void

notifyCocktailViewDataChanged(int cocktailId, int viewId)

Notifies the specified collection view in the specified Edge panel or feed to invalidate its data:

cocktailId ID of the Edge panel or feed instance.
viewId ID of the collection view.

int[]

getCocktailIds(ComponentName provider)

Returns the IDs of the items in the Edge panel/feed that is associated with the specified cocktail provider object:

provider Name of the BroadcastReceiver (cocktail provider).

 

Fields    
static final int  COCKTAIL_VISIBIILTY_SHOW The associated Edge panel or feed is currently displayed in the Edge display area.
static final int  COCKTAIL_VISIBIILTY_HIDE The associated Edge panel or feed is NOT currently displayed in the Edge display area.

SlookCocktailSubWindow Class

Sets a view in the subwindow for an Edge Immersive Panel and gets information about the panel's subwindow.

Constructor  
SlookCocktailSubWindow() Instantiates an SlookCocktailSubWindow object.

 

Methods    

static public void

setSubContentView(Activity activity, int layoutResId)

Specifies the activity content from a layout resource as the content of the panel's subwindow:

activity Name of the activity to be installed into the content.
layoutResId ID of the resource to be inflated.

Throws: If the specified activity is null, throws Java.lang.IllegalArgumentException.

static public void

setSubContentView(Activity activity, View view)

Specifies the subwindow of the specified activity content to the specified explicit view:

activity Name of the activity to be installed into the content.
view Name of the content to be displayed.

Throws: If the specified activity is null, throws Java.lang.IllegalArgumentException.

static public
android.view.Window 

getSubWindow(Activity activity)

Returns the current subwindow content (when not null or not visual) of the specified activity:

activity Name of the activity.

Throws: If the specified activity is null, throws Java.lang.IllegalArgumentException.

  • Was this article helpful?