Skip to content

Commit

Permalink
Add setter for line stroke and path effect
Browse files Browse the repository at this point in the history
  • Loading branch information
starkej2 committed Aug 15, 2016
1 parent b4990f5 commit 3bf7ded
Showing 1 changed file with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PathEffect;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
Expand All @@ -16,6 +17,7 @@
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.support.graphics.drawable.AnimatedVectorDrawableCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.AppCompatImageView;
Expand Down Expand Up @@ -167,7 +169,7 @@ public class SpotlightView extends FrameLayout {
*/
private long lineAnimationDuration = 300;
private int lineStroke;

private PathEffect lineEffect;
private int lineAndArcColor = Color.parseColor("#eb273f");


Expand Down Expand Up @@ -567,6 +569,7 @@ private void addPathAnimation(Activity activity) {
p.setStrokeCap(Paint.Cap.ROUND);
p.setStrokeWidth(lineStroke);
p.setColor(lineAndArcColor);
p.setPathEffect(lineEffect);

NormalLineAnimDrawable animDrawable1 = new NormalLineAnimDrawable(p);
if (lineAnimationDuration > 0)
Expand Down Expand Up @@ -873,9 +876,13 @@ public void setLineAndArcColor(int lineAndArcColor) {
this.lineAndArcColor = lineAndArcColor;
}

// public void setLineStroke(int lineStroke) {
// this.lineStroke = lineStroke;
// }
public void setLineStroke(int lineStroke) {
this.lineStroke = lineStroke;
}

public void setLineEffect(PathEffect pathEffect) {
this.lineEffect = pathEffect;
}

public void setTypeface(Typeface typeface) {
this.mTypeface = typeface;
Expand Down Expand Up @@ -1029,10 +1036,15 @@ public Builder enableDismissAfterShown(boolean enable) {
return this;
}

// public Builder lineStroke(int stoke) {
// spotlightView.setLineStroke(Utils.dpToPx(stoke));
// return this;
// }
public Builder lineStroke(int stroke) {
spotlightView.setLineStroke(Utils.dpToPx(stroke));
return this;
}

public Builder lineEffect(@Nullable PathEffect pathEffect) {
spotlightView.setLineEffect(pathEffect);
return this;
}

public Builder setConfiguration(SpotlightConfig configuration) {
spotlightView.setConfiguration(configuration);
Expand Down

0 comments on commit 3bf7ded

Please sign in to comment.