PullLoadView
PullLoadView copied to clipboard
how to pullloadview from retrofit data
how to use pullloadview which the data is taken from retrofit data json
异步网络请求,然后add到数据源 刷新适配器就好了 这根控件本身没关系,控件做的只是触发请求的时机。希望能帮到你理解这逻辑
@tosslife I have been able to create the flow with retrofit and it works quite well. The only error I've seen with this is that if you do not add data to the adapter, but only call the setComplete method of the PullLoadView object, the progress object is not hidden, it remains in the view with the list empty.
My Fragment is this:
class CustomFragment extends Fragment {
private PullToLoadView pullToLoadView;
@Override
protected void onCreateView(View view) {
if (view instanceof PullToLoadView){
pullToLoadView = (PullToLoadView) view;
pullToLoadView.isLoadMoreEnabled(true);
pullToLoadView.setPullCallback(mListener);
....
}
}
public void initLoad(){
pullToLoadView.initLoad();
}
public void setComplete(){
pullToLoadView.setComplete();
}
}
The error is replicated If I directly call the methods consecutively, like this:
@OnClick(R.id.fab)
public void onFabClick(View view) {
fragment.initLoad();
fragment.setComplete();
}