Skip to content
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

Fixed issues and added a few new methods requested by users. #73

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions .idea/libraries/animated_vector_drawable_23_4_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions .idea/libraries/appcompat_v7_23_4_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .idea/libraries/design_23_4_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/libraries/espresso_core_2_2_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/libraries/espresso_idling_resource_2_2_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/libraries/exposed_instrumentation_api_publish_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .idea/libraries/javax_inject_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions .idea/libraries/recyclerview_v7_23_4_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions .idea/libraries/rules_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions .idea/libraries/runner_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions .idea/libraries/support_v4_23_4_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/libraries/support_vector_drawable_23_4_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ Dismiss spotlight on touch outside
### enableDismissAfterShown(boolean)
Dismiss spotlight on touch outside after spotlight is completely visible

### showAlways(boolean)
To show spotlight everytime when user opens the same screen.

# Configuration Method
```java
//Create global config instance to reuse it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ public class SpotlightView extends FrameLayout {

private int softwareBtnHeight;

/**
* If true -> Do not store spotlight id into preferences so that it can show every time when a particular screen is opened.
*/
private boolean isShowAlways = false;


public SpotlightView(Context context) {
super(context);
Expand Down Expand Up @@ -217,6 +222,7 @@ private void init(Context context) {
isRevealAnimationEnabled = true;
dismissOnTouch = false;
isPerformClick = false;
isShowAlways = false;
enableDismissAfterShown = false;
dismissOnBackPress = false;
handler = new Handler();
Expand Down Expand Up @@ -320,34 +326,41 @@ private void show(final Activity activity) {

setReady(true);

handler.postDelayed(new Runnable() {
@Override
public void run() {
try{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

if (isRevealAnimationEnabled)
startRevealAnimation(activity);
else {
startFadinAnimation(activity);
}
} else {
startFadinAnimation(activity);
}
}catch(Exception e){
e.printStackTrace();
}
}
}
, 100);
SpotlightView.this.post(new Runnable() {
@Override
public void run() {
try{
boolean isAttachedToWindow = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
isAttachedToWindow = SpotlightView.this.isAttachedToWindow();
}

if(isAttachedToWindow) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

if (isRevealAnimationEnabled)
startRevealAnimation(activity);
else {
startFadinAnimation(activity);
}
} else {
startFadinAnimation(activity);
}
}
}catch(Exception e){
e.printStackTrace();
}
}
});
}

/**
* Dissmiss view with reverse animation
*/
private void dismiss() {
preferencesManager.setDisplayed(usageId);
if(!isShowAlways)
preferencesManager.setDisplayed(usageId);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (isRevealAnimationEnabled)
exitRevealAnimation();
Expand Down Expand Up @@ -892,6 +905,10 @@ public void setPerformClick(boolean performClick) {
isPerformClick = performClick;
}

public void setShowAlways(boolean showAlways){
isShowAlways = showAlways;
}

public void setExtraPaddingForArc(int extraPaddingForArc) {
this.extraPaddingForArc = extraPaddingForArc;
}
Expand Down Expand Up @@ -1086,6 +1103,13 @@ public Builder performClick(boolean isPerformClick) {
return this;
}

/**
* If true -> Do not store spotlight id into preferences so that it can show every time when a particular screen is opened.
*/
public Builder showAlways(boolean isShowAlways) {
spotlightView.setShowAlways(isShowAlways);
return this;
}

public Builder fadeinTextDuration(long fadinTextDuration) {
spotlightView.setFadingTextDuration(fadinTextDuration);
Expand Down
Loading