diff --git a/android/assets/gradients.png b/android/assets/gradients.png index fc05e37..2ed51fc 100755 Binary files a/android/assets/gradients.png and b/android/assets/gradients.png differ diff --git a/core/src/zero1hd/rhythmbullet/audio/SongList.java b/core/src/zero1hd/rhythmbullet/audio/SongList.java index 72cf0d4..bf92e83 100755 --- a/core/src/zero1hd/rhythmbullet/audio/SongList.java +++ b/core/src/zero1hd/rhythmbullet/audio/SongList.java @@ -34,7 +34,6 @@ public class SongList extends Observable { public void setSearchPath(String searchPath) { this.searchPath = searchPath; setChanged(); - notifyObservers(); } public MusicManager getAudioData(FileHandle file) { diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java index 5f2cf6c..15b5e9c 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java @@ -7,12 +7,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image; 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.Widget; +import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; import com.badlogic.gdx.utils.Disposable; import zero1hd.rhythmbullet.audio.SongInfo; -public class MusicSelectable extends Widget implements Disposable { +public class MusicSelectable extends WidgetGroup implements Disposable { private Table table; private Image imageIcon; @@ -30,7 +30,6 @@ public class MusicSelectable extends Widget implements Disposable { public MusicSelectable(FileHandle musicFile, Preferences musicAnnotation, Skin skin, Texture defaultAlbumC) { table = new Table(skin); table.setBackground("holo-pane"); - table.setFillParent(true); setName(musicFile.name()); @@ -39,10 +38,10 @@ public class MusicSelectable extends Widget implements Disposable { songInfo = new SongInfo(musicFile, musicAnnotation); imageIcon = new Image(albumCover); - table.add(imageIcon); + table.add(imageIcon).size(128f); - displayName = new ScrollText(musicFile.name(), null, skin, true, false); - table.add(displayName); + displayName = new ScrollText(musicFile.nameWithoutExtension().replace('_', ' '), null, skin, true, false); + table.add(displayName).expandX().fillX(); table.row(); @@ -50,8 +49,11 @@ public class MusicSelectable extends Widget implements Disposable { table.add(durationLabel); authorLabel = new Label("Loading...", skin, "sub-font", skin.getColor("default")); + table.add(authorLabel); table.defaults().pad(10f); + + addActor(table); } /** @@ -65,8 +67,16 @@ public class MusicSelectable extends Widget implements Disposable { ? "0" + (songInfo.getDurationInSeconds() - (songInfo.getDurationInSeconds() / 60) * 60) : (songInfo.getDurationInSeconds() - (songInfo.getDurationInSeconds() / 60) * 60))); authorLabel.setText("Author: " + songInfo.getAuthor()); + + albumCover = songInfo.getAlbumCover(); } - + + @Override + public void act(float delta) { + table.setSize(getWidth(), getHeight()); + super.act(delta); + } + public FileHandle getMusicFile() { return musicFile; } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java index 26cf674..7e71c64 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ScrollText.java @@ -102,7 +102,7 @@ public class ScrollText extends Widget { validate(); if (text1Width + text2Width > clipBounds.getWidth()) { if (scrollOnHover) { - if (scroll) { + if (scroll || text1Offset < 0 || text1Offset > 5) { scroll(delta); } } else { diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java index 31fecae..e742fa9 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java @@ -2,6 +2,8 @@ package zero1hd.rhythmbullet.graphics.ui.pages; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.logging.Level; +import java.util.logging.Logger; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; @@ -37,15 +39,16 @@ public class MusicSelectionPage extends Page { private AssetManager assets; public MusicSelectionPage(Skin skin, SongList songList, AssetManager assetManager, Vector3 cameraTarget) { super("Select music", skin); + this.skin = skin; this.songList = songList; musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation"); this.assets = assetManager; - songTable = new Table(skin); + songTable = new Table(); + songTable.defaults().spaceBottom(10f); scrollbar = new ScrollPane(songTable, skin); scrollbar.setSize(0.4f*getWidth(), getHeightBelowTitle()); addActor(scrollbar); selectables = new Array<>(); - this.skin = skin; back = new TextButton("Back", skin); back.setPosition(getWidth()-back.getWidth()-15f, getHeightBelowTitle()); back.addListener(new ChangeListener() { @@ -57,11 +60,12 @@ public class MusicSelectionPage extends Page { addActor(back); back.toFront(); - + refresh(); } @Override public void act(float delta) { + Gdx.gl.glLineWidth(2); super.act(delta); } @@ -74,14 +78,22 @@ public class MusicSelectionPage extends Page { } public void refresh() { + Logger.getLogger("org.jaudiotagger").setLevel(Level.OFF); + songTable.clear(); + selectables.clear(); + for (int i = 0; i < selectables.size; i++) { + selectables.get(i).dispose(); + } + Gdx.app.debug("MusicSelectionPage", "Refreshing..."); for (int i = 0; i < songList.getAmountOfSongs(); i++) { + MusicSelectable selectable = new MusicSelectable(songList.getSongFileHandleFromIndex(i), musicFileAnnotation, skin, assets.get("defaultCover.png", Texture.class)); selectables.add(selectable); - songTable.add(selectable); + + songTable.add(selectable).expandX().fillX().minHeight(200f); songTable.row(); } - songTable.pack(); ExecutorService exec = Executors.newSingleThreadExecutor(); exec.submit(() -> { @@ -93,7 +105,7 @@ public class MusicSelectionPage extends Page { info.updateInfo(); }); } - Gdx.app.debug("MusicSelectionPage", "Refresh complete."); + Gdx.app.debug("MusicSelectionPage", "Refresh complete. " + selectables.size + " songs loaded."); }); } } diff --git a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java index 9d081f1..e9da482 100755 --- a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java +++ b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java @@ -136,7 +136,6 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter, Observ mainPage.updateVisualsForDifferentSong(sc.getCurrentSong()); sc.getSongList().addObserver(this); - sc.getSongList().refresh(); Gdx.app.debug("Post Transition", "Beginning screen setup for Main menu."); }