private void getParise() { if (MyUser.fetchCurrentUser().getObjectId().equals(userId)) { articleAdapter.setDatas(Constant.PARISES); ptrClassicFrameLayout.refreshComplete(); articleAdapter.setFootStatus(false); return; } Api.getParises( new Subscriber<List<AvArticle>>() { @Override public void onCompleted() {} @Override public void onError(Throwable e) { ptrClassicFrameLayout.refreshComplete(); articleAdapter.setFootStatus(false); } @Override public void onNext(List<AvArticle> avArticles) { parises = avArticles; articleAdapter.setDatas(parises); ptrClassicFrameLayout.refreshComplete(); articleAdapter.setFootStatus(false); } }); }
@Override protected void initViews() { ptrClassicFrameLayout = fv(R.id.ptrFrameLayout); loadRecyclerView = fv(R.id.loadRecyclerView); ptrClassicFrameLayout.setLastUpdateTimeRelateObject(this); ptrClassicFrameLayout.setPtrHandler( new PtrDefaultHandler() { @Override public void onRefreshBegin(PtrFrameLayout frame) { initDates(); } @Override public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) { return (UserActivity.verticalOffset == 0) && super.checkCanDoRefresh(frame, content, header); } }); loadRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); articleAdapter = new ArticleAdapter(loadRecyclerView); loadRecyclerView.setAdapter(articleAdapter); articleAdapter.setOnRVItemClickListener(this); loadRecyclerView.setOnLoadListener(this); type = getArguments().getString(TYPE); userId = getArguments().getString(USERID, MyUser.fetchCurrentUser().getObjectId()); }