Skip to main content
Samsung Developer Program

AirButton API Structure

This section presents an introduction to Look S-Pen AirButton API classes, constructors, methods, and their relationships.  

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

For details about integrating the AirButton API, see Integrating AirButton.

Samsung Look S-Pen AirButton Classes and Methods

SlookAirButton Class

Draws AirButton on View.

Constructor  

SlookAirButton(View parentView,
SlookAirButtonAdapter adapter, int uiType)

Instantiates an AirButton object as specified:

parentView     Name of the root-level view object that is the target of AirButton functionality
adapter   Name of the AirButton adapter object that manages the list of AirButton item content and display

uiType   

Specifies the kind of Airbutton UI arrangement that items are to be displayed in:

UI_TYPE_MENU

AirButton items are to be displayed in a horizontal menu list, which are drawable or drawable and text, and cannot be scrolled.

When drawable is not scaled (scaleType=centerInside)),
it is recommended to use 32dp*32dp drawable.

Not supported by Note 4 and Note Edge devices, which rely on sidekey and hovering for usability.

UI_TYPE_LIST

AirButton items are to be displayed in a vertical, single hierarchical level list, which are drawable or drawable and text, and can be scrolled and flicked by the user.

Methods    

void

setItemSelectListener(ItemSelectListener listener)

Registers the specified user-select listener that determines whether or not an AirButton item is selected:

listener Name of the user-select listener object

void

setGravity(int gravity)

 

Specifies the gravity property:

gravity

 

Direction that the first AirButton list item is to be located relative to the hovered view:

GRAVITY_AUTO Automatically based on the current position of the hovered view
GRAVITY_TOP Above the hovered view
GRAVITY_BOTTOM Below the hovered view
GRAVITY_LEFT Left of the hovered view
GRAVITY_RIGHT Right of the hovered view
GRAVITY_HOVER
_POINT

Automatically based on the current widget position in the hovered view

Makes the AirButton menu appear at the location of the hover icon

int getGravity() Returns the current gravity setting

void

setDirection(int direction)

 

Specifies the direction that the items are located in AirButton lists:

NOTE: The direction is automatically changed when the gravity setting is wrong.

direction

Direction that the next list item is to be located from the first or previous item:

NOTE:  When SlookAirButton(uiType=UI_TYPE_LIST), 
DIRECTION_LEFT and DIRECTION_RIGHT settings are not supported.

DIRECTION_AUTO Items are to be displayed according to the hovered view. 
DIRECTION_UPPER Items are to be displayed above.
DIRECTION_LOWER Items are to be displayed below.

DIRECTION_LEFT

Items are to be displayed to the left.

DIRECTION_RIGHT

Items are to be displayed to the right.

int

getDirection()

Returns the current list item direction setting.

void

setPosition(int x, int y)

Specifies the 2-dimensional location of the AirButton:

x

Horizontal distance (pixels) either left (negative integer) or right (positive integer) of the current hover view

y

Vertical distance (pixels) either above (positive integer) or below (negative integer) of the current hover view

void

setScrollEnabled(boolean enable)


Only supported when SlookAirButton(
uiType=UI_TYPE_MENU)

Specifies whether or not widget scrolling is to be available in AirButton menus:

NOTE:  Scrolling is always available in list UIs.

true

Menu scrolling is to be available.

false

Menu scrolling is not to be available.

boolean

isScrollEnabled()

Returns the boolean result of whether widget scrolling is currently available (true) or not available (false) in the AirButtons.

NOTE:    When SlookAirButton(uiType=UI_TYPE_LIST), this method ALWAYS returns true.

void

setBounceEffectEnabled(boolean enable)


Only supported for non-widget type UIs.

Specifies whether or not the AirButtonis to display the bounce effect in non-widget type UIs:

true

Bounce is to be displayed.

false

Bounce is not to be displayed.

boolean

isBounceEffectEnabled()

Returns the boolean result of whether bounce effect is currently displayed (true) or not displayed (false) for the AirButton.

NOTE:    For widget display types, this method ALWAYS returns false.

void hide() Stops the display of the associated AirButton.
void dismiss() Clears all variables of the associated AirButton.

void

setAutoControlEnabled(boolean enable)

Specifies whether or not the associated AirButton's widget is to be automatically controlled:

enable

Whether or not the AirButton widget is to be auto-controlled:

true The AirButton widget is to be auto-controlled.
false The AirButton widget is not to be auto-controlled.
boolean isAutoControlEnabled() Returns the boolean result of whether the associated AirButton's widget is currently automatically controlled (true) or not (false).

void

startAnimationIcon(MotionEvent event)


Only supported when 
setAutoControlEnabled(enable=false)

Specifies the event  when ACTION_HOVER_ENTER is received that the AirButton animation icon is to be started:

event

Name of the Touchevent to be started after the user touches the device screen

void

moveAnimationIcon(MotionEvent event)


Only supported when 
setAutoControlEnabled(enable=false)

Moves the AirButton animation icon according to the specified event when ACTION_HOVER_MOVE is received:

event

Name of the Touchevent to be started after the user touches the device screen

void

stopAnimationIcon(MotionEvent event)


Only supported when 
setAutoControlEnabled(enable=false)

Stops the AirButton animation icon according to the specified event when ACTION_HOVER_EXIT is received:

event

Name of the Touchevent to be started after the user touches the device screen

void

show(MotionEvent event)


Only supported when 
setAutoControlEnabled(enable=false)

Displays the AirButton with BUTTON_SECONDARY according to the specified event:

