@Override
 public void onDispose() {
   GoogleUINaviController naviController =
       UIStateController.getInstance().getGoogleNaviController();
   showPlayerMode(false);
   setPager(naviController.getPager());
 }
 @Override
 public IRotaryControllable push() {
   Song song = (Song) getPager().getActiveModel();
   album.reset();
   song.setActive(true);
   mpdService.playAlbum(album);
   Node node = getNodeForSong(song);
   updateBlink(node);
   return UIStateController.getInstance().getGooglePlayerController();
 }
  @Override
  public void onDisplay() {
    GoogleUINaviController naviController =
        UIStateController.getInstance().getGoogleNaviController();
    album = naviController.getActiveAlbum();
    setPager(naviController.getPager());

    albumNode = (Pane) naviController.getSelectedAlbumNode();
    albumNode.setStyle(GoogleUINaviController.STYLE_INACTIVE);

    showPlayerMode(true);
    updatePage(album.getActiveSong());
  }
  @Override
  public IRotaryControllable next() {
    if (getPager().isAtEnd()) {
      return UIStateController.getInstance().getGoogleNaviController();
    }
    super.next();

    if (getPager().getPosition() < (VISIBLE_ITEM_COUNT - 1)) {
      return this;
    }
    if (getPager().getPosition() > ((getPager().size()) - VISIBLE_ITEM_COUNT)) {
      return this;
    }

    TransitionUtil.moveNodeY(
        songBox, scrollPos, scrollPos - SCROLL_LEFT_LENGTH, false, SCROLL_DELAY);
    scrollPos -= SCROLL_LEFT_LENGTH;
    return this;
  }
  @Override
  public IRotaryControllable prev() {
    if (getPager().isAtStart()) {
      return UIStateController.getInstance().getGoogleNaviController();
    }

    super.prev();

    if (getPager().getPosition() > (getPager().size() - VISIBLE_ITEM_COUNT)) {
      return this;
    }

    if (scrollPos < 0) {
      TransitionUtil.moveNodeY(
          songBox, scrollPos, scrollPos + SCROLL_LEFT_LENGTH, false, SCROLL_DELAY);
      scrollPos += SCROLL_LEFT_LENGTH;
    }
    return this;
  }
  /**
   * Toogles the view between navigation view and playback mode.
   *
   * @param show
   */
  private void showPlayerMode(final boolean show) {
    UIStateController.getInstance().setLockInput(true);
    getPager().toggleMode();
    if (show) {
      getPager().setModels(new ArrayList<IServiceModel>(album.getSongs()), album.getSongs().get(0));
    } else {
      IGoogleMusicService service = ServiceRegistry.getGoogleService();
      List<Album> albums = service.getAlbums();
      getPager().setModels(new ArrayList<IServiceModel>(albums), album);
    }

    Pane centerRegion = UIStateController.getInstance().getGoogleNaviController().getCenterRegion();

    final ObservableList<Node> children = ((Pane) centerRegion.getChildren().get(0)).getChildren();
    List<Node> nodes = new ArrayList<Node>();
    int count = children.indexOf(albumNode) + 1;
    for (int i = count; i < count + 4; i++) {
      if (children.size() > i) {
        nodes.add(children.get(i));
      }
    }

    if (!show) {
      final FadeTransition outFader = TransitionUtil.createOutFader(songScroller);
      outFader.setOnFinished(
          new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent actionEvent) {
              albumNode.getChildren().remove(songScroller);
            }
          });
      outFader.play();
    }

    int scrollPos = (int) UIStateController.getInstance().getGoogleNaviController().getScrollPos();
    for (Node node : nodes) {
      TransitionUtil.moveNodeX(
          node,
          0,
          children.indexOf(albumNode) * GoogleUINaviController.COVER_SIZE + 490,
          !show,
          SCROLL_DELAY);
    }

    final EventHandler<ActionEvent> eventHandler =
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            if (show) {
              display();
              final FadeTransition inFader = TransitionUtil.createInFader(songScroller);
              inFader.setOnFinished(
                  new EventHandler<ActionEvent>() {
                    @Override
                    public void handle(ActionEvent actionEvent) {
                      UIStateController.getInstance().setLockInput(false);
                    }
                  });
              inFader.play();
            } else {
              if (UIStateController.getInstance().getActiveController()
                  != GoogleUIPlayerController.this) {
                albumNode.setStyle(GoogleUINaviController.STYLE_ACTIVE);
              }
              UIStateController.getInstance().setLockInput(false);
            }
          }
        };

    TransitionUtil.moveNode(
        centerRegion, scrollPos, (scrollPos - 245), !show, SCROLL_DELAY, eventHandler, true);
  }
 @Override
 public IRotaryControllable longPush() {
   return UIStateController.getInstance().getGoogleNaviController();
 }