package com.heinrichreimersoftware.materialintro.app;

import android.support.v4.app.Fragment;

public class SlideFragment extends Fragment {

    public boolean canGoForward() {
        return true;
    }

    public boolean canGoBackward() {
        return true;
    }

    public void updateNavigation() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).lockSwipeIfNeeded();
        }
    }

    public void addOnNavigationBlockedListener(OnNavigationBlockedListener listener) {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).addOnNavigationBlockedListener(listener);
        }
    }

    public void removeOnNavigationBlockedListener(OnNavigationBlockedListener listener) {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).removeOnNavigationBlockedListener(listener);
        }
    }

    protected void nextSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).nextSlide();
        }
    }

    protected void previousSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).previousSlide();
        }
    }

}

package com.heinrichreimersoftware.materialintro.app;

import android.support.v4.app.Fragment;

public class SlideFragment extends Fragment {

    public boolean canGoForward() {
        return true;
    }

    public boolean canGoBackward() {
        return true;
    }

    public void updateNavigation() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).lockSwipeIfNeeded();
        }
    }

    protected void nextSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).nextSlide();
        }
    }

    protected void previousSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).previousSlide();
        }
    }

}

--- 
+++ 
@@ -18,6 +18,18 @@
         }
     }
 
+    public void addOnNavigationBlockedListener(OnNavigationBlockedListener listener) {
+        if (getActivity() instanceof IntroActivity) {
+            ((IntroActivity) getActivity()).addOnNavigationBlockedListener(listener);
+        }
+    }
+
+    public void removeOnNavigationBlockedListener(OnNavigationBlockedListener listener) {
+        if (getActivity() instanceof IntroActivity) {
+            ((IntroActivity) getActivity()).removeOnNavigationBlockedListener(listener);
+        }
+    }
+
     protected void nextSlide() {
         if (getActivity() instanceof IntroActivity) {
             ((IntroActivity) getActivity()).nextSlide();
Add helper method to get blocked listener in frag

One user scenario could be that we want to start async tasks when the
navigation is blocked. These tasks might be better fired of from the
fragment than the IntroActivity, thus listener needed in fragment.
