Skip to content

Commit

Permalink
Merge pull request #25 from starkej2/feature/line-configuration
Browse files Browse the repository at this point in the history
Add setter for line stroke and path effect
  • Loading branch information
29jitender authored Aug 26, 2016
2 parents 47c7bbf + 3bf7ded commit 0b47e4b
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 @@ -172,7 +174,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 @@ -578,6 +580,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 @@ -893,9 +896,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 @@ -1054,10 +1061,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 0b47e4b

Please sign in to comment.