@Override public void bind(NavigationContext navigationContext) { checkThatMainThread(); mNavigationContext = navigationContext; mActivityResultHandler.setScreenResultListener(mNavigationContext.getScreenResultListener()); executeQueuedCommands(); }
public AndroidNavigator(NavigationFactory navigationFactory) { mNavigationFactory = navigationFactory; mScreenResolver = new ScreenResolver(navigationFactory); mActivityResultHandler = new ActivityResultHandler(navigationFactory); }
@Override public void unbind() { checkThatMainThread(); mActivityResultHandler.resetScreenResultListener(); mNavigationContext = null; }
@Override protected void onResumeFragments() { super.onResumeFragments(); NavigationContext navigationContext = new NavigationContext.Builder(this) .screenSwitcher(mScreenSwitcher) .screenSwitchingListener(this) .build(); mNavigationContextBinder.bind(navigationContext); }
@Override protected void onResumeFragments() { super.onResumeFragments(); NavigationContext navigationContext = new NavigationContext.Builder(this).build(); mNavigationContextBinder.bind(navigationContext); }
@Override public void onBackPressed() { mNavigator.goBack(); } }
public static ScreenResolver getScreenResolver() { return sAndroidNavigator.getScreenResolver(); } }
/** * Finishes a current activity with result. Implemented with {@link FinishCommand}. * <p> * A screen result can be handled in {@code onActivityResult} method of a previous activity with {@link ActivityResultHandler}. * * @param screenResult screen result that will be returned */ @Override public void finishWithResult(ScreenResult screenResult) { finishWithResult(screenResult, null); }
/** * Adds a new screen and goes to it. Implemented with {@link ForwardCommand}. * * @param screen new screen */ @Override public void goForward(Screen screen) { goForward(screen, null); }
/** * Goes back to a screen with the given class and returns result to it. Implemented with {@link BackToCommand}. * * @param screenClass screen class for going back * @param screenResult screen result that will be returned */ @Override public void goBackToWithResult(Class<? extends Screen> screenClass, ScreenResult screenResult) { goBackToWithResult(screenClass, screenResult, null); }
/** * Replaces the last screen with a new screen. Implemented with {@link ReplaceCommand}. * * @param screen new screen */ @Override public void replace(Screen screen) { replace(screen, null); }
/** * Removes all other screens and adds a new screen. Implemented with {@link ResetCommand}. * * @param screen new screen */ @Override public void reset(Screen screen) { reset(screen, null); }
/** * Builds a navigation context * * @return created navigation context */ public NavigationContext build() { return new NavigationContext(this); } }
/** * Goes back to a screen with the given class. Implemented with {@link BackToCommand}. * * @param screenClass screen class for going back */ @Override public void goBackTo(Class<? extends Screen> screenClass) { goBackTo(screenClass, null); }
/** * Finishes a current screen and goes back to the previous screen. Implemented with {@link BackCommand}. */ @Override public void goBack() { goBack(null); }
/** * Finishes a current activity. Implemented with {@link FinishCommand}. */ @Override public void finish() { finish(null); }
@Override public void onBackPressed() { mNavigator.goBack(); } }
@Override public void onBackPressed() { mNavigator.goBack(); } }
@Override public void onBackPressed() { mNavigator.goBack(); }
@Override public void onBackPressed() { mNavigator.goBack(); } }