public class SoftButtonObject extends Object implements Cloneable
SoftButtonState| Modifier and Type | Class and Description |
|---|---|
static interface |
SoftButtonObject.OnEventListener |
| Constructor and Description |
|---|
SoftButtonObject(String name,
List<SoftButtonState> states,
String initialStateName,
SoftButtonObject.OnEventListener onEventListener)
Create a new instance of the SoftButtonObject with multiple states
|
SoftButtonObject(String name,
SoftButtonState state,
SoftButtonObject.OnEventListener onEventListener)
Create a new instance of the SoftButtonObject with one state
|
SoftButtonObject(String name,
String text,
SdlArtwork artwork,
SoftButtonObject.OnEventListener onEventListener)
Create a new instance of the SoftButtonObject with one state
|
| Modifier and Type | Method and Description |
|---|---|
SoftButtonObject |
clone()
Creates a deep copy of the object
|
boolean |
equals(Object o)
Uses our custom hashCode for SoftButtonObject objects
|
int |
getButtonId()
Get the id of the SoftButtonObject
|
SoftButtonState |
getCurrentState()
Get the current state for the SoftButtonObject
|
String |
getCurrentStateName()
Get the name of the current state
|
SoftButton |
getCurrentStateSoftButton()
Get the SoftButton object for the current state
|
String |
getName()
Get the name of the SoftButtonObject
|
SoftButtonObject.OnEventListener |
getOnEventListener()
Get the event listener for the SoftButtonObject
|
List<SoftButtonState> |
getStates()
Get the SoftButtonState list
|
int |
hashCode()
Used to compile hashcode for SoftButtonsObjects for use to compare in equals method
|
void |
setButtonId(int buttonId)
Deprecated.
|
void |
setCurrentStateName(String currentStateName)
Set the name of the current state
|
void |
setName(String name)
Set the name of the SoftButtonObject
|
void |
setOnEventListener(SoftButtonObject.OnEventListener onEventListener)
Set the event listener for the SoftButtonObject
|
void |
setStates(List<SoftButtonState> states)
Set the the SoftButtonState list
|
protected void |
setUpdateListener(com.smartdevicelink.managers.screen.SoftButtonObject.UpdateListener updateListener)
Set the SoftButtonManager's update listener
|
void |
transitionToNextState()
Transition the SoftButtonObject to the next state
|
boolean |
transitionToStateByName(String newStateName)
Transition the SoftButtonObject to a specific state
|
public SoftButtonObject(@NonNull
String name,
@NonNull
List<SoftButtonState> states,
@NonNull
String initialStateName,
SoftButtonObject.OnEventListener onEventListener)
name - a String value represents name of the objectstates - a list of SoftButtonState represents the SoftButtonState values for the object. states should be unique for every SoftButtonObject. A SoftButtonState instance cannot be reused for multiple SoftButtonObjects.initialStateName - a String value represents the name for the initial stateonEventListener - a listener that has a callback that will be triggered when a button event happens
Note: the initialStateName should match exactly the name of one of the states for the object. Otherwise an exception will be thrown.public SoftButtonObject(@NonNull
String name,
@NonNull
SoftButtonState state,
SoftButtonObject.OnEventListener onEventListener)
name - a String value represents name of the objectstate - a SoftButtonState represents state for the objectonEventListener - a listener that has a callback that will be triggered when a button event happenspublic SoftButtonObject(@NonNull
String name,
@NonNull
String text,
SdlArtwork artwork,
SoftButtonObject.OnEventListener onEventListener)
name - a String value represents name of the objectartwork - a SdlArtwork to be displayed on the buttononEventListener - a listener that has a callback that will be triggered when a button event happenspublic boolean transitionToStateByName(@NonNull
String newStateName)
newStateName - a String value represents the name fo the state that we want to transition the SoftButtonObject topublic void transitionToNextState()
public SoftButtonState getCurrentState()
public SoftButton getCurrentStateSoftButton()
protected void setUpdateListener(com.smartdevicelink.managers.screen.SoftButtonObject.UpdateListener updateListener)
updateListener - the SoftButtonManager.UpdateListener objectpublic String getName()
public void setName(@NonNull
String name)
name - a String that represents the name of the SoftButtonObjectpublic List<SoftButtonState> getStates()
public void setStates(@NonNull
List<SoftButtonState> states)
states - a list of the object's soft button states. states should be unique for every SoftButtonObject. A SoftButtonState instance cannot be reused for multiple SoftButtonObjects.public String getCurrentStateName()
public void setCurrentStateName(@NonNull
String currentStateName)
currentStateName - a String that represents the name of the current statepublic int getButtonId()
@Deprecated public void setButtonId(int buttonId)
buttonId - an int value that represents the id of the SoftButtonObjectpublic SoftButtonObject.OnEventListener getOnEventListener()
public void setOnEventListener(SoftButtonObject.OnEventListener onEventListener)
onEventListener - a listener that has a callback that will be triggered when a button event happenspublic int hashCode()
public boolean equals(Object o)
public SoftButtonObject clone()