Skip to content

Added option to choose the dim opacity #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -42,15 +42,16 @@ TapTargetView.showFor(this, // `this` is an Activity
TapTarget.forView(findViewById(R.id.target), "This is a target", "We have the best targets, believe me")
// All options below are optional
.outerCircleColor(R.color.red) // Specify a color for the outer circle
.outerCircleAlpha(0.96f) // Specify the alpha amount for the outer circle
.outerCircleAlpha(0.96f) // Specify the alpha amount for the outer circle
.targetCircleColor(R.color.white) // Specify a color for the target circle
.titleTextSize(20) // Specify the size (in sp) of the title text
.titleTextColor(R.color.white) // Specify the color of the title text
.descriptionTextSize(10) // Specify the size (in sp) of the description text
.descriptionTextColor(R.color.red) // Specify the color of the description text
.textColor(R.color.blue) // Specify a color for both the title and description text
.textTypeface(Typeface.SANS_SERIF) // Specify a typeface for the text
.dimColor(R.color.black) // If set, will dim behind the view with 30% opacity of the given color
.dimColor(R.color.black) // If set, will dim behind the view with the given color
.dimColorOpacity(0.75f) // Specify the dim opacity for given color, 30% opacity if not set.
.drawShadow(true) // Whether to draw a drop shadow or not
.cancelable(false) // Whether tapping outside the outer circle dismisses the view
.tintTarget(true) // Whether to tint the target view's color
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ public class TapTarget {
@Nullable
final CharSequence description;

float dimColorOpacity = 0.3f;
float outerCircleAlpha = 0.96f;
int targetRadius = 44;

@@ -371,6 +372,16 @@ public TapTarget dimColorInt(@ColorInt int color) {
return this;
}

/** **/ /**
* Specify the opacity for the dim color
* <p>
* <b>Note:</b> The specified opacity will range between 0 and 1 been the second 100% opacity
*/
public TapTarget dimColorOpacity(float opacity){
this.dimColorOpacity = opacity;
return this;
}

/** Specify whether or not to draw a drop shadow around the outer circle **/
public TapTarget drawShadow(boolean draw) {
this.drawShadow = draw;
Original file line number Diff line number Diff line change
@@ -609,7 +609,7 @@ public void getOutline(View view, Outline outline) {

final Integer targetDimColor = target.dimColorInt(context);
if (targetDimColor != null) {
dimColor = UiUtil.setAlpha(targetDimColor, 0.3f);
dimColor = UiUtil.setAlpha(targetDimColor, target.dimColorOpacity);
} else {
dimColor = -1;
}