added detailed display on screen (untested)
This commit is contained in:
parent
b857ffe4bd
commit
a39f3a25ac
@ -10,6 +10,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
@ -89,8 +90,12 @@ public class MusicSelectable extends Button {
|
|||||||
|
|
||||||
public void loadAlbumCover() {
|
public void loadAlbumCover() {
|
||||||
metadata.loadAlbumCover();
|
metadata.loadAlbumCover();
|
||||||
|
Texture texture = defaultAlbumArt;
|
||||||
|
if (metadata.getAlbumCover() != null) {
|
||||||
|
texture = metadata.getAlbumCover();
|
||||||
|
}
|
||||||
synchronized (album) {
|
synchronized (album) {
|
||||||
album.setDrawable(new TextureRegionDrawable(new TextureRegion(metadata.getAlbumCover())));
|
album.setDrawable(new TextureRegionDrawable(new TextureRegion(texture)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import com.badlogic.gdx.assets.AssetManager;
|
|||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
||||||
@ -21,6 +22,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.Stack;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.MusicMetadataController;
|
import zero1hd.rhythmbullet.audio.MusicMetadataController;
|
||||||
@ -38,9 +41,9 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
private MusicSelectableButtonGroup selectables;
|
private MusicSelectableButtonGroup selectables;
|
||||||
private Stack stackSelectables;
|
private Stack stackSelectables;
|
||||||
private TextButton back;
|
private TextButton back;
|
||||||
private Table musicTable;
|
|
||||||
private ScrollPane musicTableScrollPane;
|
private ScrollPane musicTableScrollPane;
|
||||||
|
|
||||||
|
private ClickListener selectionListener;
|
||||||
private musicSelectionLoaderThread thread;
|
private musicSelectionLoaderThread thread;
|
||||||
|
|
||||||
private Table musicInfoTable;
|
private Table musicInfoTable;
|
||||||
@ -71,9 +74,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
selectables = new MusicSelectableButtonGroup();
|
selectables = new MusicSelectableButtonGroup();
|
||||||
musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation");
|
musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation");
|
||||||
|
|
||||||
musicTable = new Table();
|
musicTableScrollPane = new ScrollPane(stackSelectables, skin);
|
||||||
musicTableScrollPane = new ScrollPane(musicTable, skin);
|
|
||||||
musicTable.defaults().spaceTop(5f).spaceBottom(5f);
|
|
||||||
musicTableScrollPane.setSize(0.45f*getWidth(), getHeight());
|
musicTableScrollPane.setSize(0.45f*getWidth(), getHeight());
|
||||||
musicTableScrollPane.setFadeScrollBars(false);
|
musicTableScrollPane.setFadeScrollBars(false);
|
||||||
musicTableScrollPane.setOverscroll(false, false);
|
musicTableScrollPane.setOverscroll(false, false);
|
||||||
@ -133,6 +134,31 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
mmc.addObserver(this);
|
mmc.addObserver(this);
|
||||||
|
|
||||||
thread = new musicSelectionLoaderThread();
|
thread = new musicSelectionLoaderThread();
|
||||||
|
|
||||||
|
selectionListener = new ClickListener() {
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
MusicSelectable selectable = (MusicSelectable) event.getListenerActor();
|
||||||
|
if (selectable.getMetadata().getTitle() != null) {
|
||||||
|
songTitle.setText(selectable.getMetadata().getTitle(), null);
|
||||||
|
} else {
|
||||||
|
songTitle.setText(selectable.getFileHandle().nameWithoutExtension(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
author.setText(selectable.getMetadata().getAuthor());
|
||||||
|
|
||||||
|
songLength.setText(selectable.getMetadata().getDuration());
|
||||||
|
|
||||||
|
previousTop.setText("...");
|
||||||
|
|
||||||
|
ratedDifficulty.setText("...");
|
||||||
|
|
||||||
|
if (selectable.getMetadata().getAlbumCover() != null) {
|
||||||
|
albumCover.setDrawable(new TextureRegionDrawable(new TextureRegion(selectable.getMetadata().getAlbumCover())));
|
||||||
|
} else {
|
||||||
|
albumCover.setDrawable(new TextureRegionDrawable(new TextureRegion(assets.get("defaultCover.png", Texture.class))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -206,7 +232,6 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
selectables.clear();
|
selectables.clear();
|
||||||
|
|
||||||
mmc.loadAudioMetadata();
|
mmc.loadAudioMetadata();
|
||||||
musicTable.clear();
|
|
||||||
selectables.clear();
|
selectables.clear();
|
||||||
musicInfoTable.clear();
|
musicInfoTable.clear();
|
||||||
musicSubInfo.clear();
|
musicSubInfo.clear();
|
||||||
@ -216,16 +241,21 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
songTitle.setText("loading...", null);
|
songTitle.setText("loading...", null);
|
||||||
musicInfoTable.add(songTitle).width(musicInfoTable.getWidth()*0.6f).spaceBottom(30f);
|
musicInfoTable.add(songTitle).width(musicInfoTable.getWidth()*0.6f).spaceBottom(30f);
|
||||||
musicInfoTable.row();
|
musicInfoTable.row();
|
||||||
|
author.setText("...");
|
||||||
musicSubInfo.add(author);
|
musicSubInfo.add(author);
|
||||||
musicSubInfo.row();
|
musicSubInfo.row();
|
||||||
|
songLength.setText("...");
|
||||||
musicSubInfo.add(songLength);
|
musicSubInfo.add(songLength);
|
||||||
musicSubInfo.row();
|
musicSubInfo.row();
|
||||||
|
previousTop.setText("...");
|
||||||
musicSubInfo.add(previousTop);
|
musicSubInfo.add(previousTop);
|
||||||
musicSubInfo.row();
|
musicSubInfo.row();
|
||||||
|
ratedDifficulty.setText("...");
|
||||||
musicSubInfo.add(ratedDifficulty);
|
musicSubInfo.add(ratedDifficulty);
|
||||||
musicSubInfo.pack();
|
musicSubInfo.pack();
|
||||||
musicInfoTable.add(musicSubInfo).spaceBottom(20f);
|
musicInfoTable.add(musicSubInfo).spaceBottom(20f);
|
||||||
musicInfoTable.row();
|
musicInfoTable.row();
|
||||||
|
albumCover.setDrawable(new TextureRegionDrawable(new TextureRegion(assets.get("defaultCover.png", Texture.class))));
|
||||||
musicInfoTable.add(albumCover).size(musicInfoTable.getWidth()/2f);
|
musicInfoTable.add(albumCover).size(musicInfoTable.getWidth()/2f);
|
||||||
musicInfoTable.row();
|
musicInfoTable.row();
|
||||||
musicInfoTable.add(beginButton).spaceTop(20f).fillX();
|
musicInfoTable.add(beginButton).spaceTop(20f).fillX();
|
||||||
@ -268,6 +298,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
while (work) {
|
while (work) {
|
||||||
while (selectables.getButtons().size != mc.getMusicList().getTotal()) {
|
while (selectables.getButtons().size != mc.getMusicList().getTotal()) {
|
||||||
MusicSelectable selectable = new MusicSelectable(skin, assets.get("defaultCover.png"), mmc.getMetadata(selectables.getButtons().size), queueList);
|
MusicSelectable selectable = new MusicSelectable(skin, assets.get("defaultCover.png"), mmc.getMetadata(selectables.getButtons().size), queueList);
|
||||||
|
selectable.addListener(selectionListener);
|
||||||
selectables.add(selectable);
|
selectables.add(selectable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user