Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

Commit

Permalink
Album UI
Browse files Browse the repository at this point in the history
Added:
Album UI First UI parts for the album scroll lists
  • Loading branch information
GilgusMaximus committed Apr 16, 2019
1 parent bdf7202 commit 21e2c7d
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 17 deletions.
32 changes: 19 additions & 13 deletions src/ControllerClasses/MusicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ public void loop() {
System.out.println("'Loop' pressed - Current Status: " + loopStatus);
}


public void seekToSecond(){
currentSongmediaPlayer.seek(Duration.seconds(uiController.getSliderValue()));
System.out.println("SLDIERVALUE: " + uiController.getSliderValue() + " SEEEK: " + currentSongmediaPlayer.getCurrentTime().toSeconds());
}

//------------------------------------------------------------------------------------
// Often reused methods
//------------------------------------------------------------------------------------
Expand Down Expand Up @@ -422,30 +428,30 @@ protected Void call() throws Exception {
//is the media player playing?
while (currentSongmediaPlayer.getStatus() == Status.PLAYING) {
//yes-> does the slider have the same value as the time variable?
/*if(uiController.getSliderValue() != time) {
/*if(uiController.getSliderValue() != time) {
System.out.println("SLDIERVALUE: " + uiController.getSliderValue() + " SEEEK: " + currentSongmediaPlayer.getCurrentTime().toSeconds());
//no -> set the time value to the slider value (this means, the user has moved the slider to a different position)
time = uiController.getSliderValue();
currentSongmediaPlayer.seek(Duration.seconds(time));
currentSongmediaPlayer.seek(Duration.seconds(uiController.getSliderValue()));
System.out.println("SLDIERVALUE: " + uiController.getSliderValue() + " SEEEK: " + currentSongmediaPlayer.getCurrentTime().toSeconds());
//currentSongmediaPlayer.seek(Duration.seconds(time)); //adjust the playback time of the media player
}else {
//no -> update the time and sldier value to the current playback time
uiController.setSliderPosition((int)currentSongmediaPlayer.getCurrentTime().toSeconds());
time = (int)currentSongmediaPlayer.getCurrentTime().toSeconds();
uiController.setSliderPosition(time);
}*/
//System.out.println(currentSongmediaPlayer.get().toSeconds() + " time ");

if(uiController.getDragged()) {
time = uiController.getSliderValue();
currentSongmediaPlayer.seek(Duration.seconds(time));
System.out.println("SLDIERVALUE: " + uiController.getSliderValue() + " SEEEK: " + currentSongmediaPlayer.getCurrentTime().toMillis());
currentSongmediaPlayer.seek(Duration.seconds(uiController.getSliderValue()));
//System.out.println("SLDIERVALUE: " + uiController.getSliderValue() + " SEEEK: " + currentSongmediaPlayer.currentTimeProperty().toString());
uiController.setTimeLineDraggedFalse();
//uiController.setSliderPosition((int) currentSongmediaPlayer.getCurrentTime().toSeconds());
}else {
time = (int)currentSongmediaPlayer.getCurrentTime().toSeconds();
if(time > 10 && a) {
a = false;
currentSongmediaPlayer.seek(Duration.seconds(30));
time = (int) currentSongmediaPlayer.getCurrentTime().toSeconds();
}
uiController.setSliderPosition(time);
uiController.setSliderPosition((int)currentSongmediaPlayer.getCurrentTime().toSeconds());

//System.out.println("SLDIERVALUE: " + uiController.getSliderValue() + " SEEEK: " + currentSongmediaPlayer.getCurrentTime().toSeconds());
//System.out.println("SLDIERVALUE: " + uiController.getSliderValue() + " SEEEK: " + currentSongmediaPlayer.currentTimeProperty().toString());
}
sleep(100); //sleep for one second
}
Expand Down
78 changes: 74 additions & 4 deletions src/ControllerClasses/ui.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,84 @@
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<Group xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxml.Controller">
<children>
<AnchorPane maxHeight="-Infinity" maxWidth="640.0" minHeight="-Infinity" minWidth="-Infinity" prefHeight="420.0" prefWidth="640.0" style="-fx-background-color: #232323;">
<children>
<AnchorPane fx:id="scrollable_album" layoutX="110.0" onScroll="#scrollSongs" prefHeight="300.0" prefWidth="489.0" style="-fx-background-color: 1 1 1 1;" visible="false">
<children>
<VBox prefHeight="200.0" prefWidth="160.0">
<children>
<ImageView fx:id="album1Image" fitHeight="160.0" fitWidth="160.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../fxml/pictures/standardcover.png" />
</image>
</ImageView>
<Label fx:id="album1AlbumName" alignment="CENTER" prefHeight="17.0" prefWidth="160.0" text="Albumname" textFill="WHITE" />
<Label fx:id="album1ArtistName" alignment="CENTER" layoutX="10.0" layoutY="173.0" prefHeight="17.0" prefWidth="160.0" text="Artistname" textFill="WHITE" />
</children>
</VBox>
<VBox layoutX="163.0" prefHeight="200.0" prefWidth="160.0">
<children>
<ImageView fx:id="album2Image" fitHeight="160.0" fitWidth="160.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../fxml/pictures/standardcover.png" />
</image>
</ImageView>
<Label fx:id="album2AlbumName" alignment="CENTER" prefHeight="17.0" prefWidth="160.0" text="Albumname" textFill="WHITE" />
<Label fx:id="album2ArtistName" alignment="CENTER" layoutX="10.0" layoutY="173.0" prefHeight="17.0" prefWidth="160.0" text="Artistname" textFill="WHITE" />
</children>
</VBox>
<VBox layoutX="326.0" prefHeight="200.0" prefWidth="160.0">
<children>
<ImageView fx:id="album3Image" fitHeight="160.0" fitWidth="160.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../fxml/pictures/standardcover.png" />
</image>
</ImageView>
<Label fx:id="album3AlbumName" alignment="CENTER" prefHeight="17.0" prefWidth="160.0" text="Album name" textAlignment="CENTER" textFill="WHITE" />
<Label fx:id="album3ArtistName" alignment="CENTER" layoutX="10.0" layoutY="173.0" prefHeight="17.0" prefWidth="160.0" text="Artistname" textFill="WHITE" />
</children>
</VBox>
<VBox layoutY="200.0" prefHeight="200.0" prefWidth="160.0">
<children>
<ImageView fx:id="album1Image1" fitHeight="160.0" fitWidth="160.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../fxml/pictures/standardcover.png" />
</image>
</ImageView>
<Label fx:id="album1AlbumName1" alignment="CENTER" prefHeight="17.0" prefWidth="160.0" text="Albumname" textFill="WHITE" />
<Label fx:id="album1ArtistName1" alignment="CENTER" layoutX="10.0" layoutY="173.0" prefHeight="17.0" prefWidth="160.0" text="Artistname" textFill="WHITE" />
</children>
</VBox>
<VBox layoutX="163.0" layoutY="200.0" prefHeight="200.0" prefWidth="160.0">
<children>
<ImageView fx:id="album2Image1" fitHeight="160.0" fitWidth="160.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../fxml/pictures/standardcover.png" />
</image>
</ImageView>
<Label fx:id="album2AlbumName1" alignment="CENTER" prefHeight="17.0" prefWidth="160.0" text="Albumname" textFill="WHITE" />
<Label fx:id="album2ArtistName1" alignment="CENTER" layoutX="10.0" layoutY="173.0" prefHeight="17.0" prefWidth="160.0" text="Artistname" textFill="WHITE" />
</children>
</VBox>
<VBox layoutX="326.0" layoutY="200.0" prefHeight="200.0" prefWidth="160.0">
<children>
<ImageView fx:id="album3Image1" fitHeight="160.0" fitWidth="160.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../fxml/pictures/standardcover.png" />
</image>
</ImageView>
<Label fx:id="album3AlbumName1" alignment="CENTER" prefHeight="17.0" prefWidth="160.0" text="Album name" textAlignment="CENTER" textFill="WHITE" />
<Label fx:id="album3ArtistName1" alignment="CENTER" layoutX="10.0" layoutY="173.0" prefHeight="17.0" prefWidth="160.0" text="Artistname" textFill="WHITE" />
</children>
</VBox>
</children>
</AnchorPane>
<AnchorPane fx:id="scrollable" layoutX="100.0" layoutY="60.0" onScroll="#scrollSongs" prefHeight="300.0" prefWidth="489.0">
<children>
<AnchorPane fx:id="button3" layoutY="100.0" prefHeight="50.0" prefWidth="490.0">
Expand Down Expand Up @@ -223,7 +294,7 @@
</ImageView>
<Slider fx:id="musicTimeLine" blockIncrement="1.0" layoutX="312.0" layoutY="3.0" majorTickUnit="1.0" minHeight="-Infinity" minWidth="-Infinity" minorTickCount="1" onMouseDragged="#timelineDragged" prefHeight="8.0" prefWidth="250.0" snapToTicks="true" style="-: #000000;" />
<Label fx:id="timeDisplay" disable="true" layoutX="570.0" text="2.34 / 2.55" textFill="WHITE" visible="false" />
<TextField fx:id="displayTimeText" layoutX="560.0" layoutY="-5.0" prefHeight="25.0" prefWidth="77.0" promptText="2.00 / 2.55" style="-fx-background-color: #232323;-fx-text-fill: white;" />
<TextField fx:id="displayTimeText" layoutX="560.0" layoutY="-5.0" prefHeight="25.0" prefWidth="77.0" promptText="2.00 / 2.55" style="-fx-background-color: 0 0 0 0; -fx-text-fill: white;" />
</children>
</AnchorPane>
<AnchorPane fx:id="leftbar" layoutY="60.0" minHeight="300.0" minWidth="50.0" prefHeight="300.0" prefWidth="100.0" style="-fx-background-color: #232323;">
Expand All @@ -249,11 +320,11 @@
</font>
</Button>
</children></AnchorPane>
<AnchorPane fx:id="rightbar" layoutX="590.0" layoutY="60.0" minHeight="300.0" minWidth="50.0" prefHeight="300.0" prefWidth="50.0" style="-fx-background-color: #232323 ;">
<AnchorPane fx:id="rightbar" layoutX="590.0" layoutY="60.0" minHeight="300.0" minWidth="50.0" prefHeight="300.0" prefWidth="50.0" style="-fx-background-color: 0 0 0 0;">
<children>
<Slider fx:id="scrollSlider" blockIncrement="1.0" layoutX="18.0" layoutY="2.0" onMouseDragged="#mouseDrag" orientation="VERTICAL" prefHeight="294.0" prefWidth="14.0" rotate="180.0" />
</children></AnchorPane>
<AnchorPane minHeight="60.0" minWidth="640.0" prefHeight="60.0" prefWidth="640.0" style="-fx-background-color: #232323;">
<AnchorPane fx:id="topbar" minHeight="60.0" minWidth="640.0" prefHeight="60.0" prefWidth="640.0" style="-fx-background-color: #232323;" visible="false">
<children>
<Text fill="#00e5ff" fontSmoothingType="LCD" layoutX="194.0" layoutY="53.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Title">
<font>
Expand All @@ -273,6 +344,5 @@
</children></AnchorPane>
</children>
</AnchorPane>
<Label text="Label" />
</children>
</Group>
1 change: 1 addition & 0 deletions src/fxml/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected void loop() {

public void timelineDragged(){
dragged = true;
manager.seekToSecond();
}

public void setTimeLineDraggedFalse(){
Expand Down

0 comments on commit 21e2c7d

Please sign in to comment.