Spotlight

0170827224713

Spotlight is Android Library that lights items for tutorials or walk-throughs etc...

customTarget

simpleTarget

Gradle

dependencies {
    compile 'com.github.takusemba:spotlight:1.1.1'
}

Usage


Spotlight.with(this)
        .setDuration(1000L) // duration of Spotlight emerging and disappearing in ms
        .setAnimation(new DecelerateInterpolator(2f)) // animation of Spotlight
        .setTargets(firstTarget, secondTarget, thirdTarget ...) // set targets. see below for more info
        .setOnSpotlightStartedListener(new OnSpotlightStartedListener() { // callback when Spotlight starts
            @Override
            public void onStarted() {
                Toast.makeText(context, "spotlight is started", Toast.LENGTH_SHORT).show();
            }
        })
        .setOnSpotlightEndedListener(new OnSpotlightEndedListener() { // callback when Spotlight ends
            @Override
            public void onEnded() {
                Toast.makeText(context, "spotlight is ended", Toast.LENGTH_SHORT).show();
            }
        })
        .start(); // start Spotlight
                        

if you want to show Spotlight immediately, use addOnGlobalLayoutListener to wait until views are drawn.

view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    @Override public void onGlobalLayout() {
        view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        Spotlight.with(this)...start();
    }
});

GitHub