MaterialIntroView
MaterialIntroView copied to clipboard
How do I create a Sequence?
As the title asks, how exactly do I create a sequence of Intros to be shown? I didn't get a clear indication on how to do it from the code examples given.
I figured it out. Just follow these steps:
- Create all the builders in Stack order. So the first MaterialIntroView should be the last initialized one.
- Set a listener to each that triggers the next MaterialIntroView.
EG:
// Last
final MaterialIntroView.Builder intro3 = new MaterialIntroView.Builder(this)
.setFocusType(Focus.ALL)
.setDelayMillis(100)
.setTarget(view3)
.setInfoText("Some direction");
.setUsageId("view3") // IMPORTANT
// Second
final MaterialIntroView.Builder intro2 = new MaterialIntroView.Builder(this)
.setFocusType(Focus.ALL)
.setDelayMillis(100)
.setTarget(view2)
.setInfoText("Some info")
.setUsageId("view2") // IMPORTANT
.setListener(s -> intro3.show()); // IMPORTANT
// First
new MaterialIntroView.Builder(this)
.setFocusType(Focus.ALL)
.setDelayMillis(500)
.setTarget(view1)
.setInfoText("Some info")
.setUsageId("view1") // IMPORTANT
.setListener(s -> intro2.show()) // IMPORTANT
.show();
I figured it out. Just follow these steps:
1. Create all the builders in Stack order. So the first MaterialIntroView should be the last initialized one. 2. Set a listener to each that triggers the next MaterialIntroView.EG:
// Last final MaterialIntroView.Builder intro3 = new MaterialIntroView.Builder(this) .setFocusType(Focus.ALL) .setDelayMillis(100) .setTarget(view3) .setInfoText("Some direction"); .setUsageId("view3") // IMPORTANT // Second final MaterialIntroView.Builder intro2 = new MaterialIntroView.Builder(this) .setFocusType(Focus.ALL) .setDelayMillis(100) .setTarget(view2) .setInfoText("Some info") .setUsageId("view2") // IMPORTANT .setListener(s -> intro3.show()); // IMPORTANT // First new MaterialIntroView.Builder(this) .setFocusType(Focus.ALL) .setDelayMillis(500) .setTarget(view1) .setInfoText("Some info") .setUsageId("view1") // IMPORTANT .setListener(s -> intro2.show()) // IMPORTANT .show();
Thanks buddy its working