Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class TapTarget {
final CharSequence title;
@Nullable
final CharSequence description;

float outerCircleAlpha = 0.96f;
int targetRadius = 44;

Rect bounds;
Expand Down Expand Up @@ -218,6 +220,15 @@ public TapTarget outerCircleColorInt(@ColorInt int color) {
return this;
}

/** Specify the alpha value [0.0, 1.0] of the outer circle **/
public TapTarget outerCircleAlpha(float alpha) {
if (alpha < 0.0f || alpha > 1.0f) {
throw new IllegalArgumentException("Given an invalid alpha value: " + alpha);
}
this.outerCircleAlpha = alpha;
return this;
}

/** Specify the color resource for the target circle **/
public TapTarget targetCircleColor(@ColorRes int color) {
this.targetCircleColorRes = color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void onUpdate(float lerpTime) {
calculateDrawingBounds();
}

final float targetAlpha = 0.96f * 255;
final float targetAlpha = target.outerCircleAlpha * 255;
outerCircleRadius = newOuterCircleRadius;
outerCircleAlpha = (int) Math.min(targetAlpha, (lerpTime * 1.5f * targetAlpha));
outerCirclePath.reset();
Expand Down Expand Up @@ -324,7 +324,7 @@ public void onEnd() {
public void onUpdate(float lerpTime) {
final float spedUpLerp = Math.min(1.0f, lerpTime * 2.0f);
outerCircleRadius = calculatedOuterCircleRadius * (1.0f + (spedUpLerp * 0.2f));
outerCircleAlpha = (int) ((1.0f - spedUpLerp) * 255.0f);
outerCircleAlpha = (int) ((1.0f - spedUpLerp) * target.outerCircleAlpha * 255.0f);
outerCirclePath.reset();
outerCirclePath.addCircle(outerCircleCenter[0], outerCircleCenter[1], outerCircleRadius, Path.Direction.CW);
targetCircleRadius = (1.0f - lerpTime) * TARGET_RADIUS;
Expand Down Expand Up @@ -409,7 +409,7 @@ public TapTargetView(final Context context,

outerCirclePaint = new Paint();
outerCirclePaint.setAntiAlias(true);
outerCirclePaint.setAlpha((int) (0.96f * 255.0f));
outerCirclePaint.setAlpha((int) (target.outerCircleAlpha * 255.0f));

outerCircleShadowPaint = new Paint();
outerCircleShadowPaint.setAntiAlias(true);
Expand Down