From ea9e7405528a531f12b5c3304730717445f53b9b Mon Sep 17 00:00:00 2001 From: Seil0 Date: Mon, 6 May 2019 17:26:19 +0200 Subject: [PATCH] minor clean up --- .../application/MainWindowController.java | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java index 0883075..c065d84 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java +++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java @@ -374,6 +374,7 @@ public class MainWindowController { }); // Change-listener for treeTableViewfilm + filmsTreeTable.getSelectionModel().selectedItemProperty().addListener((e, paramT1, paramT2) -> { if (filmsTreeTable.getSelectionModel().getSelectedItem() == null) { return; @@ -381,15 +382,15 @@ public class MainWindowController { currentTableFilm = filmsTreeTable.getSelectionModel().getSelectedItem().getValue(); // set the current film object indexTable = filmsTreeTable.getSelectionModel().getSelectedIndex(); // get selected items table index + last = indexTable - 1; + next = indexTable + 1; + for (FilmTabelDataType film : filmsList) { if (film.equals(currentTableFilm)) { indexList = filmsList.indexOf(film); // get selected items list index } } - last = indexTable - 1; - next = indexTable + 1; - if ((currentTableFilm.getCached().isAfter(lastValidCache)) && dbController.searchCacheByURL(getCurrentStreamUrl())) { LOGGER.info("loading from cache: " + getCurrentTitle()); setSelectedFilmInfo(dbController.readCache(getCurrentStreamUrl())); @@ -505,11 +506,7 @@ public class MainWindowController { @FXML private void settingsBtnclicked() { - if (settingsScrollPane.isVisible()) { - settingsScrollPane.setVisible(false); - } else { - settingsScrollPane.setVisible(true); - } + settingsScrollPane.setVisible(!settingsScrollPane.isVisible()); } @FXML @@ -686,8 +683,7 @@ public class MainWindowController { BigInteger checkColor = new BigInteger("78909cff", 16); if (usedColor.compareTo(checkColor) == -1) { - btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() - + "; -fx-text-fill: WHITE;"; + btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: WHITE;"; menuBtnStyle = "-fx-text-fill: WHITE;"; playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_white_18dp_1x.png"))); @@ -697,8 +693,7 @@ public class MainWindowController { menuHam.getStyleClass().clear(); menuHam.getStyleClass().add("jfx-hamburgerW"); } else { - btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() - + "; -fx-text-fill: BLACK;"; + btnStyle = "-fx-button-type: RAISED; -fx-background-color: #" + XMLController.getColor() + "; -fx-text-fill: BLACK;"; menuBtnStyle = "-fx-text-fill: BLACK;"; playbtn.setGraphic(new ImageView(new Image("icons/ic_play_arrow_black_18dp_1x.png"))); @@ -819,12 +814,10 @@ public class MainWindowController { // clear the textFlow and add the new text textFlow.clear(); - - // TODO rework + for (int i = 0; i < 20; i++) { - if (cacheData[i] != null && (i == 5 || i == 6) && cacheData[5].length() == 0) { - // do nothing - } else if (cacheData[i] != null) { + // if the cacheData exists and they are not empty add the text + if(cacheData[i] != null && cacheData[i].length() > 0) { textFlow.addAll(nameText[i], new Text(cacheData[i] + "\n")); } }