diff --git a/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java b/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java index 0ae8de45f92ab9a27cbeb1c642ad083763efbc9d..b390fa0876fe36e39cbbb05236b0799586ad666b 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java +++ b/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java @@ -38,6 +38,7 @@ public class TouchPadView implements IPadView { private Label indexLabel; private Label loopLabel; private Label triggerLabel; + private Label playlistLabel; private Label errorLabel; private HBox infoBox; @@ -77,6 +78,7 @@ public class TouchPadView implements IPadView { loopLabel = new PadLabel(new FontIcon(FontAwesomeType.REPEAT)); triggerLabel = new PadLabel(new FontIcon(FontAwesomeType.EXTERNAL_LINK)); + playlistLabel = PadLabel.empty(STYLE_CLASS_PAD_INFO, STYLE_CLASS_PAD_INFO_INDEX); errorLabel = new PadLabel(new FontIcon(FontAwesomeType.WARNING)); infoBox = new PadHBox(5); @@ -212,7 +214,7 @@ public class TouchPadView implements IPadView { @Override public void addDefaultElements(Pad pad) { - infoBox.getChildren().setAll(indexLabel, loopLabel, triggerLabel, errorLabel, timeLabel); + infoBox.getChildren().setAll(indexLabel, loopLabel, triggerLabel, playlistLabel, errorLabel, timeLabel); // alle Labels in der InfoBox sollen die gleiche Höhe haben, damit die Icons auf gleicher höhe sind for (Node child : infoBox.getChildren()) { @@ -258,6 +260,18 @@ public class TouchPadView implements IPadView { setContentView(null); } + void clearPlaylistLabel() { + playlistLabel.setText(""); + } + + void setPlaylistIndex(int current, int count) { + if (current < 0) { + playlistLabel.setText("- / " + count); + } else { + playlistLabel.setText((current + 1) + " / " + count); + } + } + @Override public void setPlaybarVisible(boolean visible) { playBar.setVisible(visible); diff --git a/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadViewController.java b/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadViewController.java index 09d18bdce49686ed13750c119f0455296eaa42d9..25e198f8a982cdb5e6001270384e70e7dbad7f16 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadViewController.java +++ b/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadViewController.java @@ -4,6 +4,7 @@ import de.thecodelabs.logger.Logger; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.TimeMode; +import de.tobias.playpad.pad.content.Playlistable; import de.tobias.playpad.pad.content.play.Durationable; import de.tobias.playpad.pad.listener.*; import de.tobias.playpad.pad.view.IPadView; @@ -97,6 +98,7 @@ public class TouchPadViewController implements IPadViewController, EventHandler< padView.clearIndex(); padView.clearPreviewContent(); padView.clearTime(); + padView.clearPlaylistLabel(); padView.setTriggerLabelActive(false); @@ -211,7 +213,11 @@ public class TouchPadViewController implements IPadViewController, EventHandler< @Override public void updatePlaylistLabel() { - // TODO + if (pad.getContent() instanceof Playlistable) { + padView.setPlaylistIndex(((Playlistable) pad.getContent()).currentPlayingMediaIndex(), pad.getPaths().size()); + } else { + padView.clearPlaylistLabel(); + } } @Override