Skip to content

Commit

Permalink
Add finish API
Browse files Browse the repository at this point in the history
  • Loading branch information
konifar committed Mar 16, 2018
1 parent 313547f commit 7666373
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ class TargetInstructions private constructor(
startInstruction()
}

fun finish() {
val activity = activityWeakReference.get() ?: return
val decorView = activity.window.decorView
(decorView as ViewGroup).removeView(instructionsViewWeakReference.get())
}

private fun showNextTarget() {
if (targets.isNotEmpty()) {
instructionsViewWeakReference.get()?.showTarget(targets[0])
Expand Down Expand Up @@ -122,9 +128,7 @@ class TargetInstructions private constructor(
}

override fun onAnimationEnd(animation: Animator?) {
val activity = activityWeakReference.get() ?: return
val decorView = activity.window.decorView
(decorView as ViewGroup).removeView(instructionsViewWeakReference.get())
finish()
}

override fun onAnimationCancel(animation: Animator?) {
Expand Down

0 comments on commit 7666373

Please sign in to comment.