Skip to main content
Samsung Developer Program

Edge API Structure

Look Edge is part of the Look SDK, which also supports Look S-Pen functionality.  The Slook Class in the root-level class for both the Look Edge and Look S-Pen classes.

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 Edge App Development Overview.

 

Slook Class

This section introduces the Slook class API methods that initialize Look Edge and S-Pen and gets fundamental Look SDK and user device support information..  

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

Slook_Class.png

 

Constructor  
Slook( ) Instantiates an Slook object to support the Look Edge and S-Pen operations and gets fundamental SDK and device support information.

 

Methods    
int getVersionCode() Returns the version code of the Look SDK package.
java.lang.String  getVersionName() Returns the name of the Look SDK package.

void

initialize(Context arg0 )

Initializes Look Edge and S-Pen using the specified context:

arg0 Name of the context that is to run Look Edge and S-Pen

Throws an SsdkUnsupportedException if the user's device is not a Samsung device or does not support all Look features:  

VENDOR_NOT_SUPPORTED The device is not a Samsung device and does not support any Look Edge or S-Pen features.
DEVICE_NOT_SUPPORTED The user's device is a Samsung device that does not support one or more Look Edge and/or S-Pen features.

boolean

isFeatureEnabled(int type)

Determines whether or not the user's Samsung device supports the specified Look feature: 

type Kind of Look Edge or S-Pen feature:
  COCKTAIL_PANEL Look Edge Single Plus, Edge, and Feed Panels
  COCKTAIL_BAR Look Edge Immersive Panel
  AIRBUTTON Look S-Pen AirButton 
  SMARTCLIP Look S-Pen SmartClip
  WRITINGBUDDY Look S-Pen WritingBuddy
  SPEN_HOVER_ICON Look S-Pen PointerIcon

Returns true when the user's Samsung device supports the specified feature or false otherwise.

 

Slook Cocktail Classes

 

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 or 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 or 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)

Since:  v1.1.0

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

context Name of the context object
 

int[]

getCocktailIds(ComponentName provider)

Since:  v1.1.0

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).
 

void

updateCocktail(int cocktailId, RemoteView view)

Since:  v1.1.0

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)

 

Since:  v1.3.0

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)

Since:  v1.1.0

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.
 

void

setOnPullPendingIntent(
int id, int viewId,
PendingIntent pendingIntent)

Since:  v1.4.0

Sets pull-to-refresh interactions for the specified remote view to notify, via the specified pending intent, the specified remote views in all the specified Cocktail instances to invalidate their data 

cocktailId ID of the cocktail instances to be notified of view data changes
viewId ID of the remote view
pendingIntent Name of the pending intent for feedback of the pull-to-refresh interaction
 

void

setOnLongClickPendingIntent(
RemoteViews rv, int viewId, PendingIntent longClickPendingIntent)

Since:  v1.4.0

Sets the specified long-click pending intent for the specified remote view.  

Caution: When setting the on-click action of items within collections (for example. ListView and StackView), this method will not work;  use setOnLongClickPendingIntentTemplate instead.

rv target RemoveViews
viewId ID of the view in the remote view
longClickPendingIntent Name of the pending intent for the long-click interaction
 

void

setOnLongClickPendingIntentTemplate(
RemoteViews rv, int viewId, PendingIntent pendingIntentTemplate)

Since:  v1.4.0

Sets the specified long-click pending intent template for the specified view in the RemoteView with collections.

When using collections in RemoteViews, it is very costly to set a long click PendingIntent on individual items. We recommend that you use this method to set a single PendingIntent template on the collection.  Individual items can differentiate their long-click behavior using setOnClickFillInIntent.

rv target RemoveViews
viewId ID of the view in the remote view
pendingIntentTemplate Name of the pending intent to be combined with the extras specified by the child of viewId and executed when that child is long-clicked
 
       

 

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 sub-window for an Edge Immersive Panel and gets information about the panel's sub-window.

Note:  This class and its members are deprecated.

Constructor  
SlookCocktailSubWindow() Instantiates an SlookCocktailSubWindow object.

 

Methods    

static public void

setSubContentView(Activity activity, int layoutResId)

Deprecated

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)

Deprecated
 

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)

Deprecated
 

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?