Class MaterialTapTargetPrompt
- java.lang.Object
-
- uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt
-
public class MaterialTapTargetPrompt extends java.lang.ObjectA Material Design tap target onboarding implementation.For more information about onboarding and tap targets, read the Onboarding Material Design guidelines.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMaterialTapTargetPrompt.BuilderA builder to create aMaterialTapTargetPromptinstance.static interfaceMaterialTapTargetPrompt.PromptStateChangeListenerInterface definition for a callback to be invoked when a prompts state changes.static classMaterialTapTargetPrompt.PromptViewView used to render the tap target.
-
Field Summary
Fields Modifier and Type Field Description static intSTATE_BACK_BUTTON_PRESSEDThe prompt has been dismissed by the system back button being pressed.static intSTATE_DISMISSEDThe prompt has been removed from view after the prompt has either been pressed somewhere other than the prompt target or the system back button has been pressed.static intSTATE_DISMISSINGThedismiss()method has been called and the prompt is being removed from view.static intSTATE_FINISHEDThe prompt has been removed from view after the prompt has been pressed in the focal area.static intSTATE_FINISHINGThefinish()method has been called and the prompt is being removed from view.static intSTATE_FOCAL_PRESSEDThe prompt target has been pressed in the focal area.static intSTATE_NON_FOCAL_PRESSEDThe prompt has been pressed outside the focal area.static intSTATE_NOT_SHOWNPrompt has yet to be shown.static intSTATE_REVEALEDPrompt reveal animation has finished and the prompt is displayed.static intSTATE_REVEALINGPrompt is reveal animation is running.static intSTATE_SHOW_FOR_TIMEOUTThe prompt has been dismissed by the show for timeout.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelShowForTimer()Cancel the show for timer if it has been created.static MaterialTapTargetPromptcreateDefault(PromptOptions promptOptions)Creates a prompt with the supplied options.voiddismiss()Removes the prompt from view, using a contract and fade animation.voidfinish()Removes the prompt from view, using a expand and fade animation.intgetState()Get the current state of the prompt.protected voidonPromptStateChanged(int state)Handles emitting the prompt state changed events.voidshow()Displays the prompt.voidshowFor(long millis)Displays the prompt for a maximum amount of time.
-
-
-
Field Detail
-
STATE_NOT_SHOWN
public static final int STATE_NOT_SHOWN
Prompt has yet to be shown.- See Also:
- Constant Field Values
-
STATE_REVEALING
public static final int STATE_REVEALING
Prompt is reveal animation is running.- See Also:
- Constant Field Values
-
STATE_REVEALED
public static final int STATE_REVEALED
Prompt reveal animation has finished and the prompt is displayed.- See Also:
- Constant Field Values
-
STATE_FOCAL_PRESSED
public static final int STATE_FOCAL_PRESSED
The prompt target has been pressed in the focal area.- See Also:
- Constant Field Values
-
STATE_FINISHED
public static final int STATE_FINISHED
The prompt has been removed from view after the prompt has been pressed in the focal area.- See Also:
- Constant Field Values
-
STATE_DISMISSING
public static final int STATE_DISMISSING
Thedismiss()method has been called and the prompt is being removed from view.- See Also:
- Constant Field Values
-
STATE_DISMISSED
public static final int STATE_DISMISSED
The prompt has been removed from view after the prompt has either been pressed somewhere other than the prompt target or the system back button has been pressed.- See Also:
- Constant Field Values
-
STATE_FINISHING
public static final int STATE_FINISHING
Thefinish()method has been called and the prompt is being removed from view.- See Also:
- Constant Field Values
-
STATE_NON_FOCAL_PRESSED
public static final int STATE_NON_FOCAL_PRESSED
The prompt has been pressed outside the focal area.- See Also:
- Constant Field Values
-
STATE_SHOW_FOR_TIMEOUT
public static final int STATE_SHOW_FOR_TIMEOUT
The prompt has been dismissed by the show for timeout.- See Also:
- Constant Field Values
-
STATE_BACK_BUTTON_PRESSED
public static final int STATE_BACK_BUTTON_PRESSED
The prompt has been dismissed by the system back button being pressed.- See Also:
- Constant Field Values
-
-
Method Detail
-
show
public void show()
Displays the prompt.
-
showFor
public void showFor(long millis)
Displays the prompt for a maximum amount of time.- Parameters:
millis- The number of milliseconds to show the prompt for.
-
cancelShowForTimer
public void cancelShowForTimer()
Cancel the show for timer if it has been created.
-
getState
public int getState()
Get the current state of the prompt.
-
finish
public void finish()
Removes the prompt from view, using a expand and fade animation.This is treated as if the user has touched the target focal point.
-
dismiss
public void dismiss()
Removes the prompt from view, using a contract and fade animation.This is treated as if the user has touched outside the target focal point.
-
onPromptStateChanged
protected void onPromptStateChanged(int state)
Handles emitting the prompt state changed events.- Parameters:
state- The state that the prompt is now in.
-
createDefault
@NonNull public static MaterialTapTargetPrompt createDefault(@NonNull PromptOptions promptOptions)
Creates a prompt with the supplied options.- Parameters:
promptOptions- The options to use to create the prompt.- Returns:
- The created prompt.
-
-