adp-path-morph-play-to-pause
adp-path-morph-play-to-pause copied to clipboard
Change between play and pause programatically
Using toggle method within the PlauPauseView unfortunately it's not enough. I want to have a method such as: setPlayState () and whenever I'm using this method the button to change it's shapes / to draw that play triangle. The same thing for pause. I tried editing the actual source code but I did a completely mess.
Why is that a problem? It's very simple to write. Here, I wrote it for you in a simple function.
public void togglePlayState(boolean play) {
PlayPauseDrawable pDrawable = (PlayPauseDrawable) playButton.getDrawable();
if (pDrawable.isPlay() ^ play) {
pDrawable.getPausePlayAnimator().start();
}
}