use of com.cyl.musiclake.bean.Music in project MusicLake by caiyonglong.
the class LoveFragment method listener.
@Override
protected void listener() {
mAdapter.setOnItemClickListener((adapter, view, position) -> {
if (view.getId() != R.id.iv_more) {
PlayManager.setPlayList(musicInfos);
PlayManager.play(position);
}
});
mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
PopupMenu popupMenu = new PopupMenu(getContext(), view);
popupMenu.setOnMenuItemClickListener(item -> {
switch(item.getItemId()) {
case R.id.popup_song_play:
PlayManager.setPlayList(musicInfos);
PlayManager.play(position);
break;
case R.id.popup_song_detail:
ShowDetailDialog.newInstance((Music) adapter.getItem(position)).show(getChildFragmentManager(), getTag());
break;
case R.id.popup_song_addto_queue:
AddPlaylistDialog.newInstance(musicInfos.get(position)).show(getChildFragmentManager(), "ADD_PLAYLIST");
break;
}
return false;
});
popupMenu.inflate(R.menu.popup_album);
popupMenu.show();
});
}
use of com.cyl.musiclake.bean.Music in project MusicLake by caiyonglong.
the class PlaylistDetailFragment method listener.
@Override
protected void listener() {
mAdapter.setOnItemClickListener((adapter, view, position) -> {
if (view.getId() != R.id.iv_more) {
PlayManager.setPlayList(musicList);
PlayManager.play(position);
}
});
mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
PopupMenu popupMenu = new PopupMenu(getContext(), view);
popupMenu.setOnMenuItemClickListener(item -> {
switch(item.getItemId()) {
case R.id.popup_song_play:
PlayManager.setPlayList(musicList);
PlayManager.play(position);
break;
case R.id.popup_song_detail:
ShowDetailDialog.newInstance((Music) adapter.getItem(position)).show(getChildFragmentManager(), getTag());
break;
case R.id.popup_song_addto_queue:
AddPlaylistDialog.newInstance(musicList.get(position)).show(getChildFragmentManager(), "ADD_PLAYLIST");
break;
case R.id.popup_song_delete:
new MaterialDialog.Builder(getContext()).title("提示").content("是否移除这首歌曲?").onPositive((dialog, which) -> {
mPresenter.uncollectMusic(mPlaylist.getId(), position, musicList.get(position));
// PlaylistLoader.removeSong(getActivity(), mPlaylist.getId(), musicList.get(position).getId());
// mAdapter.notifyItemChanged(position);
}).positiveText("确定").negativeText("取消").show();
break;
}
return false;
});
popupMenu.inflate(R.menu.popup_playlist);
popupMenu.show();
});
}
use of com.cyl.musiclake.bean.Music in project MusicLake by caiyonglong.
the class RecentlyFragment method listener.
@Override
protected void listener() {
mAdapter.setOnItemClickListener((adapter, view, position) -> {
if (view.getId() != R.id.iv_more) {
PlayManager.setPlayList(musicInfos);
PlayManager.play(position);
}
});
mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
PopupMenu popupMenu = new PopupMenu(getContext(), view);
popupMenu.setOnMenuItemClickListener(item -> {
switch(item.getItemId()) {
case R.id.popup_song_play:
PlayManager.setPlayList(musicInfos);
PlayManager.play(position);
break;
case R.id.popup_song_detail:
ShowDetailDialog.newInstance((Music) adapter.getItem(position)).show(getChildFragmentManager(), getTag());
break;
case R.id.popup_song_addto_queue:
AddPlaylistDialog.newInstance(musicInfos.get(position)).show(getChildFragmentManager(), "ADD_PLAYLIST");
break;
}
return false;
});
popupMenu.inflate(R.menu.popup_album);
popupMenu.show();
});
}
use of com.cyl.musiclake.bean.Music in project MusicLake by caiyonglong.
the class SongsFragment method listener.
@Override
protected void listener() {
mAdapter.setOnItemClickListener((adapter, view, position) -> {
if (view.getId() != R.id.iv_more) {
mPresenter.playMusic(musicList, position);
}
});
mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
Music music = (Music) adapter.getItem(position);
PopupMenu popupMenu = new PopupMenu(getContext(), view);
popupMenu.setOnMenuItemClickListener(item -> {
switch(item.getItemId()) {
case R.id.popup_song_play:
mPresenter.playMusic(musicList, position);
break;
case R.id.popup_song_detail:
ShowDetailDialog.newInstance((Music) adapter.getItem(position)).show(getChildFragmentManager(), getTag());
break;
case R.id.popup_song_goto_album:
Log.e("album", music.toString() + "");
NavigateUtil.navigateToAlbum(getActivity(), music.getAlbumId(), music.getAlbum(), null);
break;
case R.id.popup_song_goto_artist:
NavigateUtil.navigateToArtist(getActivity(), music.getArtistId(), music.getArtist(), null);
break;
case R.id.popup_song_addto_queue:
AddPlaylistDialog.newInstance(music).show(getChildFragmentManager(), "ADD_PLAYLIST");
break;
case R.id.popup_song_delete:
new MaterialDialog.Builder(getContext()).title("警告").content("是否删除这首歌曲?").onPositive((dialog, which) -> {
FileUtils.delFile(musicList.get(position).getUri());
SongLoader.removeSong(getActivity(), musicList.get(position));
musicList.remove(position);
mAdapter.notifyItemChanged(position);
}).positiveText("确定").negativeText("取消").show();
break;
}
return false;
});
popupMenu.inflate(R.menu.popup_song);
popupMenu.show();
});
}
use of com.cyl.musiclake.bean.Music in project MusicLake by caiyonglong.
the class BaiduMusicListActivity method listener.
@Override
protected void listener() {
mAdapter.setOnItemClickListener((adapter, view, position) -> {
if (view.getId() != R.id.iv_more) {
Music music = (Music) adapter.getItem(position);
mPresenter.playCurrentMusic(music);
}
});
mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
Music music = (Music) adapter.getItem(position);
PopupMenu popupMenu = new PopupMenu(getApplicationContext(), view);
popupMenu.setOnMenuItemClickListener(item -> {
switch(item.getItemId()) {
case R.id.popup_song_detail:
ShowDetailDialog.newInstance(music).show(getSupportFragmentManager(), getLocalClassName());
break;
case R.id.popup_song_goto_artist:
Log.e(TAG, music.toString());
Intent intent = new Intent(this, ArtistInfoActivity.class);
intent.putExtra(Extras.TING_UID, music);
startActivity(intent);
break;
case R.id.popup_add_playlist:
ToastUtils.show("暂不支持添加百度音乐");
break;
case R.id.popup_song_download:
DownloadDialog.newInstance(music).show(getSupportFragmentManager(), getLocalClassName());
break;
}
return false;
});
popupMenu.inflate(R.menu.popup_song_online);
popupMenu.show();
});
mAdapter.setOnLoadMoreListener(() -> mRecyclerView.postDelayed(() -> {
if (mCurrentCounter < TOTAL_COUNTER) {
// 数据全部加载完毕
mAdapter.loadMoreEnd();
} else {
// 成功获取更多数据
mPresenter.loadOnlineMusicList(type, limit, mOffset);
}
}, 1000), mRecyclerView);
}
Aggregations