clean up; music selection no longer wraps back to top;

This commit is contained in:
Harrison Deng 2018-09-04 04:50:35 -05:00
parent eba5459ab3
commit ec82f3a5ee
2 changed files with 12 additions and 12 deletions

View File

@ -38,7 +38,6 @@ public class RhythmBullet extends Game {
private AssetManager assetManager = new AssetManager();
private Skin skin;
TextureAtlas skinAtlas;
private Preferences preferences;
private RoundingResolutionHandler rRHandler;
private InitialScreen initialScreen;
@ -217,7 +216,6 @@ public class RhythmBullet extends Game {
Gdx.app.debug("Core", "disposing...");
try {
getScreen().dispose();
skinAtlas.dispose();
getSkin().dispose();
assetManager.dispose();
assetPack.dispose();

View File

@ -207,14 +207,16 @@ public class MusicSelectionPage extends Page implements Observer {
}
private void scrollDown() {
selectables.selectNext();
if (selectables.selectNext()) {
scrollPane.scrollTo(selectables.getChecked().getX(), selectables.getChecked().getY(), selectables.getChecked().getWidth(), selectables.getChecked().getHeight());
}
}
private void scrollUp() {
selectables.selectPrevious();
if (selectables.selectPrevious()) {
scrollPane.scrollTo(selectables.getChecked().getX(), selectables.getChecked().getY(), selectables.getChecked().getWidth(), selectables.getChecked().getHeight());
}
}
public FileHandle getSelectedMusic() {
return selectables.getChecked().getMetadata().getFileHandle();
@ -465,20 +467,22 @@ public class MusicSelectionPage extends Page implements Observer {
}
public void selectNext() {
public boolean selectNext() {
int index = getCheckedIndex() + 1;
if (index == buttons.size) {
index = 0;
return false;
}
buttons.get(index).setChecked(true);
return true;
}
public void selectPrevious() {
public boolean selectPrevious() {
int index = getCheckedIndex() - 1;
if (index == -1) {
index = buttons.size -1;
return false;
}
buttons.get(index).setChecked(true);
return true;
}
@Override
@ -510,7 +514,6 @@ public class MusicSelectionPage extends Page implements Observer {
setPosition(scrollPane.getWidth() + scrollPane.getX(), 0);
setSize(width, height);
subInformation = new Table(skin);
subInformation.setBackground("corner-panel");
albumCover = new Image(assets.get("defaultCover.png", Texture.class));
songTitle = new ScrollText("", null, skin, true, true);
author = new Label(null, skin, "sub-font", skin.getColor("default"));
@ -540,7 +543,6 @@ public class MusicSelectionPage extends Page implements Observer {
}
public void setToDefault() {
clear();
subInformation.clear();