|
@@ -10,6 +10,8 @@ import android.view.View;
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
|
|
+import com.cooleshow.base.bean.SubjectListBean;
|
|
|
+import com.cooleshow.base.bean.TenantGroupListBean;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
import com.cooleshow.base.utils.SizeUtils;
|
|
@@ -26,6 +28,7 @@ import com.cooleshow.base.bean.StudentPageListBean;
|
|
|
import com.cooleshow.teacher.contract.SelectTenantMemberContract;
|
|
|
import com.cooleshow.teacher.databinding.AcSelectTenantMemberLayoutBinding;
|
|
|
import com.cooleshow.teacher.presenter.mine.SelectTenantMemberPresenter;
|
|
|
+import com.cooleshow.teacher.widgets.dialog.SelectTenantMemberFilterBottomDialog;
|
|
|
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
|
|
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
|
|
|
|
@@ -47,6 +50,9 @@ public class SelectTenantMemberActivity extends BaseMVPActivity<AcSelectTenantMe
|
|
|
private SelectTenantMemberAdapter mMemberAdapter;
|
|
|
private CustomSuspensionDecoration mDecoration;
|
|
|
private ArrayList<GroupMemberBean> mFilterList;
|
|
|
+ private ArrayList<SubjectListBean.RowsBean> subjectList;
|
|
|
+ private ArrayList<TenantGroupListBean.RowsBean> groupList;
|
|
|
+ private SelectTenantMemberFilterBottomDialog mFilterDialog;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -65,6 +71,14 @@ public class SelectTenantMemberActivity extends BaseMVPActivity<AcSelectTenantMe
|
|
|
super.initData();
|
|
|
ArrayList<StudentPageListBean.RowsBean> list = getIntent().getParcelableArrayListExtra("list");
|
|
|
mFilterList = getIntent().getParcelableArrayListExtra("filterList");
|
|
|
+
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setText("筛选");
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setVisibility(View.VISIBLE);
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setCompoundDrawablePadding(SizeUtils.dp2px(4));
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.icon_arrow_down, 0);
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setTextColor(getResources().getColor(com.cooleshow.base.R.color.common_black));
|
|
|
+ viewBinding.toolbarInclude.tvRightText.setOnClickListener(this);
|
|
|
+
|
|
|
mMemberAdapter = new SelectTenantMemberAdapter(list);
|
|
|
EmptyViewLayout emptyViewLayout = new EmptyViewLayout(this);
|
|
|
emptyViewLayout.setContent(R.drawable.icon_empty_content, "暂无学员");
|
|
@@ -97,6 +111,40 @@ public class SelectTenantMemberActivity extends BaseMVPActivity<AcSelectTenantMe
|
|
|
presenter.getTenantStudentList();
|
|
|
}
|
|
|
|
|
|
+ private void showFilterDialog() {
|
|
|
+ if (subjectList == null) {
|
|
|
+ presenter.getTenantStudentList();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (groupList == null) {
|
|
|
+ presenter.getTenantGroupList();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (mFilterDialog == null) {
|
|
|
+ mFilterDialog = new SelectTenantMemberFilterBottomDialog(this);
|
|
|
+ mFilterDialog.setOnEventListener(new SelectTenantMemberFilterBottomDialog.OnEventListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckResult(ArrayList<String> subjectIds, ArrayList<String> groupList) {
|
|
|
+ ArrayList<StudentPageListBean.RowsBean> bySubjectId = findBySubjectId(subjectIds);
|
|
|
+ ArrayList<StudentPageListBean.RowsBean> byGroupId = findByGroupId(groupList);
|
|
|
+ ArrayList<StudentPageListBean.RowsBean> result = new ArrayList<>();
|
|
|
+ if (bySubjectId != null) {
|
|
|
+ result.addAll(bySubjectId);
|
|
|
+ }
|
|
|
+ if (byGroupId != null) {
|
|
|
+ result.addAll(byGroupId);
|
|
|
+ }
|
|
|
+ mMemberAdapter.addSelects(result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!mFilterDialog.isShowing()) {
|
|
|
+ mFilterDialog.show();
|
|
|
+ }
|
|
|
+ mFilterDialog.setSubjectList(subjectList);
|
|
|
+ mFilterDialog.setGroupList(groupList);
|
|
|
+ }
|
|
|
+
|
|
|
private void initListener() {
|
|
|
viewBinding.tvConfirm.setOnClickListener(this);
|
|
|
mMemberAdapter.setOnItemClickListener(new OnItemClickListener() {
|
|
@@ -112,11 +160,20 @@ public class SelectTenantMemberActivity extends BaseMVPActivity<AcSelectTenantMe
|
|
|
@Override
|
|
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
|
|
getData();
|
|
|
+ presenter.getSubjectList();
|
|
|
+ presenter.getTenantGroupList();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ protected void onResume() {
|
|
|
+ super.onResume();
|
|
|
+ presenter.getSubjectList();
|
|
|
+ presenter.getTenantGroupList();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
protected AcSelectTenantMemberLayoutBinding getLayoutView() {
|
|
|
return AcSelectTenantMemberLayoutBinding.inflate(getLayoutInflater());
|
|
|
}
|
|
@@ -147,6 +204,22 @@ public class SelectTenantMemberActivity extends BaseMVPActivity<AcSelectTenantMe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getSubjectListSuccess(SubjectListBean data) {
|
|
|
+ if (!checkActivityExist()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ subjectList = data.getRows();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void getTenantGroupListSuccess(TenantGroupListBean data) {
|
|
|
+ if (!checkActivityExist()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ groupList = data.getRows();
|
|
|
+ }
|
|
|
+
|
|
|
private ArrayList<StudentPageListBean.RowsBean> filterExist(List<StudentPageListBean.RowsBean> list) {
|
|
|
ArrayList<StudentPageListBean.RowsBean> listResult = new ArrayList<>();
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
@@ -159,6 +232,42 @@ public class SelectTenantMemberActivity extends BaseMVPActivity<AcSelectTenantMe
|
|
|
return listResult;
|
|
|
}
|
|
|
|
|
|
+ private ArrayList<StudentPageListBean.RowsBean> findBySubjectId(ArrayList<String> subjectIds) {
|
|
|
+ if (subjectIds != null && subjectIds.size() > 0) {
|
|
|
+ ArrayList<StudentPageListBean.RowsBean> list = new ArrayList<>();
|
|
|
+ for (int i = 0; i < subjectIds.size(); i++) {
|
|
|
+ String subjectId = subjectIds.get(i);
|
|
|
+ List<StudentPageListBean.RowsBean> data = mMemberAdapter.getData();
|
|
|
+ for (int j = 0; j < data.size(); j++) {
|
|
|
+ StudentPageListBean.RowsBean rowsBean = data.get(j);
|
|
|
+ if (TextUtils.equals(subjectId, rowsBean.getSubjectId())) {
|
|
|
+ list.add(rowsBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ArrayList<StudentPageListBean.RowsBean> findByGroupId(ArrayList<String> groupIds) {
|
|
|
+ if (groupIds != null && groupIds.size() > 0) {
|
|
|
+ ArrayList<StudentPageListBean.RowsBean> list = new ArrayList<>();
|
|
|
+ for (int i = 0; i < groupIds.size(); i++) {
|
|
|
+ String groupId = groupIds.get(i);
|
|
|
+ List<StudentPageListBean.RowsBean> data = mMemberAdapter.getData();
|
|
|
+ for (int j = 0; j < data.size(); j++) {
|
|
|
+ StudentPageListBean.RowsBean rowsBean = data.get(j);
|
|
|
+ if (TextUtils.equals(groupId, rowsBean.getTenantGroupId())) {
|
|
|
+ list.add(rowsBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
private boolean isContainInFilterList(String targetId) {
|
|
|
if (mFilterList != null && mFilterList.size() > 0) {
|
|
|
for (int j = 0; j < mFilterList.size(); j++) {
|
|
@@ -179,6 +288,11 @@ public class SelectTenantMemberActivity extends BaseMVPActivity<AcSelectTenantMe
|
|
|
returnResult(selectList);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (id == com.cooleshow.base.R.id.tv_right_text) {
|
|
|
+ showFilterDialog();
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void returnResult(ArrayList<StudentPageListBean.RowsBean> select) {
|