Skip to content
This repository has been archived by the owner on Apr 24, 2018. It is now read-only.

Commit

Permalink
Adds API to block all touches
Browse files Browse the repository at this point in the history
  • Loading branch information
amlcurran committed Oct 27, 2015
1 parent 892d845 commit f9556fe
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class ShowcaseView extends RelativeLayout
private boolean isShowing;
private int backgroundColor;
private int showcaseColor;
private boolean blockAllTouches;

protected ShowcaseView(Context context, boolean newStyle) {
this(context, null, R.styleable.CustomTheme_showcaseViewStyle, newStyle);
Expand Down Expand Up @@ -340,6 +341,9 @@ public void onAnimationStart() {

@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (blockAllTouches) {
return true;
}

float xDelta = Math.abs(motionEvent.getRawX() - showcaseX);
float yDelta = Math.abs(motionEvent.getRawY() - showcaseY);
Expand Down Expand Up @@ -593,6 +597,15 @@ public Builder replaceEndButton(int buttonResourceId) {
}
return replaceEndButton((Button) view);
}

/**
* Block any touch made on the ShowcaseView, even inside the showcase
*/
public Builder blockAllTouches() {
showcaseView.setBlockAllTouches(true);
return this;
}

}

private void setEndButton(Button button) {
Expand Down Expand Up @@ -700,6 +713,10 @@ public void setBlocksTouches(boolean blockTouches) {
this.blockTouches = blockTouches;
}

private void setBlockAllTouches(boolean blockAllTouches) {
this.blockAllTouches = blockAllTouches;
}

/**
* @see com.github.amlcurran.showcaseview.ShowcaseView.Builder#setStyle(int)
*/
Expand Down

0 comments on commit f9556fe

Please sign in to comment.