event

Name of the Touchevent to be started after the user touches the device screen

SlookAirButton.ItemSelectListener Interface

Listens for and manages notifications when an AirButton item is selected by the user.  This interface is nested within the SlookAirButton class.

Methods    

void

onItemSelected(View view, int itemIndex, Object data)

When called (see below), sends the specified view and data information:

view     Name of the view in which the widget was displayed

itemIndex

Whether or not the user must select the specified AirButton item in order to issue this method's callback:

[###] Index number of the AirButton item that must be selected 
-1

An item does not have to be selected for the callback to be issued.

To determine whether AirButton is displayed or hidden:  If the ItemSelectListener method has not been used to hide AirButton, check itemIndex. If the value is -1, then AirButton is hidden.

data Content of the callback

This method is called when EITHER (as controlled by the itemIndex setting):
   - The widget in the specified view is closed AND Attributes(multipleSelection=false).
      or
   - The widget in the specified view is closed AND Attributes(multipleSelection=false)
       AND the user selects the specified AirButton item.

SlookAirButtonAdapter Class

Manages the content of AirButton menus.

Constructors  
SlookAirButtonAdapter() Default constructor that instantiates an AirButton adapter object without AirButton items
SlookAirButtonAdapter(ArrayList<AirButtonItem> itemList)

Instantiates an AirButton adapter object with the specified AirButton items:

itemList Name of the array containing 1 or more AirButton items
Methods    

void

addItem(SlookAirButtonAdapter
.AirButtonItem item)

Inserts the 1 specified item in the associated AirButton adapter:

item Name of the item to be added

 

int

addItem(ArrayList<SlookAirButtonAdapter
.AirButtonItem> itemList)

Inserts the item(s) in the specified item list to the associated AirButton adapter:

itemList Name of the list containing the AirButton items to be added

Returns:

Total item count -1. 

void

insertItem(int index, SlookAirButtonAdapter.AirButtonItem item)

Adds the 1 specified item at the specified position in the mItemList to the associated AirButton adapter:

index Starting position (counting number) of the item in the mItemList
item Name of the item to be added 

void

removeItem(int index)

Deletes the item at the specified position in the mItemList from the associated AirButton adapter:

index Starting position (counting number) of the item in the mItemList

void

updateItem(int index, SlookAirButtonAdapter.AirButtonItem item)

Ensures the item data of the specified item at the specified position in the mItemList matches the item data of the corresponding item in the AirButton adapter: 

index Starting position (counting number) of the item in the mItemList
item Name of the item to be updated
void clear() Deletes ALL items from the AirButton adapter.
int getCount() Returns the total number of items in the associated AirButton adapter.

AirButtonItem

getItem(int idx)

Returns the instance of the item with the specified index number in the associated AirButton adapter:

idx Index number position (counting number) of the item in the adapter

void

setEmptyText(CharSequence text)

Specifies the content of a toast popup to be displayed when the associated AirButton adapter item list is empty:

text Text string to be displayed
CharSequence getEmptyText() Returns the content of the toast popup to be displayed when the AirButton adapter item list is empty.

boolean

onHoverEnter(View parentView)

Specifies the view that when the UI pointer moves inside of, this method returns a true boolean result:

parentView Name of the root-level view

void

onHoverExit(parentView)

Specifies the view that when the UI pointer moves outside of, this method returns a true boolean result:

parentView Name of the view

void

onShow(View parentView)

When the user hover-button-clicks inside the specified view to display the AirButton widget, this method called; however, the user can override this method by controlling some adapter behaviors
(for example, open Cursor):

parentView Name of the view

NOTE:  This method can be called when the specified view is displayed.

void

onHide(View parentView)

When the user hover-button-clicks inside the specified view to stop the display of the AirButton widget, 
this method called; however, the user can override this method by controlling some adapter behaviors
(for example, close Cursor):

parentView Name of the view

void

onDismiss(View parentView)

When the user hover-button-clicks inside the specified view to dismiss the AirButton widget, this method called; however, the user can override this method by controlling some adapter behaviors
(for example, close Cursor):

parentView Name of the view

SlookAirButtonAdapter.AirButtonItem Class

Contains AirButton item information (for example, the item's Drawable, String, and specific Object instance). This class is nested within the SlookAirButtonAdapter class.

Constructors  
AirButtonItem(View view, Object data)  
AirButtonItem(Drawable image, String description, Object data)  
AirButtonItem(Drawable image, String description,
String subDescription, Object data)
 
Methods    

void

set(View view, Object data)

Specifies the custom view to be displayed and specific item data:

view Name of the custom view
data Name of the object contain the item data
void set(Drawable image, String description, Object data)

Specifies the item's drawable image, description, and data:

image Name of the custom view
description Explanation of the item
data Name of the object contain the item data
void set(Drawable image, String description,
String subDescription, Object data)

Specifies the item's drawable image, description, sub-description, and data:

image Name of the custom view
description Higher-level explanation of the item
subDescription Lower-level explanation of the item
data Name of the object contain the item data
View getView() Returns the name of the customized view.
Drawable  getImage() Returns the drawable image of the item.
String getDescription() Returns the higher or sole level description of the item.
String getSubDescription() Returns the lower-level description of the item.
Object getData() Returns the data of the item.

SlookAirButtonFrequentContactAdapter Class

Displays frequently accessed contacts.

The methods is this class are inherited from the SlookAirButtonAdapter class. 

SlookAirButtonRecentMediaAdapter Class

Displays recently played media.

  • Was this article helpful?