use of com.wm.remusic.adapter.MusicFlowAdapter in project remusic by aa112901.
the class SimpleMoreFragment method getList.
private void getList() {
long musicId = args;
adapterMusicInfo = MusicUtils.getMusicInfo(mContext, musicId);
musicName = adapterMusicInfo.musicName;
if (musicName == null) {
musicName = MusicPlayer.getTrackName();
}
topTitle.setText("歌曲:" + " " + musicName);
setMusicInfo();
musicflowAdapter = new MusicFlowAdapter(mContext, mlistInfo, adapterMusicInfo);
}
use of com.wm.remusic.adapter.MusicFlowAdapter in project remusic by aa112901.
the class SimpleMoreFragment method setClick.
private void setClick() {
if (musicflowAdapter != null) {
musicflowAdapter.setOnItemClickListener(new MusicFlowAdapter.OnRecyclerViewItemClickListener() {
@Override
public void onItemClick(View view, String data) {
switch(Integer.parseInt(data)) {
case 0:
if (adapterMusicInfo.islocal) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (adapterMusicInfo.songId == MusicPlayer.getCurrentAudioId())
return;
long[] ids = new long[1];
ids[0] = adapterMusicInfo.songId;
HashMap<Long, MusicInfo> map = new HashMap<Long, MusicInfo>();
map.put(ids[0], adapterMusicInfo);
MusicPlayer.playNext(mContext, map, ids);
}
}, 100);
}
dismiss();
break;
case 1:
AddNetPlaylistDialog.newInstance(adapterMusicInfo).show(getFragmentManager(), "add");
dismiss();
break;
case 2:
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + adapterMusicInfo.data));
shareIntent.setType("audio/*");
mContext.startActivity(Intent.createChooser(shareIntent, getResources().getString(R.string.shared_to)));
dismiss();
break;
case 3:
if (adapterMusicInfo.islocal) {
new AlertDialog.Builder(mContext).setTitle(getResources().getString(R.string.sure_to_delete_music)).setPositiveButton(getResources().getString(R.string.sure), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri uri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, adapterMusicInfo.songId);
mContext.getContentResolver().delete(uri, null, null);
if (MusicPlayer.getCurrentAudioId() == adapterMusicInfo.songId) {
if (MusicPlayer.getQueueSize() == 0) {
MusicPlayer.stop();
} else {
MusicPlayer.next();
}
}
HandlerUtil.getInstance(mContext).postDelayed(new Runnable() {
@Override
public void run() {
PlaylistsManager.getInstance(mContext).deleteMusic(mContext, adapterMusicInfo.songId);
mContext.sendBroadcast(new Intent(IConstants.MUSIC_COUNT_CHANGED));
}
}, 200);
// File file;
// file = new File(adapterMusicInfo.data);
// if (file.exists())
// file.delete();
// mContext.getApplicationContext().sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
// Uri.parse("file://" + adapterMusicInfo.data)));
// mContext.sendBroadcast(new Intent(IConstants.MUSIC_COUNT_CHANGED));
dismiss();
}
}).setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
}
}).show();
}
dismiss();
break;
case 4:
if (adapterMusicInfo.islocal) {
new AlertDialog.Builder(mContext).setTitle(getResources().getString(R.string.sure_to_set_ringtone)).setPositiveButton(getResources().getString(R.string.sure), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri ringUri = Uri.parse("file://" + adapterMusicInfo.data);
RingtoneManager.setActualDefaultRingtoneUri(mContext, RingtoneManager.TYPE_NOTIFICATION, ringUri);
dialog.dismiss();
Toast.makeText(mContext, getResources().getString(R.string.set_ringtone_successed), Toast.LENGTH_SHORT).show();
dismiss();
}
}).setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).show();
}
break;
case 5:
MusicDetailFragment detailFrament = MusicDetailFragment.newInstance(adapterMusicInfo);
detailFrament.show(getActivity().getSupportFragmentManager(), "detail");
dismiss();
break;
default:
break;
}
}
});
recyclerView.setAdapter(musicflowAdapter);
}
}
use of com.wm.remusic.adapter.MusicFlowAdapter in project remusic by aa112901.
the class NetMoreFragment method getList.
private void getList() {
// long musicId = Long.parseLong(args.trim());
adapterMusicInfo = getArguments().getParcelable("music");
artist = adapterMusicInfo.artist;
albumId = adapterMusicInfo.albumId + "";
albumName = adapterMusicInfo.albumName;
musicName = adapterMusicInfo.musicName;
topTitle.setText("歌曲:" + " " + musicName);
heightPercent = 0.6;
setMusicInfo();
muaicflowAdapter = new MusicFlowAdapter(mContext, mlistInfo, adapterMusicInfo);
}
use of com.wm.remusic.adapter.MusicFlowAdapter in project remusic by aa112901.
the class MoreFragment method getList.
private void getList() {
if (type == IConstants.MUSICOVERFLOW) {
// long musicId = Long.parseLong(args.trim());
adapterMusicInfo = getArguments().getParcelable("music");
if (adapterMusicInfo == null) {
adapterMusicInfo = new MusicInfo();
}
artist = adapterMusicInfo.artist;
albumId = adapterMusicInfo.albumId + "";
albumName = adapterMusicInfo.albumName;
musicName = adapterMusicInfo.musicName;
topTitle.setText("歌曲:" + " " + musicName);
heightPercent = 0.6;
setMusicInfo();
muaicflowAdapter = new MusicFlowAdapter(mContext, mlistInfo, adapterMusicInfo);
} else {
switch(type) {
case IConstants.ARTISTOVERFLOW:
String artist = args;
list = MusicUtils.queryMusic(mContext, artist, IConstants.START_FROM_ARTIST);
topTitle.setText("歌曲:" + " " + list.get(0).artist);
break;
case IConstants.ALBUMOVERFLOW:
String albumId = args;
list = MusicUtils.queryMusic(mContext, albumId, IConstants.START_FROM_ALBUM);
topTitle.setText("专辑:" + " " + list.get(0).albumName);
break;
case IConstants.FOLDEROVERFLOW:
String folder = args;
list = MusicUtils.queryMusic(mContext, folder, IConstants.START_FROM_FOLDER);
topTitle.setText("文件夹:" + " " + folder);
break;
}
setCommonInfo();
heightPercent = 0.3;
commonAdapter = new OverFlowAdapter(mContext, mlistInfo, list);
}
}
Aggregations