Skip to content

Commit

Permalink
Option to disable dismiss until spotlight is completly shown
Browse files Browse the repository at this point in the history
  • Loading branch information
29jitender committed Jun 17, 2016
1 parent 3a02111 commit b3fcbf2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ public boolean onTouchEvent(MotionEvent event) {

return true;
case MotionEvent.ACTION_UP:

if (isTouchOnFocus || dismissOnTouch)
dismiss();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/example/spotlight/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit b3fcbf2

Please sign in to comment.