use of cn.nicolite.palm300heroes.presenter.NewsListPresenter 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();
}
}
Aggregations