continue problem fixing

This commit is contained in:
Harrison Deng 2017-05-22 23:17:32 -05:00
parent 0fff556332
commit 1e5a743739

View File

@ -44,26 +44,28 @@ public class MusicController extends Window {
togglePlay = new Image(skin.getDrawable("loading")) {
@Override
public void act(float delta) {
if (audiofile.getPlaybackMusic() != null) {
if (audiofile.getPlaybackMusic().isPlaying()) {
setDrawable(skin.getDrawable("pause"));
} else if (!audiofile.getPlaybackMusic().isPlaying() && audiofile != null) {
setDrawable(skin.getDrawable("arrow"));
}
}
// if (audiofile != null) {
// if (audiofile.getPlaybackMusic().isPlaying()) {
// setDrawable(skin.getDrawable("pause"));
// } else if (!audiofile.getPlaybackMusic().isPlaying() && audiofile != null) {
// setDrawable(skin.getDrawable("arrow"));
// }
// }
super.act(delta);
}
};
togglePlay.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (audiofile.getPlaybackMusic() != null) {
if (audiofile != null) {
if (audiofile.getPlaybackMusic().isPlaying()) {
audiofile.getPlaybackMusic().pause();
togglePlay.setDrawable(skin.getDrawable("arrow"));
} else {
if (audiofile != null) {
audiofile.getPlaybackMusic().play();
}
togglePlay.setDrawable(skin.getDrawable("pause"));
audiofile.getPlaybackMusic().play();
}
}
super.clicked(event, x, y);
@ -75,7 +77,7 @@ public class MusicController extends Window {
fastForward.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (audiofile.getPlaybackMusic() != null) {
if (audiofile != null) {
audiofile.getPlaybackMusic().play();
audiofile.getPlaybackMusic().setPosition(audiofile.getPlaybackMusic().getPosition() + 2);
info.setText(String.valueOf(MathUtils.round(audiofile.getPlaybackMusic().getPosition())) + " sec");
@ -88,7 +90,7 @@ public class MusicController extends Window {
info = new TextField(null, skin) {
@Override
public void act(float delta) {
if (audiofile.getPlaybackMusic() != null && audiofile.getPlaybackMusic().isPlaying()) {
if (audiofile != null && audiofile.getPlaybackMusic().isPlaying()) {
setText(String.valueOf(MathUtils.round(audiofile.getPlaybackMusic().getPosition())) + " sec");
}
super.act(delta);