Browse Source

added first layout for SeriesDetailView

pull/12/head
Jannik 3 years ago
parent
commit
693650fece
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 50
      src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java
  2. 2
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  3. 4
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  4. 10
      src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java
  5. 32
      src/main/java/kellerkinder/HomeFlix/player/Player.java
  6. 4
      src/main/java/kellerkinder/HomeFlix/player/PlayerController.java
  7. 12
      src/main/resources/fxml/FilmDetailView.fxml
  8. 4
      src/main/resources/fxml/MainWindow.fxml
  9. 212
      src/main/resources/fxml/SeriesDetailView.fxml
  10. BIN
      src/main/resources/icons/2QjWeU6mfvx6sWF2z9CLb4kdRnR.jpg
  11. BIN
      src/main/resources/icons/baseline_keyboard_arrow_down_white_48dp_48x16.png
  12. BIN
      src/main/resources/icons/spider-man.jpg

50
src/main/java/kellerkinder/HomeFlix/application/FilmDetailView.java

@ -1,8 +1,10 @@
package kellerkinder.HomeFlix.application;
import java.awt.Desktop;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -19,6 +21,7 @@ import javafx.scene.text.Text;
import javafx.util.Duration;
import kellerkinder.HomeFlix.controller.DBController;
import kellerkinder.HomeFlix.controller.XMLController;
import kellerkinder.HomeFlix.player.Player;
public class FilmDetailView {
@ -52,7 +55,7 @@ public class FilmDetailView {
@FXML private JFXButton btnPlay;
@FXML private JFXButton btnDirectory;
@FXML private ImageView wishListIcon;
@FXML private ImageView wishlistIcon;
@FXML private ImageView favoriteIcon;
@FXML private ImageView imgPoster;
@ -192,8 +195,53 @@ public class FilmDetailView {
MainWindowController.getInstance().disableBlur(); // disable blur
}
// TODO rework
private void playFilm() {
if(new File(currentStreamURL).isDirectory()) {
return;
}
if (Player.isSupportedFormat(currentStreamURL)) {
new Player(currentStreamURL);
} else {
LOGGER.error("using fallback player!");
if (System.getProperty("os.name").contains("Linux")) {
String line;
String output = "";
Process p;
try {
p = Runtime.getRuntime().exec("which vlc");
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
output = line;
}
LOGGER.info("which vlc: " + output);
input.close();
} catch (IOException e1) {
e1.printStackTrace();
}
if (output.contains("which: no vlc") || output == "") {
// JFXInfoAlert vlcInfoAlert = new JFXInfoAlert("Info",
// XMLController.getLocalBundle().getString("vlcNotInstalled"), btnStyle, primaryStage);
// vlcInfoAlert.showAndWait();
} else {
try {
new ProcessBuilder("vlc", currentStreamURL).start();
} catch (IOException e) {
LOGGER.warn("An error has occurred while opening the file!", e);
}
}
} else if (System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")) {
try {
Desktop.getDesktop().open(new File(currentStreamURL));
} catch (IOException e) {
LOGGER.warn("An error has occurred while opening the file!", e);
}
} else {
LOGGER.error(System.getProperty("os.name") + ", OS is not supported, please contact a developer! ");
}
}
}
}

2
src/main/java/kellerkinder/HomeFlix/application/Main.java

