use of cn.nicolite.palm300heroes.view.adapter.HostRankAdapter 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();
}
}
Aggregations