code cleanup

This commit is contained in:
Jannik 2018-04-08 13:22:20 +02:00
parent 4b5c9482c8
commit 96e3d9e3ac
3 changed files with 3 additions and 11 deletions

View File

@ -103,7 +103,7 @@ public class MainWindowController {
@FXML @FXML
private AnchorPane mainAnchorPane; private AnchorPane mainAnchorPane;
@FXML @FXML
private AnchorPane tableModeAnchorPane; private AnchorPane tableModeAnchorPane;

View File

@ -31,11 +31,9 @@ import javafx.stage.Stage;
import javafx.stage.WindowEvent; import javafx.stage.WindowEvent;
import kellerkinder.HomeFlix.application.Main; import kellerkinder.HomeFlix.application.Main;
import kellerkinder.HomeFlix.application.MainWindowController; import kellerkinder.HomeFlix.application.MainWindowController;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
public class Player { public class Player {
private MainWindowController mainWindowController;
private PlayerController playerController; private PlayerController playerController;
private Stage stage; private Stage stage;
private AnchorPane pane; private AnchorPane pane;
@ -46,7 +44,6 @@ public class Player {
* @param mainWindowController the MainWindowController * @param mainWindowController the MainWindowController
*/ */
public Player(MainWindowController mainWindowController) { public Player(MainWindowController mainWindowController) {
this.mainWindowController = mainWindowController;
try { try {
FXMLLoader fxmlLoader = new FXMLLoader(ClassLoader.getSystemResource("fxml/PlayerWindow.fxml")); FXMLLoader fxmlLoader = new FXMLLoader(ClassLoader.getSystemResource("fxml/PlayerWindow.fxml"));
pane = (AnchorPane) fxmlLoader.load(); pane = (AnchorPane) fxmlLoader.load();
@ -73,10 +70,6 @@ public class Player {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void playNewFilm(FilmTabelDataType film) {
playerController.init(mainWindowController, this, film);
}
public Stage getStage() { public Stage getStage() {
return stage; return stage;

View File

@ -138,7 +138,6 @@ public class PlayerController {
}); });
// every time the play time changes execute this // every time the play time changes execute this
// TODO rework autoplay
mediaPlayer.currentTimeProperty().addListener(new ChangeListener<Duration>() { mediaPlayer.currentTimeProperty().addListener(new ChangeListener<Duration>() {
@Override @Override
public void changed(ObservableValue<? extends Duration> observable, Duration oldValue, Duration newValue) { public void changed(ObservableValue<? extends Duration> observable, Duration oldValue, Duration newValue) {
@ -152,7 +151,7 @@ public class PlayerController {
FilmTabelDataType nextFilm = mainWCon.getDbController().getNextEpisode(film.getTitle(), (episode + 1)); FilmTabelDataType nextFilm = mainWCon.getDbController().getNextEpisode(film.getTitle(), (episode + 1));
if (nextFilm != null) { if (nextFilm != null) {
mediaPlayer.stop(); mediaPlayer.stop();
player.playNewFilm(nextFilm); init(mainWCon, player, nextFilm);
autoplay = true; autoplay = true;
} }
} else if ((duration - currentTime) < 100) { } else if ((duration - currentTime) < 100) {
@ -178,7 +177,7 @@ public class PlayerController {
private void initActions() { private void initActions() {
player.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, new EventHandler<MouseEvent>() { player.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, new EventHandler<MouseEvent>() {
// hide controls timer init // hide controls timer initialization
final Timer timer = new Timer(); final Timer timer = new Timer();
TimerTask controlAnimationTask = null; // task to execute save operation TimerTask controlAnimationTask = null; // task to execute save operation
final long delayTime = 1000; final long delayTime = 1000;