MaterialTapTargetSequence { @NonNull public MaterialTapTargetSequence addPrompt(@Nullable MaterialTapTargetPrompt prompt) { this.addItem(new SequenceItem(new SequenceState(prompt))); return this; }  @NonNull MaterialTapTargetSequence setSequenceCompleteListener(@Nullable SequenceCompleteListener listener); @NonNull MaterialTapTargetSequence addPrompt(@Nullable MaterialTapTargetPrompt prompt); @NonNull MaterialTapTargetSequence addPrompt(@Nullable MaterialTapTargetPrompt prompt,
                                               final long milliseconds); @NonNull MaterialTapTargetSequence addPrompt(@NonNull PromptOptions promptOptions); @NonNull MaterialTapTargetSequence addPrompt(@NonNull PromptOptions promptOptions,
                                               final long milliseconds); @NonNull MaterialTapTargetSequence addPrompt(@NonNull final SequenceItem item); int size(); @NonNull SequenceItem get(final int index); @NonNull MaterialTapTargetSequence show(); @NonNull MaterialTapTargetSequence finish(); @NonNull MaterialTapTargetSequence dismiss(); @NonNull MaterialTapTargetSequence showFromIndex(final int index);  }
@Test public void testAddPrompt() { expectedStateProgress = 5; final MaterialTapTargetSequence sequence = new MaterialTapTargetSequence(); sequence.addPrompt(UnitTestUtils.createPromptOptions() .setTarget(0,0) .setPrimaryText("Test 3") .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() { @Override public void onPromptStateChanged(@NonNull MaterialTapTargetPrompt prompt, int state) { if (state == MaterialTapTargetPrompt.STATE_REVEALED) { actualStateProgress++; prompt.onPromptStateChanged(MaterialTapTargetPrompt.STATE_DISMISSED); prompt.dismiss(); } } }), 5000); assertTrue(sequence.get(0) instanceof SequenceItemShowFor); assertTrue(sequence.get(0).getState() instanceof SequenceStatePromptOptions); sequence.addPrompt(UnitTestUtils.createPromptOptions() .setTarget(0,0) .setPrimaryText("Test 3") .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() { @Override public void onPromptStateChanged(@NonNull MaterialTapTargetPrompt prompt, int state) { if (state == MaterialTapTargetPrompt.STATE_REVEALED) { actualStateProgress++; prompt.onPromptStateChanged(MaterialTapTargetPrompt.STATE_DISMISSED); prompt.dismiss(); } } }) .create(), 5000); assertTrue(sequence.get(1) instanceof SequenceItemShowFor); assertNotNull(sequence.get(1).getState()); sequence.addPrompt(UnitTestUtils.createPromptOptions() .setTarget(0,0) .setPrimaryText("Test 3") .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() { @Override public void onPromptStateChanged(@NonNull MaterialTapTargetPrompt prompt, int state) { if (state == MaterialTapTargetPrompt.STATE_REVEALED) { actualStateProgress++; prompt.onPromptStateChanged(MaterialTapTargetPrompt.STATE_DISMISSED); prompt.dismiss(); } } })); assertNotNull(sequence.get(2)); assertTrue(sequence.get(2).getState() instanceof SequenceStatePromptOptions); sequence.addPrompt(UnitTestUtils.createPromptOptions() .setTarget(0,0) .setPrimaryText("Test 3") .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() { @Override public void onPromptStateChanged(@NonNull MaterialTapTargetPrompt prompt, int state) { if (state == MaterialTapTargetPrompt.STATE_REVEALED) { actualStateProgress++; prompt.onPromptStateChanged(MaterialTapTargetPrompt.STATE_DISMISSED); prompt.dismiss(); } } }) .create()); assertNotNull(sequence.get(3)); assertNotNull(sequence.get(3).getState()); final SequenceItem sequenceItem = new SequenceItem(new SequenceState(UnitTestUtils.createPromptOptions() .setTarget(0,0) .setPrimaryText("Test 3") .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() { @Override public void onPromptStateChanged(@NonNull MaterialTapTargetPrompt prompt, int state) { if (state == MaterialTapTargetPrompt.STATE_REVEALED) { actualStateProgress++; prompt.onPromptStateChanged(MaterialTapTargetPrompt.STATE_DISMISSED); prompt.dismiss(); } } }) .create())); sequence.addPrompt(sequenceItem); assertEquals(sequenceItem, sequence.get(4)); sequence.setSequenceCompleteListener(new MaterialTapTargetSequence.SequenceCompleteListener() { @Override public void onSequenceComplete() { actualStateProgress++; } }); sequence.show(); }