|
@@ -11,7 +11,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|
|
|
|
|
|
|
import com.itant.shibei.R;
|
|
import com.itant.shibei.R;
|
|
|
import com.itant.shibei.base.ITopActionListener;
|
|
import com.itant.shibei.base.ITopActionListener;
|
|
|
-import com.itant.shibei.tool.DataTool;
|
|
|
|
|
import com.itant.shibei.ui.mine.goods.AddGoodsActivity;
|
|
import com.itant.shibei.ui.mine.goods.AddGoodsActivity;
|
|
|
import com.itant.shibei.widget.bottomlistener.OnRcvScrollListener;
|
|
import com.itant.shibei.widget.bottomlistener.OnRcvScrollListener;
|
|
|
import com.itant.shibei.widget.decoration.SpacesItemDecoration;
|
|
import com.itant.shibei.widget.decoration.SpacesItemDecoration;
|
|
@@ -180,37 +179,24 @@ public class GoodsFragment extends BaseMVPFragment implements IGoodsView, ITopAc
|
|
|
public void onGoodsDataCome(boolean success, String message, List<GoodsBean> goodsList) {
|
|
public void onGoodsDataCome(boolean success, String message, List<GoodsBean> goodsList) {
|
|
|
srl_goods.setRefreshing(false);
|
|
srl_goods.setRefreshing(false);
|
|
|
if (!success) {
|
|
if (!success) {
|
|
|
- if (mGoodsList.size() == 0) {
|
|
|
|
|
- // 本地写死的数据
|
|
|
|
|
- mGoodsList.addAll(DataTool.getGoodsList());
|
|
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
|
|
- }
|
|
|
|
|
ToastTool.showShort(message);
|
|
ToastTool.showShort(message);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (mCurrentPage == PAGE_START) {
|
|
if (mCurrentPage == PAGE_START) {
|
|
|
mGoodsList.clear();
|
|
mGoodsList.clear();
|
|
|
- if (goodsList != null) {
|
|
|
|
|
- mGoodsList.addAll(goodsList);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 本地写死的数据
|
|
|
|
|
- mGoodsList.addAll(DataTool.getGoodsList());
|
|
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
|
|
// 如果是下拉刷新获取的第0页数据,item不要自动滚动一段距离
|
|
// 如果是下拉刷新获取的第0页数据,item不要自动滚动一段距离
|
|
|
// 或者用这个mLayoutManager.scrollToPositionWithOffset(0, 0);
|
|
// 或者用这个mLayoutManager.scrollToPositionWithOffset(0, 0);
|
|
|
if (mIsRefresh) {
|
|
if (mIsRefresh) {
|
|
|
ToastTool.showShort("刷新成功");
|
|
ToastTool.showShort("刷新成功");
|
|
|
rv_goods.smoothScrollToPosition(0);
|
|
rv_goods.smoothScrollToPosition(0);
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- if (goodsList != null) {
|
|
|
|
|
- mGoodsList.addAll(goodsList);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ if (goodsList != null) {
|
|
|
|
|
+ mGoodsList.addAll(goodsList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ mAdapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
// 请求到数据了,页数自增
|
|
// 请求到数据了,页数自增
|
|
|
if (goodsList != null && goodsList.size() > 0) {
|
|
if (goodsList != null && goodsList.size() > 0) {
|