|
|
@@ -10,7 +10,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|
|
|
|
|
import com.itant.shibei.R;
|
|
|
import com.itant.shibei.base.ITopActionListener;
|
|
|
-import com.itant.shibei.tool.DataTool;
|
|
|
import com.itant.shibei.ui.function.FunctionFragment;
|
|
|
import com.itant.shibei.ui.mine.coupon.AddCouponActivity;
|
|
|
import com.itant.shibei.widget.bottomlistener.OnRcvScrollListener;
|
|
|
@@ -176,35 +175,22 @@ public class TemplateFragment extends BaseMVPFragment implements ITemplateView<C
|
|
|
srl_template.setRefreshing(false);
|
|
|
if (!success) {
|
|
|
ToastTool.showShort(message);
|
|
|
- if (mCouponBeanList.size() == 0) {
|
|
|
- // 本地写死的数据
|
|
|
- mCouponBeanList.addAll(DataTool.getTemplateList(mTemplateType));
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
- }
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (mCurrentPage == PAGE_START) {
|
|
|
mCouponBeanList.clear();
|
|
|
- if (couponBeanList != null) {
|
|
|
- mCouponBeanList.addAll(couponBeanList);
|
|
|
- }
|
|
|
-
|
|
|
- // 本地写死的数据
|
|
|
- mCouponBeanList.addAll(DataTool.getTemplateList(mTemplateType));
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
- // 如果是下拉刷新获取的第0页数据,item不要自动滚动一段距离
|
|
|
- // 或者用这个mLayoutManager.scrollToPositionWithOffset(0, 0);
|
|
|
- if (mIsRefresh) {
|
|
|
- ToastTool.showShort("刷新成功");
|
|
|
- rv_template.smoothScrollToPosition(0);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (couponBeanList != null) {
|
|
|
- mCouponBeanList.addAll(couponBeanList);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
+ if (couponBeanList != null) {
|
|
|
+ mCouponBeanList.addAll(couponBeanList);
|
|
|
+ }
|
|
|
+ mAdapter.notifyDataSetChanged();
|
|
|
+ // 如果是下拉刷新获取的第0页数据,item不要自动滚动一段距离
|
|
|
+ // 或者用这个mLayoutManager.scrollToPositionWithOffset(0, 0);
|
|
|
+ if (mIsRefresh) {
|
|
|
+ ToastTool.showShort("刷新成功");
|
|
|
+ rv_template.smoothScrollToPosition(0);
|
|
|
}
|
|
|
|
|
|
// 请求到数据了,页数自增
|