use of org.odk.collect.audioclips.AudioClipViewModel in project collect by opendatakit.
the class AudioHelper method setAudio.
/**
* @param button The control being used for playback
* @param clip The clip to be played
* @return A {@link LiveData} value representing whether this clip is playing or not
*/
public LiveData<Boolean> setAudio(AudioButton button, Clip clip) {
AudioClipViewModel viewModel = this.viewModel;
LiveData<Boolean> isPlaying = viewModel.isPlaying(clip.getClipID());
isPlaying.observe(lifecycleOwner, button::setPlaying);
button.setListener(new AudioButtonListener(viewModel, clip.getURI(), clip.getClipID()));
return isPlaying;
}
Aggregations