public class NavButtonModel
extends java.lang.Object
NavButton
It's recommend to use NavButtonModel.Builder
for creationModifier and Type | Class and Description |
---|---|
static class |
NavButtonModel.Builder
Button model builder
|
Modifier and Type | Field and Description |
---|---|
static int |
LEFT |
static NavButtonModel |
NONE |
static int |
TOP |
Constructor and Description |
---|
NavButtonModel(java.lang.String reference,
android.graphics.drawable.Drawable image)
Construct a NavButtonModel given the provided parameters
|
NavButtonModel(java.lang.String reference,
java.lang.String name,
android.graphics.drawable.Drawable image)
Construct a NavButtonModel given the provided parameters
|
NavButtonModel(java.lang.String reference,
java.lang.String name,
android.graphics.drawable.Drawable image,
android.graphics.drawable.Drawable selectedImage,
NavButtonIntentAction action,
NavButtonIntentAction actionLong)
Construct a NavButtonModel given the provided parameters
|
Modifier and Type | Method and Description |
---|---|
android.content.ClipData |
createClipboardData(java.lang.String desc)
Create clipboard data for this model
|
boolean |
equals(java.lang.Object o) |
NavButtonIntentAction |
getAction()
The intent to fire when pressed
|
android.content.Intent |
getActionIntent()
Get the action intent to fire when pressed
|
NavButtonIntentAction |
getActionLong()
The intent to fire when long-pressed
|
android.content.Intent |
getActionLongIntent()
Get the action intent to fire when long-pressed
|
int |
getBadgeCount()
Get the top-right badge count
|
android.graphics.drawable.Drawable |
getBadgeImage()
Get the bottom-right badge image drawable
|
java.util.List<NavButtonModel> |
getChildButtons()
Obtain the group of child buttons represented by the button model.
|
android.graphics.drawable.Drawable |
getImage()
The image when not selected
|
java.lang.String |
getName()
The name of the TakButtonModel.
|
java.lang.String |
getReference()
Get the unique reference for this button model
|
android.graphics.drawable.Drawable |
getSelectedImage()
The image when selected
|
int |
getSupportedPositions()
Get the supported positions for this button model
|
boolean |
hasChildren()
Returns true if this NavButton has children.
|
int |
hashCode() |
boolean |
isPositionSupported(int position)
Check if this button supports the given position
|
boolean |
isSelected()
Check if this button model is currently selected
|
void |
setAction(android.content.Intent intent)
Set the intent action to perform when this button is pressed
|
void |
setAction(NavButtonIntentAction action)
Set the intent action to perform when this button is pressed
|
void |
setAction(java.lang.String action)
Set the intent action to perform when this button is long-pressed
|
void |
setActionLong(android.content.Intent intent)
Set the intent action to perform when this button is long-pressed
|
void |
setActionLong(NavButtonIntentAction action)
Set the intent action to perform when this button is long-pressed
|
void |
setActionLong(java.lang.String action)
Set the intent action to perform when this button is pressed
|
void |
setBadgeCount(int count)
Set the count shown in a red circle in the top-right
|
void |
setBadgeImage(android.graphics.drawable.Drawable image)
Set an image drawable shown in the bottom-right
|
void |
setChildButtons(java.util.List<NavButtonModel> childButtonModels)
Set a group of children buttons for this button model
|
void |
setSelected(boolean selected)
Set whether this button model is currently selected
|
void |
setSelectedImage(android.graphics.drawable.Drawable image)
Change the selected image showing for the button.
|
java.lang.String |
toString() |
public static final NavButtonModel NONE
public static final int TOP
public static final int LEFT
public NavButtonModel(java.lang.String reference, android.graphics.drawable.Drawable image)
reference
- Unique reference stringimage
- Icon to show in the default statepublic NavButtonModel(java.lang.String reference, java.lang.String name, android.graphics.drawable.Drawable image)
reference
- Unique reference stringname
- The display name for this buttonimage
- Icon to show in the default statepublic NavButtonModel(java.lang.String reference, java.lang.String name, android.graphics.drawable.Drawable image, android.graphics.drawable.Drawable selectedImage, NavButtonIntentAction action, NavButtonIntentAction actionLong)
reference
- a reference identifier which should be universally unique for this devicename
- the name of the NavButton which can be localized for each language and should
not be used for comparisonimage
- an image to show in a unselected stateselectedImage
- an image to show in a selected statepublic java.lang.String getReference()
public java.lang.String getName()
public android.graphics.drawable.Drawable getImage()
public android.graphics.drawable.Drawable getSelectedImage()
public void setSelectedImage(android.graphics.drawable.Drawable image)
image
- the current selected image.public void setBadgeCount(int count)
count
- Countpublic int getBadgeCount()
public void setBadgeImage(android.graphics.drawable.Drawable image)
image
- Badge image (null to hide)public android.graphics.drawable.Drawable getBadgeImage()
public void setSelected(boolean selected)
selected
- True if selectedpublic boolean isSelected()
public void setAction(NavButtonIntentAction action)
action
- Intent actionpublic void setAction(android.content.Intent intent)
intent
- Intentpublic void setAction(java.lang.String action)
action
- Intent actionpublic void setActionLong(NavButtonIntentAction action)
action
- Intent actionpublic void setActionLong(android.content.Intent intent)
intent
- Intentpublic void setActionLong(java.lang.String action)
action
- Intent actionpublic NavButtonIntentAction getAction()
public android.content.Intent getActionIntent()
public NavButtonIntentAction getActionLong()
public android.content.Intent getActionLongIntent()
public boolean hasChildren()
public void setChildButtons(java.util.List<NavButtonModel> childButtonModels)
childButtonModels
- the list of buttons.public java.util.List<NavButtonModel> getChildButtons()
public int getSupportedPositions()
public boolean isPositionSupported(int position)
public android.content.ClipData createClipboardData(java.lang.String desc)
desc
- Clipboard data descriptionpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object