@Override protected void setDataForView(AbstractRequest request) { super.setDataForView(request); if (request instanceof CommunityUserCenterGetCollectionPagesssRequest) { CommunityUserCenterGetCollectionPagesssRequest res = (CommunityUserCenterGetCollectionPagesssRequest) request; if (res.errorCode != null && res.errorCode.equals("1")) { if (flag == FLAG_0) { if (res.collectPosts != null && res.collectPosts.size() > 0) { mCollcetPosts.addAll(res.collectPosts); } } else if (flag == FLAG_1) { if (res.collectPosts != null && res.collectPosts.size() > 0) { page = 0; mCollcetPosts.clear(); mCollcetPosts.addAll(res.collectPosts); } } else if (flag == FLAG_2) { if (res.collectPosts != null && res.collectPosts.size() > 0) { page++; mCollcetPosts.addAll(res.collectPosts); } } backView(); mAdapter.notifyDataSetChanged(); } else { backView(); Toast.makeText(getActivity(), "数据请求失败,请稍后重试...", Toast.LENGTH_SHORT).show(); } } }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (mCollcetPosts == null || mCollcetPosts.isEmpty()) { flag = FLAG_0; requestGetCollectionPagesss("0"); } }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (mHotPosts == null || mHotPosts.isEmpty()) { flag = FLAG_0; requestGetNewPosts_ListPage("0"); } }