diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java index 5c5c88d..beeeb0f 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java +++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java @@ -38,7 +38,6 @@ import java.util.ResourceBundle; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -51,31 +50,21 @@ import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXColorPicker; import com.jfoenix.controls.JFXHamburger; import com.jfoenix.controls.JFXSlider; -import com.jfoenix.controls.JFXTextField; import com.jfoenix.controls.JFXToggleButton; import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition; import javafx.animation.TranslateTransition; -import javafx.application.Platform; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; -import javafx.scene.Node; import javafx.scene.control.ChoiceBox; -import javafx.scene.control.ContextMenu; import javafx.scene.control.Label; -import javafx.scene.control.MenuItem; import javafx.scene.control.ScrollPane; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TreeItem; -import javafx.scene.control.TreeTableColumn; -import javafx.scene.control.TreeTableColumn.SortType; -import javafx.scene.control.TreeTableView; import javafx.scene.effect.BoxBlur; import javafx.scene.control.ScrollPane.ScrollBarPolicy; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.FlowPane; @@ -83,9 +72,6 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; -import javafx.scene.text.FontWeight; -import javafx.scene.text.Text; -import javafx.scene.text.TextFlow; import javafx.stage.DirectoryChooser; import javafx.stage.FileChooser; import javafx.stage.Stage; @@ -101,21 +87,23 @@ import kellerkinder.HomeFlix.player.Player; public class MainWindowController { - // general/settings fxml elements + // general @FXML private AnchorPane mainAnchorPane; - @FXML private ScrollPane settingsScrollPane; - @FXML private JFXHamburger menuHam; @FXML private HBox topHBox; @FXML private VBox sideMenuVBox; - @FXML private TableView sourcesTable; + + @FXML private JFXHamburger menuHam; @FXML private JFXButton aboutBtn; @FXML private JFXButton settingsBtn; + + // settings + @FXML private ScrollPane settingsScrollPane; + @FXML private JFXButton updateBtn; @FXML private JFXButton addDirectoryBtn; @FXML private JFXButton addStreamSourceBtn; - @FXML private JFXToggleButton autoUpdateToggleBtn; @FXML private JFXToggleButton autoplayToggleBtn; @@ -125,7 +113,7 @@ public class MainWindowController { @FXML private ChoiceBox branchChoisBox = new ChoiceBox<>(); @FXML private JFXSlider fontsizeSlider; - + @FXML private Label homeflixSettingsLbl; @FXML private Label mainColorLbl; @FXML private Label fontsizeLbl; @@ -135,31 +123,10 @@ public class MainWindowController { @FXML private Label sourcesLbl; @FXML private Label versionLbl; + @FXML private TableView sourcesTable; @FXML private TreeItem sourceRoot = new TreeItem<>(new SourceDataType("", "")); @FXML private TableColumn sourceColumn; @FXML private TableColumn modeColumn; - - // table-mode - @FXML private AnchorPane tableModeAnchorPane; - @FXML private JFXTextField searchTextField; - - @FXML private TreeTableView filmsTreeTable; - @FXML private TreeTableColumn columnStreamUrl; - @FXML private TreeTableColumn columnTitle; - @FXML private TreeTableColumn columnFavorite; - @FXML private TreeTableColumn columnSeason; - @FXML private TreeTableColumn columnEpisode; - @FXML private TreeItem filmRoot = new TreeItem<>(new FilmTabelDataType("", "", "", "", false, null)); - - - @FXML private ScrollPane textScrollPane; - @FXML private TextFlow textFlow; - @FXML private ImageView posterImageView; - - @FXML private JFXButton playbtn; - @FXML private JFXButton openfolderbtn; - @FXML private JFXButton returnBtn; - @FXML private JFXButton forwardBtn; // poster-mode @FXML private ScrollPane posterModeScrollPane; @@ -177,27 +144,18 @@ public class MainWindowController { private boolean menuTrue = false; - private final String version = "0.7.0"; - private final String buildNumber = "169"; + private final String version = "0.7.90"; + private final String buildNumber = "171"; private final String versionName = "toothless dragon"; private String btnStyle; - private final int hashA = -647380320; - private int last; - private int indexTable; - private int indexList; - private int next; private FilmTabelDataType currentTableFilm = new FilmTabelDataType("", "", "", "", false, null); private ObservableList languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)"); private ObservableList branches = FXCollections.observableArrayList("stable", "beta"); - private ObservableList filterData = FXCollections.observableArrayList(); private ObservableList filmsList = FXCollections.observableArrayList(); private ObservableList posterEmenents = FXCollections.observableArrayList(); private static ObservableList sourcesList = FXCollections.observableArrayList(); - private MenuItem like = new MenuItem("like"); - private MenuItem dislike = new MenuItem("dislike"); - private ContextMenu menu = new ContextMenu(like, dislike); private LocalDate lastValidCache = LocalDate.now().minusDays(30); // current date - 30 days is the last valid cache date public MainWindowController() { @@ -232,12 +190,10 @@ public class MainWindowController { initUI(); initActions(); dbController.init(); - refreshAllFilms(); - // load sources list in gui + // load data list in gui addSourceToTable(); - - posterModeStartup(); // TODO testing DO NOT USE THIS!! + posterModeStartup(); } // Initialize general UI elements @@ -271,22 +227,6 @@ public class MainWindowController { * Tabel-Mode */ private void initTabel() { - - // film Table - filmsTreeTable.setRoot(filmRoot); - filmsTreeTable.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY); - filmsTreeTable.setShowRoot(false); - - // write content into cell - columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty()); - columnTitle.setCellValueFactory(cellData -> cellData.getValue().getValue().titleProperty()); - columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty()); - columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty()); - columnFavorite.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty()); - - // context menu for treeTableViewfilm - filmsTreeTable.setContextMenu(menu); - // sourcesTreeTable sourceColumn.setCellValueFactory(cellData -> cellData.getValue().pathProperty()); modeColumn.setCellValueFactory(cellData -> cellData.getValue().modeProperty()); @@ -334,111 +274,10 @@ public class MainWindowController { fontsizeSlider.valueProperty().addListener(e -> { XMLController.setFontSize(fontsizeSlider.getValue()); - if (!getCurrentTitle().isEmpty()) { - setSelectedFilmInfo(dbController.readCache(getCurrentStreamUrl())); - } - xmlController.saveSettings(); - }); - - // Table-Mode actions - searchTextField.textProperty().addListener((e, oldValue, newValue) -> { - filmRoot.getChildren().clear(); - filterData.clear(); - filterData = filmsList.stream() - .filter(x -> x.getTitle().toLowerCase().contains(searchTextField.getText().toLowerCase())) - .collect(Collectors.toCollection(FXCollections::observableArrayList)); - - addFilmsToTable(filterData); - - if (searchTextField.getText().hashCode() == hashA) { - XMLController.setColor("000000"); - colorPicker.setValue(new Color(0, 0, 0, 1)); - applyColor(); - } - }); - - like.setOnAction(e -> { - dbController.like(getCurrentStreamUrl()); - filmsList.set(indexList, dbController.getStream(getCurrentStreamUrl())); - refreshTableElement(); - }); - - dislike.setOnAction(e -> { - dbController.dislike(getCurrentStreamUrl()); - filmsList.set(indexList, dbController.getStream(getCurrentStreamUrl())); - refreshTableElement(); - }); - - // FIXME fix bug when sort by ASCENDING, wrong order - columnFavorite.sortTypeProperty().addListener((e, paramT1, paramT2) -> { - filmRoot.getChildren().clear(); - filterData.clear(); - - if (paramT2.equals(SortType.DESCENDING)) { - // add favorites at the top - for (FilmTabelDataType film : filmsList) { - if (film.getFavorite()) { - filterData.add(0, film); - } else { - filterData.add(film); - } - } - } else { - // add favorites at the bottom - for (FilmTabelDataType film : filmsList) { - if (!film.getFavorite()) { - filterData.add(0, film); - } else { - filterData.add(film); - } - } - } - - addFilmsToTable(filterData); - }); - - // Change-listener for treeTableViewfilm - - filmsTreeTable.getSelectionModel().selectedItemProperty().addListener((e, paramT1, paramT2) -> { - if (filmsTreeTable.getSelectionModel().getSelectedItem() == null) { - return; - } - 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 - } - } - - if ((dbController.getCacheDate(getCurrentStreamUrl()).isAfter(lastValidCache) || getCurrentStreamUrl().contains("_rootNode")) - && dbController.searchCacheByURL(getCurrentStreamUrl())) { - LOGGER.info("loading from cache: " + getCurrentTitle()); - setSelectedFilmInfo(dbController.readCache(getCurrentStreamUrl())); - } else { - // this is not perfect! - new Thread(() -> { - Thread omdbAPIThread = new Thread(new OMDbAPIController(dbController, currentTableFilm, XMLController.getOmdbAPIKey())); - omdbAPIThread.setName("OMDbAPI"); - omdbAPIThread.start(); - - synchronized (omdbAPIThread) { - try { - omdbAPIThread.wait(); - } catch (InterruptedException e1) { - LOGGER.error(e1); - } - // update the GUI for the selected film - Platform.runLater(() -> { - setSelectedFilmInfo(dbController.readCache(getCurrentStreamUrl())); - }); - } - }).start(); - } + // TODO add functionality for postermode + + xmlController.saveSettings(); }); // Poster-Mode actions @@ -510,16 +349,6 @@ public class MainWindowController { } } - @FXML - private void returnBtnclicked() { - filmsTreeTable.getSelectionModel().select(last); - } - - @FXML - private void forwardBtnclicked() { - filmsTreeTable.getSelectionModel().select(next); - } - // general fxml actions @FXML private void aboutBtnAction() { @@ -585,11 +414,6 @@ public class MainWindowController { xmlController.saveSettings(); } - // refresh the selected child of the root node - private void refreshTableElement() { - filmRoot.getChildren().get(indexTable).setValue(filmsList.get(indexList)); - } - /** * refresh all films in filmsList and in filmsTable clear the FilmsList and * FilmRoot children, then update the database @@ -598,65 +422,6 @@ public class MainWindowController { filmsList.clear(); dbController.refreshDataBase(); // refreshes the database after a source path was added filmsList = dbController.getStreamsList(); // returns a list of all films stored in the database - - // refresh filmRoot in filmsTreeTable - filmRoot.getChildren().clear(); - addFilmsToTable(filmsList); - - // - } - - /** - * TODO rework! add data from a ObservableList to the films-table - * - * @param elementsList a list of elements you want to add - */ - public void addFilmsToTable(ObservableList elementsList) { - - for (FilmTabelDataType element : elementsList) { - - // only if the entry contains a season and a episode it's a valid series - if (!element.getSeason().isEmpty() && !element.getEpisode().isEmpty()) { - - // if there is any node check if it's the root node to the episode - // else there is no node at all so we must create a new - if (filmRoot.getChildren().size() > 0) { - for (int i = 0; i < filmRoot.getChildren().size(); i++) { - // if a root node exists, add element - // else create a new root node and add the element (if rootNode is the last - // node) (works since we edit the element!) - if (filmRoot.getChildren().get(i).getValue().getTitle().equals(element.getTitle())) { - TreeItem episodeNode = new TreeItem<>( - new FilmTabelDataType(element.getStreamUrl(), element.getTitle(), - element.getSeason(), element.getEpisode(), element.getFavorite(), - element.getImage())); - filmRoot.getChildren().get(i).getChildren().add(episodeNode); - } else if (filmRoot.getChildren().get(i).nextSibling() == null) { - TreeItem seriesRootNode = new TreeItem<>( - new FilmTabelDataType(element.getTitle() + "_rootNode", element.getTitle(), "", "", - element.getFavorite(), element.getImage())); - filmRoot.getChildren().add(seriesRootNode); - } - } - } else { - // add new root node - TreeItem seriesRootNode = new TreeItem<>( - new FilmTabelDataType(element.getTitle() + "_rootNode", element.getTitle(), "", "", - element.getFavorite(), element.getImage())); - filmRoot.getChildren().add(seriesRootNode); - - // add new element - TreeItem episodeNode = new TreeItem<>(new FilmTabelDataType( - element.getStreamUrl(), element.getTitle(), element.getSeason(), element.getEpisode(), - element.getFavorite(), element.getImage())); - filmRoot.getChildren().get(0).getChildren().add(episodeNode); - } - - } else { - // if season and episode are empty, we can assume the object is a film - filmRoot.getChildren().add(new TreeItem(element)); - } - } } // add a all elements of sourcesList to the sources table on the settings pane @@ -715,20 +480,12 @@ public class MainWindowController { 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"))); - returnBtn.setGraphic(new ImageView(new Image("icons/ic_skip_previous_white_18dp_1x.png"))); - forwardBtn.setGraphic(new ImageView(new Image("icons/ic_skip_next_white_18dp_1x.png"))); - menuHam.getStyleClass().clear(); menuHam.getStyleClass().add("jfx-hamburgerW"); } else { 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"))); - returnBtn.setGraphic(new ImageView(new Image("icons/ic_skip_previous_black_18dp_1x.png"))); - forwardBtn.setGraphic(new ImageView(new Image("icons/ic_skip_next_black_18dp_1x.png"))); - menuHam.getStyleClass().clear(); menuHam.getStyleClass().add("jfx-hamburgerB"); } @@ -736,16 +493,11 @@ public class MainWindowController { // boxes and TextFields sideMenuVBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";"); topHBox.setStyle("-fx-background-color: #" + XMLController.getColor() + ";"); - searchTextField.setFocusColor(Color.valueOf(XMLController.getColor())); // normal buttons addDirectoryBtn.setStyle(btnStyle); addStreamSourceBtn.setStyle(btnStyle); updateBtn.setStyle(btnStyle); - playbtn.setStyle(btnStyle); - openfolderbtn.setStyle(btnStyle); - returnBtn.setStyle(btnStyle); - forwardBtn.setStyle(btnStyle); // menu buttons settingsBtn.setStyle(menuBtnStyle); @@ -793,8 +545,6 @@ public class MainWindowController { aboutBtn.setText(XMLController.getLocalBundle().getString("info")); settingsBtn.setText(XMLController.getLocalBundle().getString("settings")); - searchTextField.setPromptText(XMLController.getLocalBundle().getString("tfSearch")); - openfolderbtn.setText(XMLController.getLocalBundle().getString("openFolder")); updateBtn.setText(XMLController.getLocalBundle().getString("checkUpdates")); addDirectoryBtn.setText(XMLController.getLocalBundle().getString("addDirectory")); addStreamSourceBtn.setText(XMLController.getLocalBundle().getString("addStreamSource")); @@ -805,69 +555,6 @@ public class MainWindowController { autoUpdateToggleBtn.setText(XMLController.getLocalBundle().getString("autoUpdate")); autoplayToggleBtn.setText(XMLController.getLocalBundle().getString("autoplay")); branchLbl.setText(XMLController.getLocalBundle().getString("branchLbl")); - columnStreamUrl.setText(XMLController.getLocalBundle().getString("columnStreamUrl")); - columnTitle.setText(XMLController.getLocalBundle().getString("columnName")); - columnFavorite.setText(XMLController.getLocalBundle().getString("columnFavorite")); - columnSeason.setText(XMLController.getLocalBundle().getString("columnSeason")); - columnEpisode.setText(XMLController.getLocalBundle().getString("columnEpisode")); - } - - private void setSelectedFilmInfo(String[] cacheData) { - Font font = Font.font("System", FontWeight.BOLD, (int) Math.round(XMLController.getFontSize())); - ObservableList textFlow = getTextFlow().getChildren(); - - // TODO this should move! *** - Text[] nameText = new Text[20]; - nameText[0] = new Text(XMLController.getLocalBundle().getString("title") + ": "); - nameText[1] = new Text(XMLController.getLocalBundle().getString("year") + ": "); - nameText[2] = new Text(XMLController.getLocalBundle().getString("rated") + ": "); - nameText[3] = new Text(XMLController.getLocalBundle().getString("released") + ": "); - nameText[4] = new Text(XMLController.getLocalBundle().getString("season") + ": "); - nameText[5] = new Text(XMLController.getLocalBundle().getString("episode") + ": "); - nameText[6] = new Text(XMLController.getLocalBundle().getString("runtime") + ": "); - nameText[7] = new Text(XMLController.getLocalBundle().getString("genre") + ": "); - nameText[8] = new Text(XMLController.getLocalBundle().getString("directors") + ": "); - nameText[9] = new Text(XMLController.getLocalBundle().getString("writers") + ": "); - nameText[10] = new Text(XMLController.getLocalBundle().getString("actors") + ": "); - nameText[11] = new Text(XMLController.getLocalBundle().getString("plot") + ": "); - nameText[12] = new Text(XMLController.getLocalBundle().getString("language") + ": "); - nameText[13] = new Text(XMLController.getLocalBundle().getString("country") + ": "); - nameText[14] = new Text(XMLController.getLocalBundle().getString("awards") + ": "); - nameText[15] = new Text(XMLController.getLocalBundle().getString("metascore") + ": "); - nameText[16] = new Text(XMLController.getLocalBundle().getString("imdbRating") + ": "); - nameText[17] = new Text(XMLController.getLocalBundle().getString("type") + ": "); - nameText[18] = new Text(XMLController.getLocalBundle().getString("boxOffice") + ": "); - nameText[19] = new Text(XMLController.getLocalBundle().getString("website") + ": "); - // *** - - // set the correct font for the nameText - for (Text text : nameText) { - text.setFont(font); - } - - // clear the textFlow and add the new text - textFlow.clear(); - - for (int i = 0; i < 20; i++) { - // 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")); - } - } - - getTextFlow().setStyle("-fx-font-size : " + ((int) Math.round(XMLController.getFontSize()) + 1) + "px;"); - - // add the image - try { - if (new File(cacheData[20]).isFile()) { - posterImageView.setImage(new Image(new File(cacheData[20]).toURI().toString())); - } else { - posterImageView.setImage(new Image(cacheData[20])); - } - } catch (Exception e) { - posterImageView.setImage(new Image("icons/Homeflix_Poster.png")); - LOGGER.error("No Poster found, useing default."); - } } // if AutoUpdate, then check for updates @@ -905,7 +592,8 @@ public class MainWindowController { private void posterModeStartup() { checkAllPosters(); - addGUIElements(); + addAllPosters(); + checkCache(); } /** @@ -918,7 +606,7 @@ public class MainWindowController { for (FilmTabelDataType entry : dbController.getAllNotCachedEntries()) { System.out.println(entry.getStreamUrl() + " is NOT cached!"); - Runnable OMDbAPIWorker = new OMDbAPIController(dbController, entry, XMLController.getOmdbAPIKey()); + Runnable OMDbAPIWorker = new OMDbAPIController(entry, XMLController.getOmdbAPIKey()); executor.execute(OMDbAPIWorker); } executor.shutdown(); @@ -940,7 +628,7 @@ public class MainWindowController { /** * add all cached films/series to the PosterMode GUI */ - private void addGUIElements() { + private void addAllPosters() { // refresh the posterModeElements list posterEmenents.clear(); posterEmenents = dbController.getPosterElementsList(); // returns a list of all PosterElements stored in the database @@ -949,19 +637,16 @@ public class MainWindowController { for (PosterModeElement element : posterEmenents) { element.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, (event) -> { enableBlur(); // blur the FlowPane + System.out.println("selected: " + element.getStreamURL()); // if the selected element is a file it's a film, else a series - if (new File(element.getStreamURL()).isFile()) { + if (new File(element.getStreamURL()).isFile() || element.getStreamURL().contains("http")) { filmDetailViewController.setFilm(element.getStreamURL()); filmDetailViewController.showPane(); } else { -// filmDetailViewController.setFilm(element.getStreamURL()); -// filmDetailViewController.showPane(); seriesDetailViewController.setSeries(element.getStreamURL()); seriesDetailViewController.showPane(); } - - System.out.println("selected: " + element.getStreamURL()); }); } @@ -971,6 +656,25 @@ public class MainWindowController { System.out.println("added gui elements"); } + // TODO can this be done in dbController? + /** + * check if the cache is to old, if so update asynchron + */ + private void checkCache() { + ExecutorService executor = Executors.newFixedThreadPool(5); + + // TODO if filmlist is not used anymore, it cann be removed + for(FilmTabelDataType entry : filmsList) { + if (dbController.getCacheDate(entry.getStreamUrl()).isBefore(lastValidCache)) { + System.out.println(entry.getTitle() + " chached on: " + dbController.getCacheDate(entry.getStreamUrl())); + Runnable OMDbAPIWorker = new OMDbAPIController(entry, XMLController.getOmdbAPIKey()); + executor.execute(OMDbAPIWorker); + } + } + + executor.shutdown(); + } + private void enableBlur() { BoxBlur boxBlur = new BoxBlur(); boxBlur.setWidth(9); @@ -997,22 +701,10 @@ public class MainWindowController { return currentTableFilm.getStreamUrl(); } - public int getIndexTable() { - return indexTable; - } - - public int getIndexList() { - return indexList; - } - public static ObservableList getSourcesList() { return sourcesList; } - public TextFlow getTextFlow() { - return textFlow; - } - public JFXButton getUpdateBtn() { return updateBtn; } diff --git a/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java b/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java index 7e0bf5b..dbdf814 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java +++ b/src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java @@ -67,7 +67,7 @@ public class SeriesDetailView { public void initialize() { dbController = DBController.getInstance(); seriesDVPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);"); - scrollPaneEpisodes.setStyle("-fx-background-color: transparent;"); + scrollPaneEpisodes.setStyle("-fx-background-color: transparent;"); scrollPaneEpisodes.setHbarPolicy(ScrollBarPolicy.ALWAYS); cbSeason.getSelectionModel().selectedIndexProperty().addListener((e, oldValue, newValue) -> { diff --git a/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java b/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java index a746558..af156ec 100644 --- a/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java +++ b/src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java @@ -55,10 +55,10 @@ public class OMDbAPIController implements Runnable { * @param currentTableFilm the current film object * @param omdbAPIKey the omdbAPI key */ - public OMDbAPIController(DBController dbController, FilmTabelDataType currentTableFilm, String omdbAPIKey) { - this.dbController = dbController; + public OMDbAPIController(FilmTabelDataType currentTableFilm, String omdbAPIKey) { this.currentTableFilm = currentTableFilm; this.omdbAPIKey = omdbAPIKey; + dbController = DBController.getInstance(); } @Override diff --git a/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java b/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java index 54e1db8..39eed19 100644 --- a/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java +++ b/src/main/java/kellerkinder/HomeFlix/player/PlayerController.java @@ -65,6 +65,10 @@ public class PlayerController { @FXML private JFXButton playBtn; @FXML private JFXButton fullscreenBtn; @FXML private JFXButton nextEpBtn; + + @FXML private ImageView stopIcon; + @FXML private ImageView playIcon; + @FXML private ImageView fullscreenIcon; private Player player; private Media media; @@ -82,11 +86,10 @@ public class PlayerController { private boolean showControls = true; private boolean autoplay; - private ImageView stop_black = new ImageView(new Image("icons/ic_stop_black_24dp_1x.png")); - private ImageView play_arrow_black = new ImageView(new Image("icons/ic_play_arrow_black_24dp_1x.png")); - private ImageView pause_black = new ImageView(new Image("icons/ic_pause_black_24dp_1x.png")); - private ImageView fullscreen_black = new ImageView(new Image("icons/ic_fullscreen_black_24dp_1x.png")); - private ImageView fullscreen_exit_black = new ImageView(new Image("icons/ic_fullscreen_exit_black_24dp_1x.png")); + private Image playArrow = new Image("icons/baseline_play_arrow_black_48dp.png"); + private Image pause = new Image("icons/baseline_pause_black_48dp.png"); + private Image fullscreen = new Image("icons/baseline_fullscreen_black_48dp.png"); + private Image fullscreenExit = new Image("icons/baseline_fullscreen_exit_black_48dp.png"); /** * create a new PlayerWindow object @@ -130,9 +133,8 @@ public class PlayerController { initMediaPlayer(); // set the control elements to the correct value - stopBtn.setGraphic(stop_black); - playBtn.setGraphic(pause_black); - fullscreenBtn.setGraphic(fullscreen_exit_black); + playIcon.setImage(pause); + fullscreenIcon.setImage(fullscreenExit); timeSlider.setValue(0); } @@ -176,7 +178,7 @@ public class PlayerController { // if we are 120ms to the end stop the media mediaPlayer.stop(); DBController.getInstance().setCurrentTime(film.getStreamUrl(), 0); // reset old video start time - playBtn.setGraphic(play_arrow_black); + playIcon.setImage(playArrow); } else { if (nextEpBtn.isVisible()) nextEpBtn.setVisible(false); @@ -262,10 +264,10 @@ public class PlayerController { void fullscreenBtnAction(ActionEvent event) { if (player.getStage().isFullScreen()) { player.getStage().setFullScreen(false); - fullscreenBtn.setGraphic(fullscreen_black); + fullscreenIcon.setImage(fullscreen); } else { player.getStage().setFullScreen(true); - fullscreenBtn.setGraphic(fullscreen_exit_black); + fullscreenIcon.setImage(fullscreenExit); } } @@ -273,10 +275,10 @@ public class PlayerController { void playBtnAction(ActionEvent event) { if (mediaPlayer.getStatus().equals(Status.PLAYING)) { mediaPlayer.pause(); - playBtn.setGraphic(play_arrow_black); + playIcon.setImage(playArrow); } else { mediaPlayer.play(); - playBtn.setGraphic(pause_black); + playIcon.setImage(pause); } } diff --git a/src/main/resources/css/MainWindow.css b/src/main/resources/css/MainWindow.css index 3a799cc..0aff210 100644 --- a/src/main/resources/css/MainWindow.css +++ b/src/main/resources/css/MainWindow.css @@ -129,7 +129,13 @@ -fx-background-insets: 0.0; } -.scroll-bar:vertical > .thumb, .scroll-bar:horizontal > .thumb { +.scroll-bar:vertical > .thumb { + -fx-background-color: #BCBCBC; + -fx-background-insets: 0.0; + -fx-background-radius: 15.0; +} + +.scroll-bar:horizontal > .thumb { -fx-background-color: #FFFFFF; -fx-background-insets: 0.0; -fx-background-radius: 15.0; diff --git a/src/main/resources/fxml/MainWindow.fxml b/src/main/resources/fxml/MainWindow.fxml index e710025..239c5d2 100644 --- a/src/main/resources/fxml/MainWindow.fxml +++ b/src/main/resources/fxml/MainWindow.fxml @@ -4,7 +4,6 @@ - @@ -13,58 +12,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/fxml/PlayerWindow.fxml b/src/main/resources/fxml/PlayerWindow.fxml index cfbdd27..40a58b4 100644 --- a/src/main/resources/fxml/PlayerWindow.fxml +++ b/src/main/resources/fxml/PlayerWindow.fxml @@ -3,13 +3,15 @@ + + - + @@ -25,15 +27,39 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/SeriesDetailView.fxml b/src/main/resources/fxml/SeriesDetailView.fxml index 555c79f..be1a12b 100644 --- a/src/main/resources/fxml/SeriesDetailView.fxml +++ b/src/main/resources/fxml/SeriesDetailView.fxml @@ -122,12 +122,16 @@ - + - + + + + + diff --git a/src/main/resources/icons/baseline_fullscreen_black_48dp.png b/src/main/resources/icons/baseline_fullscreen_black_48dp.png new file mode 100644 index 0000000..917e418 Binary files /dev/null and b/src/main/resources/icons/baseline_fullscreen_black_48dp.png differ diff --git a/src/main/resources/icons/baseline_fullscreen_exit_black_48dp.png b/src/main/resources/icons/baseline_fullscreen_exit_black_48dp.png new file mode 100644 index 0000000..5fc3166 Binary files /dev/null and b/src/main/resources/icons/baseline_fullscreen_exit_black_48dp.png differ diff --git a/src/main/resources/icons/baseline_pause_black_48dp.png b/src/main/resources/icons/baseline_pause_black_48dp.png new file mode 100755 index 0000000..16d26b3 Binary files /dev/null and b/src/main/resources/icons/baseline_pause_black_48dp.png differ diff --git a/src/main/resources/icons/baseline_stop_black_48dp.png b/src/main/resources/icons/baseline_stop_black_48dp.png new file mode 100755 index 0000000..dde8494 Binary files /dev/null and b/src/main/resources/icons/baseline_stop_black_48dp.png differ diff --git a/src/main/resources/icons/ic_favorite_black_18dp_1x.png b/src/main/resources/icons/ic_favorite_black_18dp_1x.png deleted file mode 100644 index 69be1f5..0000000 Binary files a/src/main/resources/icons/ic_favorite_black_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_favorite_border_black_18dp_1x.png b/src/main/resources/icons/ic_favorite_border_black_18dp_1x.png deleted file mode 100644 index 7edb675..0000000 Binary files a/src/main/resources/icons/ic_favorite_border_black_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_fullscreen_black_24dp_1x.png b/src/main/resources/icons/ic_fullscreen_black_24dp_1x.png deleted file mode 100644 index 3553d6a..0000000 Binary files a/src/main/resources/icons/ic_fullscreen_black_24dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_fullscreen_exit_black_24dp_1x.png b/src/main/resources/icons/ic_fullscreen_exit_black_24dp_1x.png deleted file mode 100644 index c839448..0000000 Binary files a/src/main/resources/icons/ic_fullscreen_exit_black_24dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_pause_black_24dp_1x.png b/src/main/resources/icons/ic_pause_black_24dp_1x.png deleted file mode 100644 index 6145664..0000000 Binary files a/src/main/resources/icons/ic_pause_black_24dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_play_arrow_black_18dp_1x.png b/src/main/resources/icons/ic_play_arrow_black_18dp_1x.png deleted file mode 100644 index 96021dc..0000000 Binary files a/src/main/resources/icons/ic_play_arrow_black_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_play_arrow_black_24dp_1x.png b/src/main/resources/icons/ic_play_arrow_black_24dp_1x.png deleted file mode 100644 index d78c57b..0000000 Binary files a/src/main/resources/icons/ic_play_arrow_black_24dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_play_arrow_white_18dp_1x.png b/src/main/resources/icons/ic_play_arrow_white_18dp_1x.png deleted file mode 100644 index cae85ab..0000000 Binary files a/src/main/resources/icons/ic_play_arrow_white_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_search_black_18dp_1x.png b/src/main/resources/icons/ic_search_black_18dp_1x.png deleted file mode 100644 index f0d4e97..0000000 Binary files a/src/main/resources/icons/ic_search_black_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_skip_next_black_18dp_1x.png b/src/main/resources/icons/ic_skip_next_black_18dp_1x.png deleted file mode 100644 index 327fd8d..0000000 Binary files a/src/main/resources/icons/ic_skip_next_black_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_skip_next_white_18dp_1x.png b/src/main/resources/icons/ic_skip_next_white_18dp_1x.png deleted file mode 100644 index 26434a0..0000000 Binary files a/src/main/resources/icons/ic_skip_next_white_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_skip_previous_black_18dp_1x.png b/src/main/resources/icons/ic_skip_previous_black_18dp_1x.png deleted file mode 100644 index 34c528d..0000000 Binary files a/src/main/resources/icons/ic_skip_previous_black_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_skip_previous_white_18dp_1x.png b/src/main/resources/icons/ic_skip_previous_white_18dp_1x.png deleted file mode 100644 index e7d7643..0000000 Binary files a/src/main/resources/icons/ic_skip_previous_white_18dp_1x.png and /dev/null differ diff --git a/src/main/resources/icons/ic_stop_black_24dp_1x.png b/src/main/resources/icons/ic_stop_black_24dp_1x.png deleted file mode 100644 index 0588f0b..0000000 Binary files a/src/main/resources/icons/ic_stop_black_24dp_1x.png and /dev/null differ