use of com.github.jdsjlzx.interfaces.OnItemLongClickListener in project Palm300Heroes by nicolite.
the class ThemeMusicFragment method doBusiness.
@Override
protected void doBusiness() {
lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
lRecyclerViewAdapter = new LRecyclerViewAdapter(new ThemeMusicAdapter(context, dataList));
lRecyclerView.setAdapter(lRecyclerViewAdapter);
lRecyclerView.setLoadMoreEnabled(false);
themeMusicPresenter = new ThemeMusicPresenter(this, this);
lRecyclerView.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() {
themeMusicPresenter.showThemeMusicList();
}
});
lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
ThemeMusic.InfoBean.SoundsBean soundsBean = dataList.get(position);
Intent intent = new Intent(context, WebViewActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("type", WebViewActivity.TYPE_THEME_MUSIC);
bundle.putString("url", Constants.MISSEVAN_MUSIC_DETIAL_URL + soundsBean.getId());
bundle.putString("title", soundsBean.getSoundstr());
intent.putExtras(bundle);
startActivity(intent);
}
});
lRecyclerViewAdapter.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public void onItemLongClick(View view, final int position) {
final CommonDialog commonDialog = new CommonDialog(context);
commonDialog.setMessage("确认下载?").setPositiveButton("确认", new View.OnClickListener() {
@Override
public void onClick(View view) {
commonDialog.dismiss();
ThemeMusic.InfoBean.SoundsBean soundsBean = dataList.get(position);
DownLoadUtils.downLoadManager(context, Constants.MISSEVAN_MUSIC_URL + soundsBean.getSoundurl(), "/P300Heroes/Sound", "audio/mpeg");
}
}).setNegativeButton("取消", null).show();
}
});
if (isFirstVisible && ListUtils.isEmpty(dataList)) {
lRecyclerView.forceToRefresh();
}
}
Aggregations