@Override
  public UIPageViewControllerSpineLocation getSpineLocation(
      UIPageViewController pageViewController, UIInterfaceOrientation orientation) {
    // Set the spine position to "min" and the page view controller's view
    // controllers array to contain just one view
    // controller. Setting the spine position to
    // 'UIPageViewControllerSpineLocationMid' in landscape orientation sets
    // the doubleSided property to YES, so set it to NO here.
    UIViewController currentViewController = pageViewController.getViewControllers().get(0);

    NSArray<UIViewController> viewControllers = new NSArray<>(currentViewController);

    pageViewController.setViewControllers(
        viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

    pageViewController.setDoubleSided(false);
    return UIPageViewControllerSpineLocation.Min;
  }
  @Override
  public void viewDidLoad() {
    super.viewDidLoad();

    modelController = new ModelController();

    // Do any additional setup after loading the view, typically from a nib.
    // Configure the page view controller and add it as a child view
    // controller.
    pageViewController =
        new UIPageViewController(
            UIPageViewControllerTransitionStyle.PageCurl,
            UIPageViewControllerNavigationOrientation.Horizontal,
            null);
    pageViewController.setDelegate(this);

    modelController.setPageData(photosToShow);

    UIStoryboard storyboard = new UIStoryboard("Main", null);
    DataViewController startingViewController =
        modelController.getViewControllerAtIndex(0, storyboard);

    NSArray<UIViewController> viewControllers =
        new NSArray<UIViewController>(startingViewController);
    pageViewController.setViewControllers(
        viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);

    updateNavBarTitle();

    pageViewController.setDataSource(modelController);

    addChildViewController(pageViewController);
    getView().addSubview(pageViewController.getView());
    pageViewController.didMoveToParentViewController(this);

    // add the page view controller's gesture recognizers to the book view
    // controller's view
    // so that the gestures are started more easily
    getView().setGestureRecognizers(pageViewController.getGestureRecognizers());

    pageAnimationFinished = true;
  }