minor work on ui for music selection page
This commit is contained in:
parent
dd729cffd7
commit
a97f435a52
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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());
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user