Class SequenceItem
- java.lang.Object
-
- uk.co.samuelwall.materialtaptargetprompt.extras.sequence.SequenceItem
-
- All Implemented Interfaces:
MaterialTapTargetPrompt.PromptStateChangeListener
- Direct Known Subclasses:
SequenceItemShowFor
public class SequenceItem extends java.lang.Object implements MaterialTapTargetPrompt.PromptStateChangeListener
Represents a prompt to display in a sequence.
-
-
Constructor Summary
Constructors Constructor Description SequenceItem(SequenceState state)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStateChanger(int state)
Add a state that will trigger the sequence to move on.void
clearStateChangers()
Remove all state changers.void
dismiss()
CallsMaterialTapTargetPrompt.dismiss()
on this items states prompt.void
finish()
CallsMaterialTapTargetPrompt.finish()
on this items states prompt.SequenceState
getState()
Get the prompt state that this sequence item uses.protected void
onItemComplete()
Emits theMaterialTapTargetSequence.SequenceCompleteListener.onSequenceComplete()
event if the listener is set.void
onPromptStateChanged(MaterialTapTargetPrompt prompt, int state)
Called when the prompts state changes.void
removeStateChanger(int state)
Remove a specific state changer.void
setSequenceListener(MaterialTapTargetSequence.SequenceCompleteListener listener)
Set the listener for this sequence item completing.void
show()
Show this sequence item.protected void
show(MaterialTapTargetPrompt prompt)
Show the created prompt for this sequence item.
-
-
-
Constructor Detail
-
SequenceItem
public SequenceItem(@NonNull SequenceState state)
Constructor.- Parameters:
state
- The prompt that this item will show.
-
-
Method Detail
-
addStateChanger
public void addStateChanger(int state)
Add a state that will trigger the sequence to move on.- Parameters:
state
- The state that triggers the sequence to move on.- See Also:
MaterialTapTargetPrompt.STATE_REVEALING
,MaterialTapTargetPrompt.STATE_REVEALED
,MaterialTapTargetPrompt.STATE_FOCAL_PRESSED
,MaterialTapTargetPrompt.STATE_FINISHING
,MaterialTapTargetPrompt.STATE_FINISHED
,MaterialTapTargetPrompt.STATE_NON_FOCAL_PRESSED
,MaterialTapTargetPrompt.STATE_DISMISSING
,MaterialTapTargetPrompt.STATE_DISMISSED
-
removeStateChanger
public void removeStateChanger(int state)
Remove a specific state changer.- Parameters:
state
- The state to remove.- See Also:
MaterialTapTargetPrompt.STATE_REVEALING
,MaterialTapTargetPrompt.STATE_REVEALED
,MaterialTapTargetPrompt.STATE_FOCAL_PRESSED
,MaterialTapTargetPrompt.STATE_FINISHING
,MaterialTapTargetPrompt.STATE_FINISHED
,MaterialTapTargetPrompt.STATE_NON_FOCAL_PRESSED
,MaterialTapTargetPrompt.STATE_DISMISSING
,MaterialTapTargetPrompt.STATE_DISMISSED
-
clearStateChangers
public void clearStateChangers()
Remove all state changers.
-
setSequenceListener
public void setSequenceListener(@Nullable MaterialTapTargetSequence.SequenceCompleteListener listener)
Set the listener for this sequence item completing.- Parameters:
listener
- The item finish listener.
-
getState
@NonNull public SequenceState getState()
Get the prompt state that this sequence item uses.- Returns:
- The prompt state.
-
show
public void show()
Show this sequence item.
-
finish
public void finish()
CallsMaterialTapTargetPrompt.finish()
on this items states prompt.
-
dismiss
public void dismiss()
CallsMaterialTapTargetPrompt.dismiss()
on this items states prompt.
-
show
protected void show(@NonNull MaterialTapTargetPrompt prompt)
Show the created prompt for this sequence item.- Parameters:
prompt
- The prompt to show, this will never be null here.
-
onPromptStateChanged
public void onPromptStateChanged(@NonNull MaterialTapTargetPrompt prompt, int state)
Description copied from interface:MaterialTapTargetPrompt.PromptStateChangeListener
Called when the prompts state changes.- Specified by:
onPromptStateChanged
in interfaceMaterialTapTargetPrompt.PromptStateChangeListener
- Parameters:
prompt
- The prompt which state has changed.state
- can be eitherMaterialTapTargetPrompt.STATE_REVEALING
,MaterialTapTargetPrompt.STATE_REVEALED
,MaterialTapTargetPrompt.STATE_FOCAL_PRESSED
,MaterialTapTargetPrompt.STATE_FINISHED
,MaterialTapTargetPrompt.STATE_DISMISSING
,MaterialTapTargetPrompt.STATE_DISMISSED
-
onItemComplete
protected void onItemComplete()
Emits theMaterialTapTargetSequence.SequenceCompleteListener.onSequenceComplete()
event if the listener is set.
-
-