private void buildMovieViewer() { if (this.movieModel.isMovieValid()) { movieView = new MovieView( movieModel.getFile().getAbsolutePath(), IFPS, getRenderer(), MOVIE_PLAYER_WIDTH, MOVIE_PLAYER_HEIGHT); movieView.addMovieListener(this); this.addChild(movieView); movieView.play(); removeAllGestureEventListeners(); movieView.removeAllGestureEventListeners(); // addMovieViewGestureListerners(); delegateProcessor(movieView, MTMOVIE.this, DragProcessor.class); delegateProcessor(movieView, MTMOVIE.this, RotateProcessor.class); delegateProcessor(movieView, MTMOVIE.this, ScaleProcessor.class); addGestureListener(DragProcessor.class, new DefaultDragAction()); addGestureListener(RotateProcessor.class, new DefaultRotateAction()); addGestureListener( ScaleProcessor.class, new IGestureEventListener() { @Override public boolean processGestureEvent(MTGestureEvent ge) { if (ge instanceof ScaleEvent) { ScaleEvent se = (ScaleEvent) ge; float factor = se.getScaleFactorX(); movieView.scale(factor, factor, 1, getCenterPointLocal()); movieView.setAnchor(PositionAnchor.UPPER_LEFT); movieView.setPositionRelativeToParent(new Vector3D()); gestureArea.setAnchor(PositionAnchor.CENTER); gestureArea.setPositionRelativeToParent( new Vector3D( movieView.getWidthXY(TransformSpace.RELATIVE_TO_PARENT) / 2, movieView.getHeightXY(TransformSpace.RELATIVE_TO_PARENT) + gestureArea.getHeightXY(TransformSpace.LOCAL) / 2f)); fileName.setPositionRelativeToParent( new Vector3D( movieView.getWidthXY(TransformSpace.RELATIVE_TO_PARENT) / 2, movieView.getHeightXY(TransformSpace.RELATIVE_TO_PARENT) + GESTURE_AREA_HEIGHT + (fileName.getHeightXY(TransformSpace.LOCAL) / 2f))); } return false; } }); } }
private void addFileName(GSMovie m) { fileName = new MTTextArea( getRenderer(), FontManager.getInstance() .createFont(getRenderer(), "calibri", 16, MTColor.WHITE, true)); fileName.setAnchor(PositionAnchor.CENTER); fileName.removeAllGestureEventListeners(); fileName.setText(movieModel.getFile().getName()); fileName.setFillColor(new MTColor(128, 128, 128, 50)); fileName.setStrokeColor(new MTColor(100, 100, 100, 75)); addChild(fileName); fileName.setPositionRelativeToParent( new Vector3D( m.width / 2f, m.height + GESTURE_AREA_HEIGHT + (fileName.getHeightXY(TransformSpace.LOCAL) / 2f))); delegateProcessor(fileName, this, DragProcessor.class); }
public File getFile() { return movieModel.getFile(); }