mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
kleine ui fix
This commit is contained in:
@@ -18,6 +18,7 @@ public class SongDisplay extends VBox {
|
|||||||
private final Text songTitle;
|
private final Text songTitle;
|
||||||
private final ProgressBar progressBar;
|
private final ProgressBar progressBar;
|
||||||
private final Text progressText;
|
private final Text progressText;
|
||||||
|
private boolean paused = false;
|
||||||
|
|
||||||
public SongDisplay() {
|
public SongDisplay() {
|
||||||
new EventFlow()
|
new EventFlow()
|
||||||
@@ -26,7 +27,6 @@ public class SongDisplay extends VBox {
|
|||||||
setAlignment(Pos.CENTER);
|
setAlignment(Pos.CENTER);
|
||||||
getStyleClass().add("song-display");
|
getStyleClass().add("song-display");
|
||||||
|
|
||||||
// TODO ADD GOOD SONG TITLES WITH ARTISTS DISPLAYED
|
|
||||||
songTitle = new Text("song playing");
|
songTitle = new Text("song playing");
|
||||||
songTitle.getStyleClass().add("song-title");
|
songTitle.getStyleClass().add("song-title");
|
||||||
|
|
||||||
@@ -36,8 +36,6 @@ public class SongDisplay extends VBox {
|
|||||||
progressText = new Text("0:00/0:00");
|
progressText = new Text("0:00/0:00");
|
||||||
progressText.getStyleClass().add("progress-text");
|
progressText.getStyleClass().add("progress-text");
|
||||||
|
|
||||||
// TODO ADD BETTER CSS FOR THE SKIPBUTTON WHERE ITS AT A NICER POSITION
|
|
||||||
|
|
||||||
Button skipButton = new Button(">>");
|
Button skipButton = new Button(">>");
|
||||||
Button pauseButton = new Button("⏸");
|
Button pauseButton = new Button("⏸");
|
||||||
Button previousButton = new Button("<<");
|
Button previousButton = new Button("<<");
|
||||||
@@ -48,20 +46,20 @@ public class SongDisplay extends VBox {
|
|||||||
|
|
||||||
skipButton.setOnAction( event -> {
|
skipButton.setOnAction( event -> {
|
||||||
GlobalEventBus.post(new AudioEvents.SkipMusic());
|
GlobalEventBus.post(new AudioEvents.SkipMusic());
|
||||||
|
paused = false;
|
||||||
|
pauseButton.setText(getPlayString(paused));
|
||||||
});
|
});
|
||||||
|
|
||||||
pauseButton.setOnAction(event -> {
|
pauseButton.setOnAction(event -> {
|
||||||
GlobalEventBus.post(new AudioEvents.PauseMusic());
|
GlobalEventBus.post(new AudioEvents.PauseMusic());
|
||||||
if (pauseButton.getText().equals("⏸")) {
|
paused = !paused;
|
||||||
pauseButton.setText("▶");
|
pauseButton.setText(getPlayString(paused));
|
||||||
}
|
|
||||||
else if (pauseButton.getText().equals("▶")) {
|
|
||||||
pauseButton.setText("⏸");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
previousButton.setOnAction( event -> {
|
previousButton.setOnAction( event -> {
|
||||||
GlobalEventBus.post(new AudioEvents.PreviousMusic());
|
GlobalEventBus.post(new AudioEvents.PreviousMusic());
|
||||||
|
paused = false;
|
||||||
|
pauseButton.setText(getPlayString(paused));
|
||||||
});
|
});
|
||||||
|
|
||||||
HBox control = new HBox(10, previousButton, pauseButton, skipButton);
|
HBox control = new HBox(10, previousButton, pauseButton, skipButton);
|
||||||
@@ -107,6 +105,15 @@ public class SongDisplay extends VBox {
|
|||||||
String time = positionMinutes + ":" + positionSecondsStr + " / " + durationMinutes + ":" + durationSecondsStr;
|
String time = positionMinutes + ":" + positionSecondsStr + " / " + durationMinutes + ":" + durationSecondsStr;
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getPlayString(boolean paused) {
|
||||||
|
if (paused) {
|
||||||
|
return "▶";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "⏸";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user