Skip to content

Commit

Permalink
Add helper method to get blocked listener in frag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
odin- committed Mar 9, 2017
1 parent 28ddd56 commit 84d71b9
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ public void updateNavigation() {
}
}

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();
Expand Down

0 comments on commit 84d71b9

Please sign in to comment.