In this code example I have a single TapTargetView working:
if (controllerVisible && playerView.isControllerFullyVisible()) {
if (setPrefs.firstRun) {
TapTargetView.showFor(PlayerActivity.this,
TapTarget.forView(buttonSettings, getString(R.string.onboarding_settings_title),
getString(R.string.onboarding_settings_description))
.outerCircleColor(R.color.blue)
.targetCircleColor(R.color.white)
.titleTextSize(22)
.titleTextColor(R.color.white)
.descriptionTextSize(14)
.cancelable(true),
new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
buttonOpen.performClick();
}
});
setPrefs.markFirstRun();
}
}
But I cannot work out how to create a TapTargetSequence using the following example:
TapTargetSequence(this)
.targets(
TapTarget.forView(buttonSettings, getString(R.string.onboarding_settings_title),
getString(R.string.onboarding_settings_description))
.outerCircleColor(R.color.blue)
.targetCircleColor(R.color.white)
.titleTextSize(22)
.titleTextColor(R.color.white)
.descriptionTextSize(14)
.cancelable(true),
TapTarget.forView(buttonMedia, getString(R.string.onboarding_media_title),
getString(R.string.onboarding_media_description))
.outerCircleColor(R.color.blue)
.targetCircleColor(R.color.white)
.titleTextSize(22)
.titleTextColor(R.color.white)
.descriptionTextSize(14)
.cancelable(true))
I'm having a great deal of trouble with this could someone please help me to figure this out.
Thank you
You forgot to add "start()" method at the end and also TapTargetSequence.Listener. Try the below code, it should work.
TapTargetSequence(this)
.targets(
TapTarget.forView(buttonSettings, getString(R.string.onboarding_settings_title),
getString(R.string.onboarding_settings_description))
.outerCircleColor(R.color.blue)
.targetCircleColor(R.color.white)
.titleTextSize(22)
.titleTextColor(R.color.white)
.descriptionTextSize(14)
.cancelable(true),
TapTarget.forView(buttonMedia, getString(R.string.onboarding_media_title),
getString(R.string.onboarding_media_description))
.outerCircleColor(R.color.blue)
.targetCircleColor(R.color.white)
.titleTextSize(22)
.titleTextColor(R.color.white)
.descriptionTextSize(14)
.cancelable(true)).start()
object : TapTargetSequence.Listener {
override fun onSequenceFinish() {
Toast.makeText(this, "Sequence Finished!", Toast.LENGTH_SHORT).show()
}
override fun onSequenceStep(lastTarget: TapTarget?, targetClicked: Boolean) {
Toast.makeText(this, "Great", Toast.LENGTH_SHORT).show()
}
override fun onSequenceCanceled(lastTarget: TapTarget?) {
}
}