From 1e5a743739a530c23c9214245226e1a8fff6df12 Mon Sep 17 00:00:00 2001 From: Recrown Date: Mon, 22 May 2017 23:17:32 -0500 Subject: [PATCH] continue problem fixing --- .../polyjet/ui/windows/MusicController.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/core/src/zero1hd/polyjet/ui/windows/MusicController.java b/core/src/zero1hd/polyjet/ui/windows/MusicController.java index a87cc42..284de15 100755 --- a/core/src/zero1hd/polyjet/ui/windows/MusicController.java +++ b/core/src/zero1hd/polyjet/ui/windows/MusicController.java @@ -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);