diff --git a/android/assets/uiskin.atlas b/android/assets/uiskin.atlas index 2c4d8d5..83ea035 100755 --- a/android/assets/uiskin.atlas +++ b/android/assets/uiskin.atlas @@ -99,6 +99,14 @@ default-round-down orig: 12, 20 offset: 0, 0 index: -1 +default-round-disabled + rotate: false + xy: 89, 8 + size: 12, 20 + split: 5, 5, 5, 5 + orig: 12, 20 + offset: 0, 0 + index: -1 default-scroll rotate: false xy: 57, 29 diff --git a/android/assets/uiskin.png b/android/assets/uiskin.png old mode 100644 new mode 100755 index 9c33578..39ce6b8 Binary files a/android/assets/uiskin.png and b/android/assets/uiskin.png differ diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index fefc2c8..5449cc3 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -161,11 +161,12 @@ public class Polyjet extends Game { defaultTextButton.down = defaultSkin.getDrawable("default-round-down"); defaultTextButton.font = defaultSkin.getFont("default-font"); defaultTextButton.fontColor = defaultSkin.getColor("default"); + defaultTextButton.disabled = defaultSkin.getDrawable("default-round-disabled"); defaultSkin.add("default", defaultTextButton); - TextButtonStyle smallTextButton = new TextButtonStyle(defaultTextButton); - smallTextButton.font = defaultSkin.getFont("small-font"); - defaultSkin.add("small", smallTextButton); +// TextButtonStyle smallTextButton = new TextButtonStyle(defaultTextButton); +// smallTextButton.font = defaultSkin.getFont("small-font"); +// defaultSkin.add("small", smallTextButton); TextButtonStyle textButtonLeft = new TextButtonStyle(); textButtonLeft.up = defaultSkin.getDrawable("left-button"); diff --git a/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java index 499c188..c7cf5dc 100755 --- a/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java +++ b/core/src/zero1hd/polyjet/ui/builders/MusicSelectable.java @@ -28,12 +28,14 @@ public class MusicSelectable extends Button implements Disposable { WavInfo wavinfo; private byte[] albumWorkBytes; - private Image imageIcon; + private volatile Image imageIcon; private Label displayName; private Label runTime; + private Skin skin; public MusicSelectable(FileHandle musicFile, Preferences musicData, final Skin skin, Texture defaultAlbumC) { super(skin, "info-button"); + this.skin = skin; debug(); @@ -65,7 +67,9 @@ public class MusicSelectable extends Button implements Disposable { if (songName == null || songName.isEmpty()) { songName = musicFile.nameWithoutExtension(); } - + } + + public synchronized void addInfoToPanel() { Gdx.app.postRunnable(new Runnable() { @Override @@ -82,6 +86,10 @@ public class MusicSelectable extends Button implements Disposable { } System.out.println("invalid or null"); } + float scale = getWidth()/imageIcon.getWidth(); + imageIcon.setScale(scale); +// imageIcon.setSize(scale*imageIcon.getWidth(), scale*imageIcon.getHeight()); + add(imageIcon); @@ -89,7 +97,8 @@ public class MusicSelectable extends Button implements Disposable { displayName = new Label(songName, skin); displayName.setWrap(true); - add(displayName).prefWidth(getWidth()-5); + add(displayName).prefWidth(getPrefWidth()-5).center(); + row(); diff --git a/core/src/zero1hd/polyjet/ui/builders/SetResolutionButton.java b/core/src/zero1hd/polyjet/ui/builders/SetResolutionButton.java index 92dceca..37ff266 100755 --- a/core/src/zero1hd/polyjet/ui/builders/SetResolutionButton.java +++ b/core/src/zero1hd/polyjet/ui/builders/SetResolutionButton.java @@ -1,5 +1,8 @@ package zero1hd.polyjet.ui.builders; +import java.awt.Dimension; +import java.awt.Toolkit; + import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; import com.badlogic.gdx.scenes.scene2d.Actor; @@ -12,6 +15,12 @@ public class SetResolutionButton extends TextButton { public SetResolutionButton(final int width, final int height, Skin skin, final Preferences prefs) { super(width + "x" + height, skin); + Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); + + if (screenDim.getWidth() < width || screenDim.getHeight() < height) { + setDisabled(true); + } + addListener(new ChangeListener() { @Override diff --git a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java index e42e7b9..b855924 100755 --- a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java @@ -2,6 +2,7 @@ package zero1hd.polyjet.ui.pages; import java.io.File; import java.io.FilenameFilter; +import java.util.concurrent.CountDownLatch; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; @@ -22,7 +23,7 @@ import zero1hd.polyjet.ui.builders.MusicSelectable; public class MusicSelectionPage extends Page { Image loading; - volatile Table musicChoices; + private volatile Table musicChoices; Preferences musicFileAnnotation; private Polyjet core; @@ -74,6 +75,8 @@ public class MusicSelectionPage extends Page { private int startingID; private Skin skin; private FileHandle musicDir; +// private CountDownLatch latch; + private volatile MusicSelectable selectable; public MusicFinderRunnable(FileHandle musicDir, Skin skin, int startingID) { super(); @@ -82,6 +85,7 @@ public class MusicSelectionPage extends Page { this.skin = skin; this.musicDir = musicDir; +// latch = new CountDownLatch(1); } @@ -98,8 +102,8 @@ public class MusicSelectionPage extends Page { } }); for (int music = startingID; music < musicFiles.length && music < 15; music++) { - MusicSelectable selectable = new MusicSelectable(musicFiles[music], musicFileAnnotation, skin, core.assetManager.get("defaultCover.png", Texture.class)); - musicChoices.add(selectable).prefSize(0.2f*Gdx.graphics.getWidth(), 0.8f*Gdx.graphics.getHeight()); + selectable = new MusicSelectable(musicFiles[music], musicFileAnnotation, skin, core.assetManager.get("defaultCover.png", Texture.class)); + musicChoices.add(selectable).prefSize(0.2f*getWidth(), 0.8f*getHeight()); } } }