use of com.example.jingbin.cloudreader.adapter.CoinAdapter in project CloudReader by youlookwhat.
the class CoinRankFragment method initRefreshView.
private void initRefreshView() {
headerBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.header_coin_rank, (ViewGroup) bindingView.xrvWan.getParent(), false);
RefreshHelper.initLinear(bindingView.xrvWan, true, 1);
RefreshHelper.setSwipeRefreshView(bindingView.srlWan);
mAdapter = new CoinAdapter(activity, true);
bindingView.xrvWan.setAdapter(mAdapter);
bindingView.xrvWan.addHeaderView(headerBinding.getRoot());
headerBinding.ivCoinRank.setVisibility(View.INVISIBLE);
bindingView.srlWan.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
bindingView.xrvWan.postDelayed(new Runnable() {
@Override
public void run() {
viewModel.setPage(1);
getCoinRank();
}
}, 150);
}
});
bindingView.xrvWan.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
if (!bindingView.srlWan.isRefreshing()) {
int page = viewModel.getPage();
viewModel.setPage(++page);
getCoinRank();
} else {
bindingView.xrvWan.loadMoreComplete();
}
}
});
bindingView.xrvWan.setOnItemClickListener(new OnItemFilterClickListener() {
@Override
protected void onSingleClick(View v, int position) {
CoinLogBean bean = mAdapter.getItemData(position);
MyShareActivity.start(activity, DataUtil.getName(bean.getUsername(), bean.getNickname()), bean.getUserId());
}
});
}
use of com.example.jingbin.cloudreader.adapter.CoinAdapter in project CloudReader by youlookwhat.
the class CoinDetailFragment method initRefreshView.
private void initRefreshView() {
headerBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.header_coin_detail, (ViewGroup) bindingView.xrvWan.getParent(), false);
RefreshHelper.initLinear(bindingView.xrvWan, true, 1);
RefreshHelper.setSwipeRefreshView(bindingView.srlWan);
mAdapter = new CoinAdapter(activity, false);
bindingView.xrvWan.setAdapter(mAdapter);
bindingView.xrvWan.addHeaderView(headerBinding.getRoot());
headerBinding.tvHeaderCoin.setVisibility(View.INVISIBLE);
bindingView.srlWan.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
bindingView.xrvWan.postDelayed(new Runnable() {
@Override
public void run() {
viewModel.setPage(1);
getCoinLog();
}
}, 150);
}
});
bindingView.xrvWan.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
if (!bindingView.srlWan.isRefreshing()) {
int page = viewModel.getPage();
viewModel.setPage(++page);
getCoinLog();
} else {
bindingView.xrvWan.loadMoreComplete();
}
}
});
UserUtil.getUserInfo(new OnUserInfoListener() {
@Override
public void onSuccess(User user) {
if (user != null) {
headerBinding.tvHeaderCoin.setText(String.valueOf(user.getCoinCount()));
}
}
});
}
Aggregations