Search in sources :

Example 1 with OnItemLongClickListener

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();
    }
}
Also used : OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) Bundle(android.os.Bundle) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) WebViewActivity(cn.nicolite.palm300heroes.view.activity.WebViewActivity) CommonDialog(cn.nicolite.palm300heroes.view.customView.CommonDialog) IThemeMusicView(cn.nicolite.palm300heroes.view.iview.IThemeMusicView) BindView(butterknife.BindView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) ThemeMusic(cn.nicolite.palm300heroes.model.bean.ThemeMusic) OnItemLongClickListener(com.github.jdsjlzx.interfaces.OnItemLongClickListener) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) ThemeMusicPresenter(cn.nicolite.palm300heroes.presenter.ThemeMusicPresenter) ThemeMusicAdapter(cn.nicolite.palm300heroes.view.adapter.ThemeMusicAdapter) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Aggregations

Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 View (android.view.View)1 BindView (butterknife.BindView)1 ThemeMusic (cn.nicolite.palm300heroes.model.bean.ThemeMusic)1 ThemeMusicPresenter (cn.nicolite.palm300heroes.presenter.ThemeMusicPresenter)1 WebViewActivity (cn.nicolite.palm300heroes.view.activity.WebViewActivity)1 ThemeMusicAdapter (cn.nicolite.palm300heroes.view.adapter.ThemeMusicAdapter)1 CommonDialog (cn.nicolite.palm300heroes.view.customView.CommonDialog)1 IThemeMusicView (cn.nicolite.palm300heroes.view.iview.IThemeMusicView)1 OnItemClickListener (com.github.jdsjlzx.interfaces.OnItemClickListener)1 OnItemLongClickListener (com.github.jdsjlzx.interfaces.OnItemLongClickListener)1 OnRefreshListener (com.github.jdsjlzx.interfaces.OnRefreshListener)1 LRecyclerView (com.github.jdsjlzx.recyclerview.LRecyclerView)1 LRecyclerViewAdapter (com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter)1