|
|
@@ -3,8 +3,6 @@ package com.itant.shibei.ui.home.goods;
|
|
|
import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
-import android.view.View;
|
|
|
-import android.widget.ImageView;
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
@@ -54,7 +52,6 @@ public class GoodsFragment extends BaseMVPFragment implements IGoodsView, ITopAc
|
|
|
/**是否下拉获取数据*/
|
|
|
private boolean mIsRefresh = true;
|
|
|
|
|
|
- private ImageView iv_empty;
|
|
|
|
|
|
@Override
|
|
|
public int getLayoutResId() {
|
|
|
@@ -65,7 +62,6 @@ public class GoodsFragment extends BaseMVPFragment implements IGoodsView, ITopAc
|
|
|
public void onCreateViewFinished(@Nullable Bundle savedInstanceState) {
|
|
|
super.onCreateViewFinished(savedInstanceState);
|
|
|
|
|
|
- iv_empty = rootView.findViewById(R.id.iv_empty);
|
|
|
rv_goods = rootView.findViewById(R.id.rv_goods);
|
|
|
// 必须要设置LayoutManager,否则RecyclerView不知道要使用什么布局,从而在界面上不显示
|
|
|
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
|
|
@@ -79,6 +75,8 @@ public class GoodsFragment extends BaseMVPFragment implements IGoodsView, ITopAc
|
|
|
mAdapter = new GoodsAdapter(getActivity(), mGoodsList);
|
|
|
mAdapter.setGoodsLongClickListener(this::showAdminDialog);
|
|
|
rv_goods.setAdapter(mAdapter);
|
|
|
+ // 必须先绑定RecyclerView
|
|
|
+ mAdapter.setEmptyView(R.layout.view_empty, rv_goods);
|
|
|
// 不要滑动一段距离
|
|
|
rv_goods.smoothScrollToPosition(0);
|
|
|
srl_goods = rootView.findViewById(R.id.srl_goods);
|
|
|
@@ -201,12 +199,6 @@ public class GoodsFragment extends BaseMVPFragment implements IGoodsView, ITopAc
|
|
|
if (goodsList != null && goodsList.size() > 0) {
|
|
|
mCurrentPage++;
|
|
|
}
|
|
|
-
|
|
|
- if (mGoodsList.size() == 0) {
|
|
|
- iv_empty.setVisibility(View.VISIBLE);
|
|
|
- } else {
|
|
|
- iv_empty.setVisibility(View.GONE);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
/**
|