public class SpenContextMenu extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SpenContextMenu.CloseListener |
static interface |
SpenContextMenu.ContextMenuListener
Listener to notify context menu action event
|
| Modifier and Type | Field and Description |
|---|---|
static int |
TYPE_DEFAULT
Looks for Phone device
|
static int |
TYPE_WIDE
Looks for Tablet device
|
| Constructor and Description |
|---|
SpenContextMenu(Context context,
View parent,
ArrayList<SpenContextMenuItemInfo> menu,
SpenContextMenu.ContextMenuListener selectListener)
SpenContextMenu constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
close()
Close the context menu.
|
boolean |
getItemEnabled(int id)
Check if the specified context menu item is enabled.
|
Rect |
getRect()
Get the area that is currently set.
|
static int |
getType()
Get the UI look type.
|
void |
hide()
Hide the context menu.
|
boolean |
isShowing()
Check if the context menu is visible
|
void |
setCloseListener(SpenContextMenu.CloseListener listener)
Set a close listener
|
void |
setItemEnabled(int id,
boolean enable)
Enable the specified context menu item.
|
void |
setRect(Rect rect)
Set the area of the specified rect.
|
void |
setRect(Rect rect,
boolean isSlideToAbove) |
static void |
setType(int type)
Set the UI look type.
|
void |
show()
Show the context menu.
|
void |
show(int delay)
Show the context menu during the specified time.
|
public static final int TYPE_DEFAULT
public static final int TYPE_WIDE
public SpenContextMenu(Context context, View parent, ArrayList<SpenContextMenuItemInfo> menu, SpenContextMenu.ContextMenuListener selectListener)
context - The context for the applicationparent - The page document that is currently set.menu - The list of menu itemsselectListener - The ContextMenuListener instance for handling context menu events.IllegalArgumentException - Thrown if parent or menu is null.public static int getType()
TYPE_DEFAULT, TYPE_WIDE.public static void setType(int type)
type - The UI look type to be set. See Field Detail in this class, TYPE_DEFAULT, TYPE_WIDE.public boolean close()
public Rect getRect()
public void setRect(Rect rect)
rect - The rect area to be set on context menu.public void setRect(Rect rect, boolean isSlideToAbove)
public void setItemEnabled(int id,
boolean enable)
id - The context menu item ID.enable - Set to true to enable the context menu item, false to disable.public boolean getItemEnabled(int id)
id - The id of itempublic void show()
public void show(int delay)
delay - hide contextmenu after delay time.public void hide()
public boolean isShowing()
public void setCloseListener(SpenContextMenu.CloseListener listener)
listener - the close listener