diff --git a/Spotlight-library/src/main/java/com/wooplr/spotlight/SpotlightView.java b/Spotlight-library/src/main/java/com/wooplr/spotlight/SpotlightView.java index ba128b0..f09d041 100755 --- a/Spotlight-library/src/main/java/com/wooplr/spotlight/SpotlightView.java +++ b/Spotlight-library/src/main/java/com/wooplr/spotlight/SpotlightView.java @@ -265,7 +265,6 @@ public boolean onTouchEvent(MotionEvent event) { return true; case MotionEvent.ACTION_UP: - if (isTouchOnFocus || dismissOnTouch) dismiss(); @@ -588,6 +587,22 @@ public void onAnimationStart(Animator animator) { @Override public void onAnimationEnd(Animator animator) { AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f); + fadeIn.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + dismissOnTouch = true; + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); fadeIn.setDuration(fadingTextDuration); fadeIn.setFillAfter(true); headingTv.startAnimation(fadeIn); @@ -989,6 +1004,12 @@ public Builder lineAnimDuration(long duration) { return this; } + public Builder enableDismissAfterShown(boolean enable) { + if (enable) + spotlightView.setDismissOnTouch(false); + return this; + } + // public Builder lineStroke(int stoke) { // spotlightView.setLineStroke(Utils.dpToPx(stoke)); // return this; diff --git a/app/src/main/java/com/example/spotlight/MainActivity.java b/app/src/main/java/com/example/spotlight/MainActivity.java index eb932b5..35939c2 100644 --- a/app/src/main/java/com/example/spotlight/MainActivity.java +++ b/app/src/main/java/com/example/spotlight/MainActivity.java @@ -12,9 +12,9 @@ import android.widget.TextView; import android.widget.Toast; +import com.wooplr.spotlight.SpotlightView; import com.wooplr.spotlight.prefs.PreferencesManager; import com.wooplr.spotlight.utils.Utils; -import com.wooplr.spotlight.SpotlightView; import java.util.Random; @@ -129,6 +129,7 @@ private void showIntro(View view, String usageId) { .lineAnimDuration(400) .lineAndArcColor(Color.parseColor("#eb273f")) .dismissOnTouch(true) + .enableDismissAfterShown(true) .usageId(usageId) //UNIQUE ID .show(); }