Search in sources :

Example 1 with OnItemClickListener

use of com.github.jdsjlzx.interfaces.OnItemClickListener in project Palm300Heroes by nicolite.

the class HostRankFragment method doBusiness.

@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new HostRankAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    if (type == TYPE_RANK_TITLE) {
        lRecyclerView.setLoadMoreEnabled(false);
    }
    hostRankPresenter = new HostRankPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            switch(type) {
                case TYPE_RANK_TITLE:
                    hostRankPresenter.showRankTitle();
                    break;
                case TYPE_RANK_LIST:
                    hostRankPresenter.showRankList(index);
                    break;
            }
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
            switch(type) {
                case TYPE_RANK_TITLE:
                    break;
                case TYPE_RANK_LIST:
                    currentPage++;
                    hostRankPresenter.loadMore(index, currentPage);
                    break;
            }
        }
    });
    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            RecordRank.RankBean.ListBean list = dataList.get(position);
            switch(type) {
                case TYPE_RANK_TITLE:
                    Bundle bundle = new Bundle();
                    bundle.putInt("type", ContainerActivity.TYPE_RECORD_RANK_LIST);
                    bundle.putString("title", list.getName());
                    bundle.putString("extra", String.valueOf(list.getIndex()));
                    startActivity(ContainerActivity.class, bundle);
                    break;
                case TYPE_RANK_LIST:
                    break;
            }
        }
    });
    if (isFirstVisible && ListUtils.isEmpty(dataList)) {
        lRecyclerView.forceToRefresh();
    }
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) HostRankAdapter(cn.nicolite.palm300heroes.view.adapter.HostRankAdapter) RecordRank(cn.nicolite.palm300heroes.model.bean.RecordRank) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) HostRankPresenter(cn.nicolite.palm300heroes.presenter.HostRankPresenter) Bundle(android.os.Bundle) ContainerActivity(cn.nicolite.palm300heroes.view.activity.ContainerActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) TextView(android.widget.TextView) IHostRankView(cn.nicolite.palm300heroes.view.iview.IHostRankView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Example 2 with OnItemClickListener

use of com.github.jdsjlzx.interfaces.OnItemClickListener in project Palm300Heroes by nicolite.

the class MatchListFragment method doBusiness.

@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    // lRecyclerViewAdapter = new LRecyclerViewAdapter();
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
        }
    });
    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
        }
    });
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Example 3 with OnItemClickListener

use of com.github.jdsjlzx.interfaces.OnItemClickListener 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)

Example 4 with OnItemClickListener

use of com.github.jdsjlzx.interfaces.OnItemClickListener in project Palm300Heroes by nicolite.

the class NewsListFragment method doBusiness.

@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new NewsAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    newsListPresenter = new NewsListPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            newsListPresenter.loadNewsList(url, type);
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
            currentPage++;
            newsListPresenter.loadMoreNewsList(url, type, currentPage);
        }
    });
    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            News news = dataList.get(position);
            if (!news.getNewsUrl().contains("/details/")) {
                Bundle bundle = new Bundle();
                bundle.putString("title", news.getNewsTitle());
                bundle.putString("url", news.getNewsUrl());
                bundle.putInt("type", WebViewActivity.TYPE_OTHERS);
                startActivity(WebViewActivity.class, bundle);
            } else {
                Bundle bundle = new Bundle();
                bundle.putString("url", news.getNewsUrl());
                bundle.putString("title", news.getNewsTitle());
                bundle.putInt("type", WebViewActivity.TYPE_NEWS);
                startActivity(WebViewActivity.class, bundle);
            }
        }
    });
    if (url.equals(Constants.JUMP_NEWS_URL) && isFirstVisible && ListUtils.isEmpty(dataList)) {
        lRecyclerView.forceToRefresh();
    }
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) NewsListPresenter(cn.nicolite.palm300heroes.presenter.NewsListPresenter) Bundle(android.os.Bundle) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) WebViewActivity(cn.nicolite.palm300heroes.view.activity.WebViewActivity) BindView(butterknife.BindView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) News(cn.nicolite.palm300heroes.model.bean.News) NewsAdapter(cn.nicolite.palm300heroes.view.oldAdapter.NewsAdapter) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Example 5 with OnItemClickListener

use of com.github.jdsjlzx.interfaces.OnItemClickListener in project Palm300Heroes by nicolite.

the class VideoFragment method doBusiness.

@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new VideoAdapter(context, videoList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    videoPresenter = new VideoPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            currentPage = 1;
            videoPresenter.loadVideoList();
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
            videoPresenter.loadMore(++currentPage);
        }
    });
    lRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {

        @Override
        public void reload() {
            videoPresenter.loadMore(currentPage);
        }
    });
    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            Bilibili.DataBean.VlistBean vlistBean = videoList.get(position);
            Bundle bundle = new Bundle();
            bundle.putInt("type", WebViewActivity.TYPE_VIDEO);
            bundle.putString("title", vlistBean.getTitle());
            bundle.putString("url", "https://m.bilibili.com/video/av" + vlistBean.getAid() + ".html");
            startActivity(WebViewActivity.class, bundle);
        }
    });
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) OnNetWorkErrorListener(com.github.jdsjlzx.interfaces.OnNetWorkErrorListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) VideoAdapter(cn.nicolite.palm300heroes.view.adapter.VideoAdapter) Bundle(android.os.Bundle) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) WebViewActivity(cn.nicolite.palm300heroes.view.activity.WebViewActivity) IVideoView(cn.nicolite.palm300heroes.view.iview.IVideoView) BindView(butterknife.BindView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) Bilibili(cn.nicolite.palm300heroes.model.bean.Bilibili) VideoPresenter(cn.nicolite.palm300heroes.presenter.VideoPresenter) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Aggregations

View (android.view.View)9 BindView (butterknife.BindView)9 OnItemClickListener (com.github.jdsjlzx.interfaces.OnItemClickListener)9 OnRefreshListener (com.github.jdsjlzx.interfaces.OnRefreshListener)9 LRecyclerView (com.github.jdsjlzx.recyclerview.LRecyclerView)9 Bundle (android.os.Bundle)8 LRecyclerViewAdapter (com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter)8 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 OnLoadMoreListener (com.github.jdsjlzx.interfaces.OnLoadMoreListener)6 WebViewActivity (cn.nicolite.palm300heroes.view.activity.WebViewActivity)4 OnNetWorkErrorListener (com.github.jdsjlzx.interfaces.OnNetWorkErrorListener)4 GridLayoutManager (android.support.v7.widget.GridLayoutManager)3 TextView (android.widget.TextView)3 News (cn.nicolite.palm300heroes.model.bean.News)2 ContainerActivity (cn.nicolite.palm300heroes.view.activity.ContainerActivity)2 NewsAdapter (cn.nicolite.palm300heroes.view.oldAdapter.NewsAdapter)2 Intent (android.content.Intent)1 ActionBar (android.support.v7.app.ActionBar)1 ImageView (android.widget.ImageView)1 BGABanner (cn.bingoogolapple.bgabanner.BGABanner)1