cleaned up look and progress on music selection page

This commit is contained in:
Harrison Deng 2018-01-15 17:07:01 -06:00
parent 9880c0ed7a
commit 2c9fd2ecfd
2 changed files with 5 additions and 19 deletions

View File

@ -4,7 +4,6 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
@ -18,8 +17,6 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
private Table table;
private ShortenedTextLabel displayName;
private Label durationLabel;
private ShortenedTextLabel authorLabel;
private boolean selected;
@ -40,12 +37,6 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
displayName = new ShortenedTextLabel(musicFile.nameWithoutExtension().replace('_', ' '), skin, "sub-font", skin.getColor("default"));
table.add(displayName);
durationLabel = new Label("Loading...", skin, "sub-font", skin.getColor("default"));
table.add(durationLabel);
authorLabel = new ShortenedTextLabel("Loading...", skin, "sub-font", skin.getColor("default"));
table.add(authorLabel);
table.pack();
addActor(table);
addListener(new ClickListener() {
@ -66,22 +57,13 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
Gdx.app.debug("MusicSelectable", "Updating info for: " + getName());
this.musicInfo = musicInfo;
displayName.setOriginalText(musicInfo.getMusicName());
durationLabel.setText("Runtime: "
+ ((musicInfo.getDurationInSeconds() / 60 < 1) ? "00" : musicInfo.getDurationInSeconds() / 60) + ":"
+ ((musicInfo.getDurationInSeconds() - (musicInfo.getDurationInSeconds() / 60) * 60) < 10
? "0" + (musicInfo.getDurationInSeconds() - (musicInfo.getDurationInSeconds() / 60) * 60)
: (musicInfo.getDurationInSeconds() - (musicInfo.getDurationInSeconds() / 60) * 60)));
authorLabel.setOriginalText("Author: " + musicInfo.getAuthor());
authorLabel.setToOriginalText();
}
@Override
public void layout() {
displayName.setTargetWidth((int) (getWidth()*0.43f));
authorLabel.setTargetWidth((int) (getWidth()/3f));
displayName.setTargetWidth((int) (getWidth()*0.8f));
displayName.resize();
authorLabel.resize();
super.layout();
}

View File

@ -93,6 +93,10 @@ public class AnalysisPage extends Page {
speedModifierSlider.setDisabled(false);
healthModifierSlider.setDisabled(false);
difficultyModifierSlider.setDisabled(false);
if (aa != null) {
aa.dispose();
}
aa = new AudioAnalyzer(mm);
aa.start();
}