@Override public WeatherInfo getDefaultWeather() { final List<IServiceModel> serviceData = ServiceRegistry.getWeatherService().getServiceData(false); for (IServiceModel model : serviceData) { WeatherInfo info = (WeatherInfo) model; if (info.isDefaultLocation()) { return info; } } return null; }
public GoogleUIPlayerController() { // the player does not use the mpd service! super(ServiceRegistry.getMpdService()); }
@Override public BorderPane init() { mpdService = ServiceRegistry.getMpdService(); return null; // component does only modify the current UI and re-uses the pager. }
/** * 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); }