diff --git a/.idea/libraries/animated_vector_drawable_23_4_0.xml b/.idea/libraries/animated_vector_drawable_23_4_0.xml index f8bcc68..36b7174 100644 --- a/.idea/libraries/animated_vector_drawable_23_4_0.xml +++ b/.idea/libraries/animated_vector_drawable_23_4_0.xml @@ -1,13 +1,12 @@ - - + + - \ No newline at end of file diff --git a/.idea/libraries/appcompat_v7_23_4_0.xml b/.idea/libraries/appcompat_v7_23_4_0.xml index 6c6195f..95da926 100644 --- a/.idea/libraries/appcompat_v7_23_4_0.xml +++ b/.idea/libraries/appcompat_v7_23_4_0.xml @@ -1,17 +1,12 @@ - - - - - - + + - \ No newline at end of file diff --git a/.idea/libraries/design_23_4_0.xml b/.idea/libraries/design_23_4_0.xml index 88d8931..3e73e82 100644 --- a/.idea/libraries/design_23_4_0.xml +++ b/.idea/libraries/design_23_4_0.xml @@ -1,8 +1,5 @@ - - - diff --git a/.idea/libraries/espresso_core_2_2_2.xml b/.idea/libraries/espresso_core_2_2_2.xml index 64eafc2..4e9c2df 100644 --- a/.idea/libraries/espresso_core_2_2_2.xml +++ b/.idea/libraries/espresso_core_2_2_2.xml @@ -1,13 +1,12 @@ - - + + - \ No newline at end of file diff --git a/.idea/libraries/espresso_idling_resource_2_2_2.xml b/.idea/libraries/espresso_idling_resource_2_2_2.xml index eab8419..28e9d40 100644 --- a/.idea/libraries/espresso_idling_resource_2_2_2.xml +++ b/.idea/libraries/espresso_idling_resource_2_2_2.xml @@ -1,13 +1,12 @@ - - + + - \ No newline at end of file diff --git a/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml b/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml index 2b4c21f..bbda6ed 100644 --- a/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml +++ b/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml @@ -1,13 +1,12 @@ - - + + - \ No newline at end of file diff --git a/.idea/libraries/javax_inject_1.xml b/.idea/libraries/javax_inject_1.xml index 0d1d5fc..eebeedd 100644 --- a/.idea/libraries/javax_inject_1.xml +++ b/.idea/libraries/javax_inject_1.xml @@ -4,6 +4,8 @@ - + + + \ No newline at end of file diff --git a/.idea/libraries/recyclerview_v7_23_4_0.xml b/.idea/libraries/recyclerview_v7_23_4_0.xml index 67cedf1..230a1d2 100644 --- a/.idea/libraries/recyclerview_v7_23_4_0.xml +++ b/.idea/libraries/recyclerview_v7_23_4_0.xml @@ -1,11 +1,8 @@ - - - - + diff --git a/.idea/libraries/rules_0_5.xml b/.idea/libraries/rules_0_5.xml index d0051b5..219af33 100644 --- a/.idea/libraries/rules_0_5.xml +++ b/.idea/libraries/rules_0_5.xml @@ -1,17 +1,12 @@ - - - - - - + + - \ No newline at end of file diff --git a/.idea/libraries/runner_0_5.xml b/.idea/libraries/runner_0_5.xml index 760fdba..e8fe27f 100644 --- a/.idea/libraries/runner_0_5.xml +++ b/.idea/libraries/runner_0_5.xml @@ -1,17 +1,12 @@ - - - - - - + + - \ No newline at end of file diff --git a/.idea/libraries/support_v4_23_4_0.xml b/.idea/libraries/support_v4_23_4_0.xml index 2a4fdfb..f9d5520 100644 --- a/.idea/libraries/support_v4_23_4_0.xml +++ b/.idea/libraries/support_v4_23_4_0.xml @@ -1,18 +1,13 @@ - - - - - - - + + + - \ No newline at end of file diff --git a/.idea/libraries/support_vector_drawable_23_4_0.xml b/.idea/libraries/support_vector_drawable_23_4_0.xml index 04e0b2a..c7b9ca6 100644 --- a/.idea/libraries/support_vector_drawable_23_4_0.xml +++ b/.idea/libraries/support_vector_drawable_23_4_0.xml @@ -1,13 +1,12 @@ - - + + - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 97f53c8..54f637e 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,8 +3,11 @@ + + + \ No newline at end of file diff --git a/Spotlight-library/src/main/java/com/wooplr/spotlight/utils/SpotlightSequence.java b/Spotlight-library/src/main/java/com/wooplr/spotlight/utils/SpotlightSequence.java index dd0627f..0a42689 100644 --- a/Spotlight-library/src/main/java/com/wooplr/spotlight/utils/SpotlightSequence.java +++ b/Spotlight-library/src/main/java/com/wooplr/spotlight/utils/SpotlightSequence.java @@ -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 @@ -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 diff --git a/Spotlight-library/src/main/java/com/wooplr/spotlight/utils/SpotlightSequenceListener.java b/Spotlight-library/src/main/java/com/wooplr/spotlight/utils/SpotlightSequenceListener.java new file mode 100644 index 0000000..644c319 --- /dev/null +++ b/Spotlight-library/src/main/java/com/wooplr/spotlight/utils/SpotlightSequenceListener.java @@ -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(); +} diff --git a/app/src/main/java/com/example/spotlight/MainActivity.java b/app/src/main/java/com/example/spotlight/MainActivity.java index c85cb7a..28f6ccb 100644 --- a/app/src/main/java/com/example/spotlight/MainActivity.java +++ b/app/src/main/java/com/example/spotlight/MainActivity.java @@ -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; @@ -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);