Skip to content

Commit

Permalink
Fix not being able to cancel on last target (#299)
Browse files Browse the repository at this point in the history
Simplifies an early return + properly unsets currentView. Fixes #294
  • Loading branch information
xiphirx authored Jul 5, 2018
1 parent be6d3ac commit 8036db5
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ public void startAt(int index) {
*/
@UiThread
public boolean cancel() {
if (targets.isEmpty() || !active) {
return false;
}
if (currentView == null || !currentView.cancelable) {
if (!active || currentView == null || !currentView.cancelable) {
return false;
}
currentView.dismiss(false);
Expand All @@ -198,6 +195,7 @@ void showNext() {
currentView = TapTargetView.showFor(dialog, tapTarget, tapTargetListener);
}
} catch (NoSuchElementException e) {
currentView = null;
// No more targets
if (listener != null) {
listener.onSequenceFinish();
Expand Down

0 comments on commit 8036db5

Please sign in to comment.