Search in sources :

Example 1 with PlaySongEvent

use of io.github.ryanhoo.music.event.PlaySongEvent in project StylishMusicPlayer by ryanhoo.

the class AllLocalMusicFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    mAdapter = new LocalMusicAdapter(getActivity(), null);
    mAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(int position) {
            Song song = mAdapter.getItem(position);
            RxBus.getInstance().post(new PlaySongEvent(song));
        }
    });
    recyclerView.setAdapter(mAdapter);
    recyclerView.addItemDecoration(new DefaultDividerDecoration());
    fastScroller.setRecyclerView(recyclerView);
    new LocalMusicPresenter(AppRepository.getInstance(), this).subscribe();
}
Also used : Song(io.github.ryanhoo.music.data.model.Song) OnItemClickListener(io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener) PlaySongEvent(io.github.ryanhoo.music.event.PlaySongEvent) DefaultDividerDecoration(io.github.ryanhoo.music.ui.common.DefaultDividerDecoration)

Aggregations

Song (io.github.ryanhoo.music.data.model.Song)1 PlaySongEvent (io.github.ryanhoo.music.event.PlaySongEvent)1 OnItemClickListener (io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener)1 DefaultDividerDecoration (io.github.ryanhoo.music.ui.common.DefaultDividerDecoration)1