use of com.huadong.musicvideoplayer.model.OnlineMusic in project MusicVideoPlayer by MartingKing.
the class OnlineMusicAdapter method getView.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_holder_music, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
OnlineMusic onlineMusic = mData.get(position);
Glide.with(parent).load(onlineMusic.getPic_small()).apply(new RequestOptions().placeholder(R.drawable.default_cover).error(R.drawable.default_cover)).into(holder.ivCover);
holder.tvTitle.setText(onlineMusic.getTitle());
String artist = FileUtils.getArtistAndAlbum(onlineMusic.getArtist_name(), onlineMusic.getAlbum_title());
holder.tvArtist.setText(artist);
holder.ivMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mListener.onMoreClick(position);
}
});
holder.vDivider.setVisibility(isShowDivider(position) ? View.VISIBLE : View.GONE);
return convertView;
}
use of com.huadong.musicvideoplayer.model.OnlineMusic in project MusicVideoPlayer by MartingKing.
the class PlaylistActivity method onMoreClick.
@Override
public void onMoreClick(int position) {
final OnlineMusic onlineMusic = mMusicList.get(position);
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(mMusicList.get(position).getTitle());
String path = FileUtils.getMusicDir() + FileUtils.getMp3FileName(onlineMusic.getArtist_name(), onlineMusic.getTitle());
File file = new File(path);
int itemsId = file.exists() ? R.array.online_music_dialog_without_download : R.array.online_music_dialog;
dialog.setItems(itemsId, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which) {
case // 分享
0:
share(onlineMusic);
break;
case // 查看歌手信息
1:
artistInfo(onlineMusic);
break;
case // 下载
2:
download(onlineMusic);
break;
}
}
});
dialog.show();
}
Aggregations