From a97f435a5211f333877643ed690795cf3dec6c2e Mon Sep 17 00:00:00 2001 From: Recrown Date: Thu, 27 Apr 2017 00:35:29 -0500 Subject: [PATCH] minor work on ui for music selection page --- core/src/zero1hd/polyjet/Polyjet.java | 6 +++ .../polyjet/ui/builders/MusicSelectable.java | 37 +++++++++---------- .../polyjet/ui/pages/MusicSelectionPage.java | 5 +-- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index 5449cc3..7926732 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -132,6 +132,12 @@ public class Polyjet extends Game { } })); + defaultSkin.add("sub-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { + { + size = fontScale(0.04f); + } + })); + defaultSkin.add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { { size = fontScale(0.06f); diff --git a/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java index dcaecd8..7ba9e25 100755 --- a/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java +++ b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java @@ -72,6 +72,22 @@ public class MusicSelectable extends Button implements Disposable { } public void addInfoToPanel(float width) { + displayName = new Label(songName, skin); + displayName.setWrap(true); + add(displayName).prefWidth(width-5).spaceBottom(20f); + + row(); + + String formattedTime = "Run time: "+ String.valueOf(durationInSeconds/60) + ":"; + if (durationInSeconds - (durationInSeconds/60)*60 < 10) { + formattedTime = formattedTime.concat("0"); + } + formattedTime = formattedTime.concat(String.valueOf(durationInSeconds - (durationInSeconds/60)*60)); + runTime = new Label(formattedTime, skin, "sub-font", skin.getColor("default")); + add(runTime); + + row(); + if (albumWorkBytes != null && !invalidMusic) { Pixmap albumArt = new Pixmap(albumWorkBytes, 0, albumWorkBytes.length); albumCover = new Texture(albumArt); @@ -84,27 +100,8 @@ public class MusicSelectable extends Button implements Disposable { } Gdx.app.debug("UI", "album cover invalid or null for image: " + songName); } - add(imageIcon).prefSize(width, width).spaceBottom(20f); + add(imageIcon).prefSize(width, width); - - row(); - - displayName = new Label(songName, skin); - displayName.setWrap(true); - add(displayName).prefWidth(width-5).center(); - - - row(); - - String formattedSecond = String.valueOf(durationInSeconds/60) + ":"; - - if (durationInSeconds - (durationInSeconds/60)*60 < 10) { - formattedSecond = formattedSecond.concat("0"); - } - - formattedSecond = formattedSecond.concat(String.valueOf(durationInSeconds - (durationInSeconds/60)*60)); - runTime = new Label(formattedSecond, skin); - add(runTime); } public int getPreviousTop() { diff --git a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java index da11b39..dbd2133 100755 --- a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java @@ -78,14 +78,13 @@ public class MusicSelectionPage extends Page { return false; } }); - int startingID = 0; - for (int music = startingID; music < musicFiles.length && music < 15; music++) { + for (int music = 0; music < musicFiles.length; music++) { final MusicSelectable selectable = new MusicSelectable(musicFiles[music], musicFileAnnotation, core.defaultSkin, core.assetManager.get("defaultCover.png", Texture.class)); Gdx.app.postRunnable(new Runnable() { @Override public void run() { - selectable.addInfoToPanel(0.2f*getWidth()-10); + selectable.addInfoToPanel(0.2f*getWidth()-20); musicChoices.add(selectable).prefSize(0.2f*getWidth(), 0.8f*getHeight()); } });