private void performRouteChange(List<Screen> fromPath, List<Screen> toPath, TransitionDirection direction) { onRouteChanged(new RouteChange(fromPath, toPath, direction)); }
private Screen nextScreen() { return getScreenFromPath(toPath); }
public ScreenSwap toScreenSwap() { return new ScreenSwap(this.previousScreen(), this.nextScreen(), this.direction); }
@Test public void screenEmptyPath() { List<Screen> fromPath = Arrays.<Screen>asList(); List<Screen> toPath = Arrays.<Screen>asList(); RouteChange routeChange = new RouteChange(fromPath, toPath, ENTER_TRANSITION); ScreenSwap screenSwap = routeChange.toScreenSwap(); assertNull(screenSwap.next); assertNull(screenSwap.previous); assertEquals(ENTER_TRANSITION, screenSwap.direction); }
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 screenOneElementPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA()); RouteChange routeChange = new RouteChange(fromPath, toPath, ENTER_TRANSITION); ScreenSwap screenSwap = routeChange.toScreenSwap(); assertEquals(new ScreenA(), screenSwap.next); assertEquals(new ScreenA(), screenSwap.previous); assertEquals(ENTER_TRANSITION, screenSwap.direction); }
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 screenMultipleElementPath() { List<Screen> fromPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); List<Screen> toPath = Arrays.<Screen>asList(new ScreenA(), new ScreenB()); RouteChange routeChange = new RouteChange(fromPath, toPath, ENTER_TRANSITION); ScreenSwap screenSwap = routeChange.toScreenSwap(); assertEquals(new ScreenB(), screenSwap.next); assertEquals(new ScreenB(), screenSwap.previous); assertEquals(ENTER_TRANSITION, screenSwap.direction); }
public ScreenSwap toScreenSwap() { return new ScreenSwap(this.previousScreen(), this.nextScreen(), this.direction); }
private Screen previousScreen() { return getScreenFromPath(fromPath); }
private void performRouteChange(List<Screen> fromPath, List<Screen> toPath, TransitionDirection direction) { onRouteChanged(new RouteChange(fromPath, toPath, direction)); }
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); }
public ScreenSwap toScreenSwap() { return new ScreenSwap(this.previousScreen(), this.nextScreen(), this.direction); }
private Screen nextScreen() { return getScreenFromPath(toPath); }
private void performRouteChange(List<Screen> fromPath, List<Screen> toPath, TransitionDirection direction) { onRouteChanged(new RouteChange(fromPath, toPath, direction)); }
private Screen previousScreen() { return getScreenFromPath(fromPath); }
private Screen previousScreen() { return getScreenFromPath(fromPath); }
private Screen nextScreen() { return getScreenFromPath(toPath); }