Search in sources :

Example 1 with WeiXinAdapter

use of com.xxx.ency.view.weixin.adapter.WeiXinAdapter in project Ency by xiarunhao123.

the class WeiXinFragment method initialize.

@Override
protected void initialize() {
    swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
    swipeRefreshLayout.setRefreshing(true);
    swipeRefreshLayout.setOnRefreshListener(this);
    mPresenter.getWeiXinData(PAGE_SIZE, page);
    mPresenter.getPTP();
    weiXinAdapter = new WeiXinAdapter();
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));
    recyclerView.setAdapter(weiXinAdapter);
    weiXinAdapter.setPTP(sharePrefManager.getProvincialTrafficPattern());
    weiXinAdapter.setOnLoadMoreListener(this, recyclerView);
    weiXinAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            WeiXinBean.NewslistBean bean = (WeiXinBean.NewslistBean) adapter.getData().get(position);
            WebActivity.open(new WebActivity.Builder().setGuid(// 微信Item没有id,使用url作为guid
            bean.getUrl()).setImgUrl(bean.getPicUrl()).setType(Constants.TYPE_WEIXIN).setUrl(bean.getUrl()).setTitle(bean.getTitle()).setShowLikeIcon(true).setContext(mContext));
        }
    });
}
Also used : BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) WebActivity(com.xxx.ency.view.web.WebActivity) WeiXinAdapter(com.xxx.ency.view.weixin.adapter.WeiXinAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) WeiXinBean(com.xxx.ency.model.bean.WeiXinBean)

Aggregations

DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 BindView (butterknife.BindView)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 WeiXinBean (com.xxx.ency.model.bean.WeiXinBean)1 WebActivity (com.xxx.ency.view.web.WebActivity)1 WeiXinAdapter (com.xxx.ency.view.weixin.adapter.WeiXinAdapter)1