Created
August 7, 2020 11:26
-
-
Save bengongon97/b5c6e5c5ed8e2aa2ca519fa927ef2a08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Drawable drawablePlay = getDrawable(R.drawable.btn_playback_play_normal); | |
final Drawable drawablePause = getDrawable(R.drawable.btn_playback_pause_normal); | |
binding.playButtonImageView.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
if(binding.playButtonImageView.getDrawable().getConstantState().equals(drawablePlay.getConstantState())){ | |
if (mHwAudioPlayerManager != null){ | |
mHwAudioPlayerManager.play(); | |
binding.playButtonImageView.setImageDrawable(getDrawable(R.drawable.btn_playback_pause_normal)); | |
isReallyPlaying = true; | |
} | |
} | |
else if(binding.playButtonImageView.getDrawable().getConstantState().equals(drawablePause.getConstantState())){ | |
if (mHwAudioPlayerManager != null) { | |
mHwAudioPlayerManager.pause(); | |
binding.playButtonImageView.setImageDrawable(getDrawable(R.drawable.btn_playback_play_normal)); | |
isReallyPlaying = false; | |
} | |
} | |
} | |
}); | |
binding.nextSongImageView.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
if (mHwAudioPlayerManager != null) { | |
mHwAudioPlayerManager.playNext(); | |
isReallyPlaying = true; | |
} | |
} | |
}); | |
binding.previousSongImageView.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
if (mHwAudioPlayerManager != null) { | |
mHwAudioPlayerManager.playPre(); | |
isReallyPlaying = true; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment