public boolean onBack() { return childCanGoBack(); }
private View inflateLayout(Screen nextScreen, final Scoop scoop) { return getLayoutInflater().inflateView(scoop, nextScreen, this); }
@Override public void onTransitionCompleted() { final TransitionListener transitionListener = getTransitionListener(); transitionListener.onTransitionCompleted(); isTransitioning = false; if (!screenSwapQueue.isEmpty()) { screenSwapQueue.pop(); if (!screenSwapQueue.isEmpty()) { swap(screenSwapQueue.peek()); } } }
private void swap(RouteChange routeChange) { final Scoop currentScoop = getActiveScoop(routeChange); final ScreenSwap screenSwap = routeChange.toScreenSwap(); Screen previousScreen = screenSwap.previous; Screen nextScreen = screenSwap.next; final View prevView = active; ViewController nextViewController = null; if (active != null && previousScreen != null) { previousScreen.saveViewState(active); } if (nextScreen == null) { active = null; } else if (nextScreen.getController() != null) { nextViewController = getViewControllerInflater().inflateViewController(currentScoop, nextScreen.getController(), this); active = inflateViewFromController(nextViewController, currentScoop); nextScreen.restoreViewState(active); } else { active = inflateLayout(nextScreen, currentScoop); nextScreen.restoreViewState(active); } isTransitioning = true; ScreenTransition transition; if (screenSwap.direction == TransitionDirection.ENTER) { transition = getTransition(nextViewController, screenSwap.direction); } else { transition = getTransition(ViewController.fromView(prevView), screenSwap.direction); } transition.transition(this, prevView, active, this); }
@Test public void getTransitionsFromViewController() { final ViewControllerWithTransitions viewControllerWithTransitions = new ViewControllerWithTransitions(); final ScreenTransition enterTransition = UiContainer.getTransition(viewControllerWithTransitions, TransitionDirection.ENTER); final ScreenTransition exitTransition = UiContainer.getTransition(viewControllerWithTransitions, TransitionDirection.EXIT); Assert.assertEquals(enterTransition.getClass(), ForwardSlideTransition.class); Assert.assertEquals(exitTransition.getClass(), BackwardSlideTransition.class); }
private Scoop getActiveScoop(final RouteChange routeChange) { Scoop rootScoop = Scoop.fromView(this); Scoop currentScreenScoop = Scoop.fromView(active); return getScreenScooper().create(rootScoop, currentScreenScoop, routeChange.fromPath, routeChange.toPath); }
private boolean childCanGoBack() { if (active instanceof HandleBack) { return handleBack(active); } ViewController viewController = ViewController.fromView(active); if (viewController != null) { if (viewController instanceof HandleBack) { return handleBack(viewController); } } return false; }
private void swap(RouteChange routeChange) { final Scoop currentScoop = getActiveScoop(routeChange); final ScreenSwap screenSwap = routeChange.toScreenSwap(); Screen previousScreen = screenSwap.previous; Screen nextScreen = screenSwap.next; final View prevView = active; ViewController nextViewController = null; if (active != null && previousScreen != null) { previousScreen.saveViewState(active); } if (nextScreen == null) { active = null; } else if (nextScreen.getController() != null) { nextViewController = getViewControllerInflater().inflateViewController(currentScoop, nextScreen.getController(), this); active = inflateViewFromController(nextViewController, currentScoop); nextScreen.restoreViewState(active); } else { active = inflateLayout(nextScreen, currentScoop); nextScreen.restoreViewState(active); } isTransitioning = true; ScreenTransition transition; if (screenSwap.direction == TransitionDirection.ENTER) { transition = getTransition(nextViewController, screenSwap.direction); } else { transition = getTransition(ViewController.fromView(prevView), screenSwap.direction); } transition.transition(this, prevView, active, this); }
@Test public void useInstantTransitionIfControllerHasNoTransitions() { final ViewController viewControllerWithoutTransitions = new ViewControllerWithoutTransitions(); final ScreenTransition enterTransition = UiContainer.getTransition(viewControllerWithoutTransitions, TransitionDirection.ENTER); final ScreenTransition exitTransition = UiContainer.getTransition(viewControllerWithoutTransitions, TransitionDirection.EXIT); Assert.assertEquals(enterTransition.getClass(), InstantTransition.class); Assert.assertEquals(exitTransition.getClass(), InstantTransition.class); }
private Scoop getActiveScoop(final RouteChange routeChange) { Scoop rootScoop = Scoop.fromView(this); Scoop currentScreenScoop = Scoop.fromView(active); return getScreenScooper().create(rootScoop, currentScreenScoop, routeChange.fromPath, routeChange.toPath); }
private boolean childCanGoBack() { if (active instanceof HandleBack) { return handleBack(active); } ViewController viewController = ViewController.fromView(active); if (viewController != null) { if (viewController instanceof HandleBack) { return handleBack(viewController); } } return false; }
private void swap(RouteChange routeChange) { final Scoop currentScoop = getActiveScoop(routeChange); final ScreenSwap screenSwap = routeChange.toScreenSwap(); Screen previousScreen = screenSwap.previous; Screen nextScreen = screenSwap.next; final View prevView = active; ViewController nextViewController = null; if (active != null && previousScreen != null) { previousScreen.saveViewState(active); } if (nextScreen == null) { active = null; } else if (nextScreen.getController() != null) { nextViewController = getViewControllerInflater().inflateViewController(currentScoop, nextScreen.getController(), this); active = inflateViewFromController(nextViewController, currentScoop); nextScreen.restoreViewState(active); } else { active = inflateLayout(nextScreen, currentScoop); nextScreen.restoreViewState(active); } isTransitioning = true; ScreenTransition transition; if (screenSwap.direction == TransitionDirection.ENTER) { transition = getTransition(nextViewController, screenSwap.direction); } else { transition = getTransition(ViewController.fromView(prevView), screenSwap.direction); } transition.transition(this, prevView, active, this); }
@Override public void onTransitionCompleted() { final TransitionListener transitionListener = getTransitionListener(); transitionListener.onTransitionCompleted(); isTransitioning = false; if (!screenSwapQueue.isEmpty()) { screenSwapQueue.pop(); if (!screenSwapQueue.isEmpty()) { swap(screenSwapQueue.peek()); } } }
private Scoop getActiveScoop(final RouteChange routeChange) { Scoop rootScoop = Scoop.fromView(this); Scoop currentScreenScoop = Scoop.fromView(active); return getScreenScooper().create(rootScoop, currentScreenScoop, routeChange.fromPath, routeChange.toPath); }
private boolean childCanGoBack() { if (active instanceof HandleBack) { return handleBack(active); } ViewController viewController = ViewController.fromView(active); if (viewController != null) { if (viewController instanceof HandleBack) { return handleBack(viewController); } } return false; }
public boolean onBack() { return childCanGoBack(); }
private View inflateLayout(Screen nextScreen, final Scoop scoop) { return getLayoutInflater().inflateView(scoop, nextScreen, this); }
@Override public void onTransitionCompleted() { final TransitionListener transitionListener = getTransitionListener(); transitionListener.onTransitionCompleted(); isTransitioning = false; if (!screenSwapQueue.isEmpty()) { screenSwapQueue.pop(); if (!screenSwapQueue.isEmpty()) { swap(screenSwapQueue.peek()); } } }
public boolean onBack() { return childCanGoBack(); }
private View inflateLayout(Screen nextScreen, final Scoop scoop) { return getLayoutInflater().inflateView(scoop, nextScreen, this); }