@ -72,7 +72,7 @@ public class Main extends Application {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/fxml/MainWindow.fxml"));
pane = (AnchorPane) loader.load();
primaryStage.setMinHeight(600.00);
primaryStage.setMinHeight(600.00 + 34); // 34 -> window decoration
primaryStage.setMinWidth(1130.00);
//primaryStage.setResizable(false);
primaryStage.setTitle("Project HomeFlix");

4
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

@ -237,7 +237,7 @@ public class MainWindowController {
// load sources list in gui
addSourceToTable();
// posterModeStartup(); // TODO testing DO NOT USE THIS!!
posterModeStartup(); // TODO testing DO NOT USE THIS!!
}
// Initialize general UI elements
@ -460,7 +460,7 @@ public class MainWindowController {
}
if (isSupportedFormat(currentTableFilm)) {
new Player(getCurrentTableFilm());
new Player(getCurrentStreamUrl());
} else {
LOGGER.error("using fallback player!");
if (System.getProperty("os.name").contains("Linux")) {

10
src/main/java/kellerkinder/HomeFlix/application/SeriesDetailView.java

@ -0,0 +1,10 @@
package kellerkinder.HomeFlix.application;
import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane;
public class SeriesDetailView {
@FXML private AnchorPane seriesDVPane;
}

32
src/main/java/kellerkinder/HomeFlix/player/Player.java

@ -22,16 +22,15 @@
package kellerkinder.HomeFlix.player;
import javafx.event.EventHandler;
import java.net.URLConnection;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import kellerkinder.HomeFlix.application.Main;
import kellerkinder.HomeFlix.controller.DBController;
import kellerkinder.HomeFlix.datatypes.FilmTabelDataType;
public class Player {
@ -44,8 +43,8 @@ public class Player {
* generate a new PlayerWindow
* @param currentTableFilm the currently selected film
*/
public Player(FilmTabelDataType currentTableFilm) {
playerController = new PlayerController(this, currentTableFilm);
public Player(String streamURL) {
playerController = new PlayerController(this, streamURL);
try {
FXMLLoader fxmlLoader = new FXMLLoader();
@ -57,13 +56,10 @@ public class Player {
stage.setScene(scene);
stage.setTitle("HomeFlix");
stage.getIcons().add(new Image(Main.class.getResourceAsStream("/icons/Homeflix_Icon_64x64.png")));
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent we) {
DBController.getInstance().setCurrentTime(currentTableFilm.getStreamUrl(),
playerController.getCurrentTime());
playerController.getMediaPlayer().stop();
stage.close();
}
stage.setOnCloseRequest(event -> {
DBController.getInstance().setCurrentTime(streamURL, playerController.getCurrentTime());
playerController.getMediaPlayer().stop();
stage.close();
});
playerController.init();
@ -83,4 +79,16 @@ public class Player {
return scene;
}
/**
* check if a film is supported by the HomeFlixPlayer or not this is the case if
* the mime type is mp4
*
* @param entry the film you want to check
* @return true if so, false if not
*/
public static boolean isSupportedFormat(String streamURL) {
String mimeType = URLConnection.guessContentTypeFromName(streamURL);
return mimeType != null && (mimeType.contains("mp4") || mimeType.contains("vp6"));
}
}

4
src/main/java/kellerkinder/HomeFlix/player/PlayerController.java

@ -94,9 +94,9 @@ public class PlayerController {
* @param player the player object (needed for closing action)
* @param film the film object
*/
public PlayerController(Player player, FilmTabelDataType film) {
public PlayerController(Player player, String streamURL) {
this.player = player;
this.film = film;
this.film = DBController.getInstance().getStream(streamURL);
}
/**

12
src/main/resources/fxml/FilmDetailView.fxml

@ -2,7 +2,6 @@
<?import com.jfoenix.controls.JFXButton?>
<?import javafx.geometry.Insets?>
<?import javafx.geometry.Rectangle2D?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
@ -89,7 +88,7 @@
</VBox>
<VBox spacing="3.0">
<children>
<Label fx:id="lblWriters" maxWidth="300.0" text="Rodney Rothman" textFill="#ecebed">
<Label fx:id="lblWriters" maxWidth="300.0" text="Phil Lord, Rodney Rothman" textFill="#ecebed">
<font>
<Font name="System Bold" size="15.0" />
</font>
@ -103,7 +102,7 @@
</VBox>
<VBox spacing="3.0">
<children>
<Label fx:id="lblActors" maxWidth="300.0" text="Rodney Rothman" textFill="#ecebed">
<Label fx:id="lblActors" maxWidth="308.0" text="Shameik Moore, Jake Johnson, Hailee Steinfeld, Mahershala Ali" textFill="#ecebed">
<font>
<Font name="System Bold" size="15.0" />
</font>
@ -186,14 +185,14 @@
<graphic>
<ImageView pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_keyboard_arrow_down_white_48dp.png" />
<Image url="@../icons/baseline_keyboard_arrow_down_white_48dp_48x16.png" />
</image>
</ImageView>
</graphic>
</JFXButton>
<ImageView fx:id="imgPoster" fitHeight="400.0" fitWidth="267.0" layoutX="849.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.rightAnchor="22.0" AnchorPane.topAnchor="22.0">
<image>
<Image url="@../icons/spider-man.jpg" />
<Image url="@../icons/Homeflix_Poster.png" />
</image>
</ImageView>
<JFXButton fx:id="btnPlay" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" layoutX="841.0" layoutY="448.0" maxHeight="-Infinity" onAction="#btnPlayAction" prefHeight="32.0" prefWidth="267.0" style="-fx-background-color: #ffffff;" text="Play" AnchorPane.rightAnchor="22.0" AnchorPane.topAnchor="448.0">
@ -202,9 +201,6 @@
<image>
<Image url="@../icons/baseline_play_arrow_black_48dp.png" />
</image>
<viewport>
<Rectangle2D />
</viewport>
</ImageView>
</graphic></JFXButton>
<JFXButton fx:id="btnDirectory" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" layoutX="841.0" layoutY="506.0" maxHeight="-Infinity" onAction="#btnDirectoryAction" prefHeight="32.0" prefWidth="267.0" style="-fx-background-color: #ffffff;" text="open Directory" AnchorPane.rightAnchor="22.0" AnchorPane.topAnchor="506.0">

4
src/main/resources/fxml/MainWindow.fxml

@ -65,11 +65,11 @@
<JFXButton fx:id="forwardBtn" contentDisplay="CENTER" onAction="#forwardBtnclicked" prefHeight="25.0" prefWidth="90.0" AnchorPane.bottomAnchor="132.0" AnchorPane.rightAnchor="12.0" />
</children>
</AnchorPane>
<ScrollPane fx:id="posterModeScrollPane" fitToWidth="true" layoutX="10.0" layoutY="48.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<ScrollPane fx:id="posterModeScrollPane" fitToWidth="true" layoutX="10.0" layoutY="48.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<content>
<FlowPane fx:id="posterModeFlowPane" hgap="3.0" vgap="7.0">
<padding>
<Insets bottom="17.0" left="3.0" right="3.0" />
<Insets bottom="17.0" left="3.0" right="3.0" top="3.0" />
</padding>
</FlowPane>
</content>

212
src/main/resources/fxml/SeriesDetailView.fxml

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="seriesDVPane" prefHeight="568.0" prefWidth="1130.0" style="-fx-background-color: #595959;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kellerkinder.HomeFlix.application.SeriesDetailView">
<children>
<HBox layoutX="22.0" layoutY="21.0" prefWidth="808.0" spacing="10.0" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="310.0" AnchorPane.topAnchor="22.0">
<children>
<Label fx:id="lblTitle" minHeight="-Infinity" prefHeight="29.0" text="Avatar: The Last Airbender" textFill="#ecebed">
<font>
<Font name="System Bold" size="24.0" />
</font>
</Label>
<Label fx:id="lblYear" alignment="CENTER" maxHeight="-Infinity" minHeight="-Infinity" minWidth="71.0" prefHeight="29.0" text="(2005)" textFill="#ecebed">
<font>
<Font size="24.0" />
</font>
</Label>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" layoutY="71.0" spacing="10.0" AnchorPane.leftAnchor="22.0" AnchorPane.topAnchor="80.0">
<children>
<HBox alignment="CENTER_LEFT">
<children>
<Label fx:id="lblScore" text="Wertung: 82%" textFill="#ecebed">
<font>
<Font size="15.0" />
</font></Label>
</children>
<padding>
<Insets right="20.0" />
</padding>
</HBox>
<JFXButton fx:id="btnWishlist" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" onAction="#btnWishlistAction" prefHeight="40.0" prefWidth="40.0" style="-fx-background-color: #ffffff; -fx-background-radius: 40px;" text="List">
<graphic>
<ImageView fx:id="wishlistIcon" fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_list_black_48dp.png" />
</image>
</ImageView>
</graphic></JFXButton>
<JFXButton fx:id="btnFavourite" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" onAction="#btnFavouriteAction" prefHeight="40.0" prefWidth="40.0" style="-fx-background-color: #ffffff; -fx-background-radius: 40px;" text="Fav">
<graphic>
<ImageView fx:id="favoriteIcon" fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_favorite_border_black_48dp.png" />
</image>
</ImageView>
</graphic></JFXButton>
</children>
</HBox>
<TextFlow layoutX="22.0" layoutY="150.0" lineSpacing="1.0" maxHeight="-Infinity" prefHeight="130.0" prefWidth="808.0" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="310.0" AnchorPane.topAnchor="130.0">
<children>
<Text fx:id="textPlot" fill="#ecebed" strokeType="OUTSIDE" strokeWidth="0.0" text="Avatar: Der Herr der Elemente ist eine amerikanische Zeichentrickserie. Die Serie wurde erstellt und produziert von Michael Dante DiMartion und Bryan Konietzko. Avatar spielt in einer, stark asiatisch beeinflussten Welt, in der einige in der Lage sind die Elemente zu beeinflussen. Die Fähigkeit die Elemente zu &quot;bändigen&quot;, erfolgt in einer Mischung aus mentaler Beeinflussung und einer Variation von fernöstlicher Kampfkunst.Die Serie erzählt die Geschichte des zwölfjährigen Aangs und seinen Freunden, die versuchen das Gleichgewicht der Elemente wieder herzustellen, indem sie die Herrschaft des Feuerlords über die drei anderen Elemente beenden. Aang ist der letzte verbliebene Luftbändiger und gleichzeitig der Avatar, welcher 100 Jahre verschollen war.">
<font>
<Font size="15.0" />
</font>
</Text>
</children>
</TextFlow>
<Label fx:id="lblCrew" layoutX="31.0" layoutY="346.0" text="Haupt-Crew" textFill="#ecebed" AnchorPane.leftAnchor="22.0" AnchorPane.topAnchor="280.0">
<font>
<Font size="20.0" />
</font></Label>
<HBox layoutX="22.0" layoutY="372.0" spacing="30.0" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="310.0" AnchorPane.topAnchor="310.0">
<children>
<VBox spacing="3.0">
<children>
<Label fx:id="lblDirectors" maxWidth="200.0" text="Rodney Rothman" textFill="#ecebed">
<font>
<Font name="System Bold" size="15.0" />
</font></Label>
<Label fx:id="lblDirectorsInfo" text="Directors" textFill="#ecebed">
<font>
<Font size="14.0" />
</font></Label>
</children>
</VBox>
<VBox spacing="3.0">
<children>
<Label fx:id="lblWriters" maxWidth="300.0" text="Michael Dante DiMartino, Bryan Konietzko" textFill="#ecebed">
<font>
<Font name="System Bold" size="15.0" />
</font>
</Label>
<Label fx:id="lblWritersInfo" text="Writers" textFill="#ecebed">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
</VBox>
<VBox spacing="3.0">
<children>
<Label fx:id="lblActors" maxWidth="300.0" text="Dee Bradley Baker, Zach Tyler, Jack De Sena, Mae Whitman" textFill="#ecebed">
<font>
<Font name="System Bold" size="15.0" />
</font>
</Label>
<Label fx:id="lblActorsInfo" text="Actors" textFill="#ecebed">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
</VBox>
</children>
</HBox>
<ChoiceBox layoutX="22.0" layoutY="523.0" prefHeight="25.0" prefWidth="168.0" AnchorPane.leftAnchor="22.0" AnchorPane.topAnchor="523.0" />
<ScrollPane layoutX="22.0" layoutY="398.0" prefHeight="145.0" prefWidth="798.0" style="-fx-background: transparent;" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="310.0" AnchorPane.topAnchor="370.0">
<content>
<HBox spacing="10.0">
<children>
<VBox>
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/2QjWeU6mfvx6sWF2z9CLb4kdRnR.jpg" />
</image>
</ImageView>
<Label text="Label" />
</children>
</VBox>
<VBox>
<children>
<ImageView fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/2QjWeU6mfvx6sWF2z9CLb4kdRnR.jpg" />
</image>
</ImageView>
<Label text="Label" />
</children>
</VBox>
<VBox>
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/2QjWeU6mfvx6sWF2z9CLb4kdRnR.jpg" />
</image>
</ImageView>
<Label text="Label" />
</children>
</VBox>
<VBox>
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/2QjWeU6mfvx6sWF2z9CLb4kdRnR.jpg" />
</image>
</ImageView>
<Label text="Label" />
</children>
</VBox>
<VBox>
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/2QjWeU6mfvx6sWF2z9CLb4kdRnR.jpg" />
</image>
</ImageView>
<Label text="Label" />
</children>
</VBox>
</children>
</HBox>
</content>
</ScrollPane>
<JFXButton fx:id="btnHide" contentDisplay="GRAPHIC_ONLY" layoutX="532.0" layoutY="520.0" maxHeight="-Infinity" minWidth="-Infinity" onAction="#btnHideAction" prefHeight="32.0" style="-fx-background-color: transparent;" text="Hide" AnchorPane.bottomAnchor="16.0" AnchorPane.leftAnchor="532.0" AnchorPane.rightAnchor="532.0">
<graphic>
<ImageView pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_keyboard_arrow_down_white_48dp_48x16.png" />
</image>
</ImageView>
</graphic>
</JFXButton>
<ImageView fx:id="imgPoster" fitHeight="400.0" fitWidth="267.0" layoutX="849.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.rightAnchor="22.0" AnchorPane.topAnchor="22.0">
<image>
<Image url="@../icons/Homeflix_Poster.png" />
</image>
</ImageView>
<JFXButton fx:id="btnPlay" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" layoutX="841.0" layoutY="448.0" maxHeight="-Infinity" onAction="#btnPlayAction" prefHeight="32.0" prefWidth="267.0" style="-fx-background-color: #ffffff;" text="Play" AnchorPane.rightAnchor="22.0" AnchorPane.topAnchor="448.0">
<graphic>
<ImageView fitHeight="24.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_play_arrow_black_48dp.png" />
</image>
</ImageView>
</graphic></JFXButton>
<JFXButton fx:id="btnDirectory" buttonType="RAISED" contentDisplay="GRAPHIC_ONLY" layoutX="841.0" layoutY="506.0" maxHeight="-Infinity" onAction="#btnDirectoryAction" prefHeight="32.0" prefWidth="267.0" style="-fx-background-color: #ffffff;" text="open Directory" AnchorPane.rightAnchor="22.0" AnchorPane.topAnchor="506.0">
<graphic>
<ImageView fitHeight="24.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/baseline_folder_black_48dp.png" />
</image>
</ImageView>
</graphic>
</JFXButton>
</children>
</AnchorPane>

BIN
src/main/resources/icons/2QjWeU6mfvx6sWF2z9CLb4kdRnR.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
src/main/resources/icons/baseline_keyboard_arrow_down_white_48dp_48x16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

BIN
src/main/resources/icons/spider-man.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close