diff --git a/android/assets/uiskin.png b/android/assets/uiskin.png index 33b5689..7511fda 100755 Binary files a/android/assets/uiskin.png and b/android/assets/uiskin.png differ diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java index 6902fd9..cab3308 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/MusicSelectable.java @@ -4,16 +4,20 @@ import com.badlogic.gdx.Preferences; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.Touchable; 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.VerticalGroup; import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.utils.Disposable; import zero1hd.rhythmbullet.audio.SongInfo; +import zero1hd.rhythmbullet.graphics.ui.pages.MusicSelectionPage; public class MusicSelectable extends WidgetGroup implements Disposable { private Table table; @@ -32,7 +36,7 @@ public class MusicSelectable extends WidgetGroup implements Disposable { private VerticalGroup vGroup; - public MusicSelectable(FileHandle musicFile, Preferences musicAnnotation, Skin skin, Texture defaultAlbumC) { + public MusicSelectable(FileHandle musicFile, Preferences musicAnnotation, Skin skin, Texture defaultAlbumC, MusicSelectionPage msp) { table = new Table(skin); table.setBackground("holo-pane"); vGroup = new VerticalGroup(); @@ -59,6 +63,19 @@ public class MusicSelectable extends WidgetGroup implements Disposable { table.add(vGroup).expandX().fillX().center(); addActor(table); + + addListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if (selected) { + deselect(); + } else { + msp.deselectAll(); + select(); + } + super.clicked(event, x, y); + } + }); } /** @@ -116,7 +133,7 @@ public class MusicSelectable extends WidgetGroup implements Disposable { selected = true; } - public void diselect() { + public void deselect() { table.setBackground("holo-pane"); selected = false; } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java index cb5c35c..59470b4 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MusicSelectionPage.java @@ -13,12 +13,14 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Array; import zero1hd.rhythmbullet.audio.SongInfo; @@ -113,7 +115,7 @@ public class MusicSelectionPage extends Page { 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)); + MusicSelectable selectable = new MusicSelectable(songList.getSongFileHandleFromIndex(i), musicFileAnnotation, skin, assets.get("defaultCover.png", Texture.class), this); selectables.add(selectable); songTable.add(selectable).expandX().fillX().height((getHeight() >= 2160 ? 300f : 200f)); @@ -139,4 +141,10 @@ public class MusicSelectionPage extends Page { white.dispose(); super.dispose(); } + + public void deselectAll() { + for (int i = 0; i < selectables.size; i++) { + selectables.get(i).deselect(); + } + } }