Skip to content

Commit

Permalink
Added Spotlight sequence event listener. 29jitender#71
Browse files Browse the repository at this point in the history
  • Loading branch information
dhavalwooplr committed Oct 25, 2017
1 parent 3d5ce3e commit 0d250a6
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 52 deletions.
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 .idea/modules.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class SpotlightSequence {

private static SpotlightSequence instance;
private final String TAG = "Tour Sequence";
private SpotlightSequenceListener spotlightSequenceListener;

/**
* Creates an instance of SpotlightSequence
Expand Down Expand Up @@ -147,9 +148,20 @@ private void playNext(){
}else {
Log.d(TAG, "END OF QUEUE");
resetTour();

if (spotlightSequenceListener != null)
spotlightSequenceListener.onSequenceEnd();
}
}

/**
* Set Spotlight sequence listener. (For now it is only for sequence end event.)
*/
public SpotlightSequence setListener(SpotlightSequenceListener listener){
this.spotlightSequenceListener = listener;
return instance;
}

/**
* Clear all Spotlights usageId from shared preferences.
* @param context
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.wooplr.spotlight.utils;

/**
* Created by dhavalrupapara on 25/10/17.
* Spotlight sequence Events listener.
*/
public interface SpotlightSequenceListener {
/**
* Called when sequence is ended.
*/
void onSequenceEnd();
}
8 changes: 8 additions & 0 deletions app/src/main/java/com/example/spotlight/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.wooplr.spotlight.SpotlightView;
import com.wooplr.spotlight.prefs.PreferencesManager;
import com.wooplr.spotlight.utils.SpotlightSequence;
import com.wooplr.spotlight.utils.SpotlightSequenceListener;
import com.wooplr.spotlight.utils.Utils;

import java.util.Random;
Expand Down Expand Up @@ -135,6 +136,13 @@ public void run() {
.addSpotlight(changePosAndPlay, "Change Position", "Click here to change position and replay", INTRO_CHANGE_POSITION)
.addSpotlight(startSequence, "Start sequence", "Well.. you just clicked here", INTRO_SEQUENCE)
.addSpotlight(fab,"Love", "Like the picture?\n" + "Let others know.", INTRO_CARD)
.setListener(new SpotlightSequenceListener() {
@Override
public void onSequenceEnd() {
Toast.makeText(MainActivity.this, "Spotlight sequence ended", Toast.LENGTH_SHORT).show();
Log.d("MainActivity", "Spotlight sequence ended");
}
})
.startSequence();
}
},400);
Expand Down

0 comments on commit 0d250a6

Please sign in to comment.