|
@@ -21,6 +21,7 @@ import com.cooleshow.base.router.RouterPath;
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
import com.cooleshow.base.utils.GsonUtils;
|
|
import com.cooleshow.base.utils.GsonUtils;
|
|
import com.cooleshow.base.utils.JumpUtils;
|
|
import com.cooleshow.base.utils.JumpUtils;
|
|
|
|
+import com.cooleshow.base.utils.LogUtils;
|
|
import com.cooleshow.teacher.R;
|
|
import com.cooleshow.teacher.R;
|
|
import com.cooleshow.teacher.adapter.MessageBoxAdapter;
|
|
import com.cooleshow.teacher.adapter.MessageBoxAdapter;
|
|
import com.cooleshow.teacher.bean.CountOfUnreadBean;
|
|
import com.cooleshow.teacher.bean.CountOfUnreadBean;
|
|
@@ -103,7 +104,7 @@ public class MessageBoxActivity extends BaseMVPActivity<ActivityMessageBoxBindin
|
|
}
|
|
}
|
|
|
|
|
|
private MessageBoxAdapter messageBoxAdapter;
|
|
private MessageBoxAdapter messageBoxAdapter;
|
|
- List<SystemMessageBean.RowsBean> dataList = new ArrayList<>();
|
|
|
|
|
|
+// List<SystemMessageBean.RowsBean> dataList = new ArrayList<>();
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void initView() {
|
|
protected void initView() {
|
|
@@ -123,7 +124,7 @@ public class MessageBoxActivity extends BaseMVPActivity<ActivityMessageBoxBindin
|
|
RecyclerView rvAddress = viewBinding.recyclerView;
|
|
RecyclerView rvAddress = viewBinding.recyclerView;
|
|
LinearLayoutManager manager = new LinearLayoutManager(this);
|
|
LinearLayoutManager manager = new LinearLayoutManager(this);
|
|
rvAddress.setLayoutManager(manager);
|
|
rvAddress.setLayoutManager(manager);
|
|
- messageBoxAdapter = new MessageBoxAdapter(dataList);
|
|
|
|
|
|
+ messageBoxAdapter = new MessageBoxAdapter();
|
|
LayoutInflater inflater = LayoutInflater.from(this);
|
|
LayoutInflater inflater = LayoutInflater.from(this);
|
|
View emptyLayout = inflater.inflate(R.layout.layout_empty_conent, null);
|
|
View emptyLayout = inflater.inflate(R.layout.layout_empty_conent, null);
|
|
ImageView im_empty_logo = emptyLayout.findViewById(R.id.im_empty_logo);
|
|
ImageView im_empty_logo = emptyLayout.findViewById(R.id.im_empty_logo);
|
|
@@ -194,15 +195,18 @@ public class MessageBoxActivity extends BaseMVPActivity<ActivityMessageBoxBindin
|
|
public void sysMessageListSuccess(int page, SystemMessageBean data) {
|
|
public void sysMessageListSuccess(int page, SystemMessageBean data) {
|
|
if (data != null) {
|
|
if (data != null) {
|
|
if (page == 1) {
|
|
if (page == 1) {
|
|
- dataList.clear();
|
|
|
|
viewBinding.refreshLayout.finishRefresh();
|
|
viewBinding.refreshLayout.finishRefresh();
|
|
|
|
+ messageBoxAdapter.getData().clear();
|
|
|
|
+ messageBoxAdapter.notifyDataSetChanged();
|
|
if (data.rows != null && data.rows.size() > 0) {
|
|
if (data.rows != null && data.rows.size() > 0) {
|
|
checkHasNext(data.rows.size());
|
|
checkHasNext(data.rows.size());
|
|
- dataList.addAll(data.rows);
|
|
|
|
|
|
+ messageBoxAdapter.setNewInstance(data.rows);
|
|
|
|
+ } else {
|
|
|
|
+ messageBoxAdapter.notifyDataSetChanged();
|
|
}
|
|
}
|
|
- messageBoxAdapter.notifyDataSetChanged();
|
|
|
|
} else {
|
|
} else {
|
|
if (data.rows != null && data.rows.size() > 0) {
|
|
if (data.rows != null && data.rows.size() > 0) {
|
|
|
|
+ messageBoxAdapter.addData(data.rows);
|
|
messageBoxAdapter.getLoadMoreModule().loadMoreComplete();
|
|
messageBoxAdapter.getLoadMoreModule().loadMoreComplete();
|
|
checkHasNext(data.rows.size());
|
|
checkHasNext(data.rows.size());
|
|
} else {
|
|
} else {
|
|
@@ -242,7 +246,7 @@ public class MessageBoxActivity extends BaseMVPActivity<ActivityMessageBoxBindin
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void setCurrentReadSuccess(long id) {
|
|
public void setCurrentReadSuccess(long id) {
|
|
- for (SystemMessageBean.RowsBean rowsBean : dataList) {
|
|
|
|
|
|
+ for (SystemMessageBean.RowsBean rowsBean : messageBoxAdapter.getData()) {
|
|
if (rowsBean.id == id) {
|
|
if (rowsBean.id == id) {
|
|
rowsBean.readStatus = 1;
|
|
rowsBean.readStatus = 1;
|
|
break;
|
|
break;
|