use of io.github.ryanhoo.music.data.model.Song in project StylishMusicPlayer by ryanhoo.
the class MusicPlayerFragment method playSong.
private void playSong(PlayList playList, int playIndex) {
if (playList == null)
return;
playList.setPlayMode(PreferenceManager.lastPlayMode(getActivity()));
// boolean result =
mPlayer.play(playList, playIndex);
Song song = playList.getCurrentSong();
onSongUpdated(song);
/*
seekBarProgress.setProgress(0);
seekBarProgress.setEnabled(result);
textViewProgress.setText(R.string.mp_music_default_duration);
if (result) {
imageViewAlbum.startRotateAnimation();
buttonPlayToggle.setImageResource(R.drawable.ic_pause);
textViewDuration.setText(TimeUtils.formatDuration(song.getDuration()));
} else {
buttonPlayToggle.setImageResource(R.drawable.ic_play);
textViewDuration.setText(R.string.mp_music_default_duration);
}
mHandler.removeCallbacks(mProgressCallback);
mHandler.post(mProgressCallback);
getActivity().startService(new Intent(getActivity(), PlaybackService.class));
*/
}
use of io.github.ryanhoo.music.data.model.Song in project StylishMusicPlayer by ryanhoo.
the class MusicPlayerFragment method onPlaySongEvent.
private void onPlaySongEvent(PlaySongEvent event) {
Song song = event.song;
playSong(song);
}
use of io.github.ryanhoo.music.data.model.Song in project StylishMusicPlayer by ryanhoo.
the class MusicPlayerPresenter method setSongAsFavorite.
@Override
public void setSongAsFavorite(Song song, boolean favorite) {
Subscription subscription = mRepository.setSongAsFavorite(song, favorite).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<Song>() {
@Override
public void onCompleted() {
// Empty
}
@Override
public void onError(Throwable e) {
mView.handleError(e);
}
@Override
public void onNext(Song song) {
mView.onSongSetAsFavorite(song);
RxBus.getInstance().post(new FavoriteChangeEvent(song));
}
});
mSubscriptions.add(subscription);
}
Aggregations