|
@@ -22,10 +22,13 @@ import com.cooleshow.base.utils.LogUtils;
|
|
import com.cooleshow.base.utils.PopupUtil;
|
|
import com.cooleshow.base.utils.PopupUtil;
|
|
import com.cooleshow.base.utils.TimeUtils;
|
|
import com.cooleshow.base.utils.TimeUtils;
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
|
|
+import com.cooleshow.base.widgets.poplist.PopMenuBean;
|
|
|
|
+import com.cooleshow.base.widgets.poplist.PopupListWindow;
|
|
import com.cooleshow.teacher.R;
|
|
import com.cooleshow.teacher.R;
|
|
import com.cooleshow.teacher.adapter.CourseStatusFilterAdapter;
|
|
import com.cooleshow.teacher.adapter.CourseStatusFilterAdapter;
|
|
import com.cooleshow.teacher.adapter.SparringCourseListAdapter;
|
|
import com.cooleshow.teacher.adapter.SparringCourseListAdapter;
|
|
import com.cooleshow.teacher.bean.CourseFilterStatusBean;
|
|
import com.cooleshow.teacher.bean.CourseFilterStatusBean;
|
|
|
|
+import com.cooleshow.teacher.bean.QuerySubjectBean;
|
|
import com.cooleshow.teacher.bean.SparringCourseListBean;
|
|
import com.cooleshow.teacher.bean.SparringCourseListBean;
|
|
import com.cooleshow.teacher.constants.CourseConstants;
|
|
import com.cooleshow.teacher.constants.CourseConstants;
|
|
import com.cooleshow.teacher.contract.SparringCourseContract;
|
|
import com.cooleshow.teacher.contract.SparringCourseContract;
|
|
@@ -37,6 +40,7 @@ import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
@@ -54,13 +58,11 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
private boolean hasNext = true;
|
|
private boolean hasNext = true;
|
|
private SparringCourseListAdapter mAdapter;
|
|
private SparringCourseListAdapter mAdapter;
|
|
private EmptyViewLayout mEmptyView;
|
|
private EmptyViewLayout mEmptyView;
|
|
- private TextView mTvEmptyTip;
|
|
|
|
- private ImageView mEmptyIcon;
|
|
|
|
private TimePickerView pvTime;
|
|
private TimePickerView pvTime;
|
|
- private PopupWindow mPopupWindow;
|
|
|
|
private ArrayList<CourseFilterStatusBean> mCourseFilterStatusBeans;
|
|
private ArrayList<CourseFilterStatusBean> mCourseFilterStatusBeans;
|
|
- private CourseStatusFilterAdapter mCourseStatusFilterAdapter;
|
|
|
|
|
|
+ private List<QuerySubjectBean> subjectBeanList = new ArrayList<>();
|
|
private boolean isFirstLoad = true;
|
|
private boolean isFirstLoad = true;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected FragmentSparringCourseLayoutBinding getLayoutView() {
|
|
protected FragmentSparringCourseLayoutBinding getLayoutView() {
|
|
return FragmentSparringCourseLayoutBinding.inflate(getLayoutInflater());
|
|
return FragmentSparringCourseLayoutBinding.inflate(getLayoutInflater());
|
|
@@ -75,19 +77,20 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
protected void initView(View rootView) {
|
|
protected void initView(View rootView) {
|
|
mViewBinding.tvTime.setOnClickListener(this);
|
|
mViewBinding.tvTime.setOnClickListener(this);
|
|
mViewBinding.tvCourseStatus.setOnClickListener(this);
|
|
mViewBinding.tvCourseStatus.setOnClickListener(this);
|
|
|
|
+ mViewBinding.tvAgency.setOnClickListener(this);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void refreshData() {
|
|
public void refreshData() {
|
|
super.refreshData();
|
|
super.refreshData();
|
|
- reBuildFilter(currentSelectDate,currentCourseFilterStatus);
|
|
|
|
|
|
+ reBuildFilter(currentSelectDate, currentCourseFilterStatus);
|
|
isFirstLoad = false;
|
|
isFirstLoad = false;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onResume() {
|
|
public void onResume() {
|
|
super.onResume();
|
|
super.onResume();
|
|
- if(isFirstLoad){
|
|
|
|
|
|
+ if (isFirstLoad) {
|
|
isFirstLoad = false;
|
|
isFirstLoad = false;
|
|
reBuildFilter(null, CourseConstants.COURSE_FILTER_ALL);
|
|
reBuildFilter(null, CourseConstants.COURSE_FILTER_ALL);
|
|
}
|
|
}
|
|
@@ -118,40 +121,31 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void initData() {
|
|
protected void initData() {
|
|
- mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
|
|
|
- currentPage = 1;
|
|
|
|
- queryCourse(true);
|
|
|
|
- }
|
|
|
|
|
|
+ mViewBinding.refreshLayout.setOnRefreshListener(refreshLayout -> {
|
|
|
|
+ currentPage = 1;
|
|
|
|
+ queryCourse(true);
|
|
});
|
|
});
|
|
|
|
|
|
mAdapter = new SparringCourseListAdapter(R.layout.item_sparring_course_list_layout);
|
|
mAdapter = new SparringCourseListAdapter(R.layout.item_sparring_course_list_layout);
|
|
- mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onLoadMore() {
|
|
|
|
- //上拉加载
|
|
|
|
- if (hasNext) {
|
|
|
|
- currentPage++;
|
|
|
|
- queryCourse(false);
|
|
|
|
- } else {
|
|
|
|
- mAdapter.getLoadMoreModule().loadMoreEnd();
|
|
|
|
- }
|
|
|
|
|
|
+ mAdapter.getLoadMoreModule().setOnLoadMoreListener(() -> {
|
|
|
|
+ //上拉加载
|
|
|
|
+ if (hasNext) {
|
|
|
|
+ currentPage++;
|
|
|
|
+ queryCourse(false);
|
|
|
|
+ } else {
|
|
|
|
+ mAdapter.getLoadMoreModule().loadMoreEnd();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- mAdapter.setOnItemClickListener(new OnItemClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
|
|
|
|
- if (position < mAdapter.getData().size()) {
|
|
|
|
- SparringCourseListBean.RowsBean rowsBean = mAdapter.getData().get(position);
|
|
|
|
- if (rowsBean != null) {
|
|
|
|
- ARouter.getInstance()
|
|
|
|
- .build(RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
|
|
|
|
- .withString(SparringCourseDetailActivity.COURSE_ID, rowsBean.courseId)
|
|
|
|
- .withString(SparringCourseDetailActivity.COURSE_GROUP_ID, rowsBean.courseGoupId)
|
|
|
|
- .withString(SparringCourseDetailActivity.STUDENT_ID, rowsBean.userId)
|
|
|
|
- .navigation();
|
|
|
|
- }
|
|
|
|
|
|
+ mAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
|
+ if (position < mAdapter.getData().size()) {
|
|
|
|
+ SparringCourseListBean.RowsBean rowsBean = mAdapter.getData().get(position);
|
|
|
|
+ if (rowsBean != null) {
|
|
|
|
+ ARouter.getInstance()
|
|
|
|
+ .build(RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
|
|
|
|
+ .withString(SparringCourseDetailActivity.COURSE_ID, rowsBean.courseId)
|
|
|
|
+ .withString(SparringCourseDetailActivity.COURSE_GROUP_ID, rowsBean.courseGoupId)
|
|
|
|
+ .withString(SparringCourseDetailActivity.STUDENT_ID, rowsBean.userId)
|
|
|
|
+ .navigation();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -235,27 +229,16 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
if (pvTime == null) {
|
|
if (pvTime == null) {
|
|
pvTime = new TimePickerBuilder(requireContext(), (date, v) -> {//选中事件回调
|
|
pvTime = new TimePickerBuilder(requireContext(), (date, v) -> {//选中事件回调
|
|
reBuildFilter(date, currentCourseFilterStatus);
|
|
reBuildFilter(date, currentCourseFilterStatus);
|
|
- }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_default_layout, new CustomListener() {
|
|
|
|
- @Override
|
|
|
|
- public void customLayout(View v) {
|
|
|
|
- //自定义布局中的控件初始化及事件处理
|
|
|
|
- final TextView tvSubmit = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_finish);
|
|
|
|
- TextView ivCancel = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_cancel);
|
|
|
|
- tvSubmit.setOnClickListener(new View.OnClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onClick(View v) {
|
|
|
|
- pvTime.returnData();
|
|
|
|
- pvTime.dismiss();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- ivCancel.setOnClickListener(new View.OnClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onClick(View v) {
|
|
|
|
- pvTime.dismiss();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_default_layout, v -> {
|
|
|
|
+ //自定义布局中的控件初始化及事件处理
|
|
|
|
+ final TextView tvSubmit = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_finish);
|
|
|
|
+ TextView ivCancel = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_cancel);
|
|
|
|
+ tvSubmit.setOnClickListener(v1 -> {
|
|
|
|
+ pvTime.returnData();
|
|
|
|
+ pvTime.dismiss();
|
|
|
|
+ });
|
|
|
|
+ ivCancel.setOnClickListener(v12 -> pvTime.dismiss());
|
|
|
|
|
|
- }
|
|
|
|
})
|
|
})
|
|
.setLineSpacingMultiplier(2.5f)
|
|
.setLineSpacingMultiplier(2.5f)
|
|
.setType(new boolean[]{true, true, false, false, false, false})// 默认全部显示
|
|
.setType(new boolean[]{true, true, false, false, false, false})// 默认全部显示
|
|
@@ -272,44 +255,6 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void initPopu(View targetView) {
|
|
|
|
- if (mPopupWindow == null) {
|
|
|
|
- View popupContentView = LayoutInflater.from(requireContext()).inflate(com.cooleshow.base.R.layout.list_popu_layout, null);
|
|
|
|
- RecyclerView recyclerView = popupContentView.findViewById(R.id.recyclerView);
|
|
|
|
- View bg = popupContentView.findViewById(com.cooleshow.base.R.id.view);
|
|
|
|
- bg.setOnClickListener(new View.OnClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onClick(View v) {
|
|
|
|
- if (mPopupWindow != null) {
|
|
|
|
- mPopupWindow.dismiss();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- mCourseStatusFilterAdapter = new CourseStatusFilterAdapter(com.cooleshow.base.R.layout.notice_popu_list_item);
|
|
|
|
- mCourseStatusFilterAdapter.setOnItemClickListener(new OnItemClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
|
|
|
|
- Object object = mCourseStatusFilterAdapter.getData().get(position);
|
|
|
|
- if (object instanceof CourseFilterStatusBean) {
|
|
|
|
- if (mCourseStatusFilterAdapter != null) {
|
|
|
|
- mCourseStatusFilterAdapter.setSelect(position);
|
|
|
|
- }
|
|
|
|
- CourseFilterStatusBean filterStatusBean = (CourseFilterStatusBean) object;
|
|
|
|
- mViewBinding.tvCourseStatus.setText(filterStatusBean.showText);
|
|
|
|
- reBuildFilter(currentSelectDate, filterStatusBean.value);
|
|
|
|
- }
|
|
|
|
- mPopupWindow.dismiss();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
|
|
|
- recyclerView.setAdapter(mCourseStatusFilterAdapter);
|
|
|
|
- mCourseStatusFilterAdapter.setNewInstance(mCourseFilterStatusBeans);
|
|
|
|
- mPopupWindow = PopupUtil.createNoBackPopupWindow(popupContentView, requireContext(), ViewGroup.LayoutParams.MATCH_PARENT,
|
|
|
|
- ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
|
|
|
- }
|
|
|
|
- mPopupWindow.showAsDropDown(targetView);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public void onClick(View v) {
|
|
public void onClick(View v) {
|
|
if (v.getId() == R.id.tv_time) {
|
|
if (v.getId() == R.id.tv_time) {
|
|
@@ -319,8 +264,48 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
}
|
|
}
|
|
if (v.getId() == R.id.tv_course_status) {
|
|
if (v.getId() == R.id.tv_course_status) {
|
|
//课程状态筛选
|
|
//课程状态筛选
|
|
- initPopu(mViewBinding.tvCourseStatus);
|
|
|
|
|
|
+ List<PopMenuBean> popList = new ArrayList<>();
|
|
|
|
+ for (CourseFilterStatusBean bean : mCourseFilterStatusBeans) {
|
|
|
|
+ PopMenuBean popMenuBean = new PopMenuBean();
|
|
|
|
+ popMenuBean.setActionName(bean.showText);
|
|
|
|
+ popList.add(popMenuBean);
|
|
|
|
+ }
|
|
|
|
+ initCoursePop(mViewBinding.tvCourseStatus, popList, position -> {
|
|
|
|
+ CourseFilterStatusBean bean = mCourseFilterStatusBeans.get(position);
|
|
|
|
+ mViewBinding.tvCourseStatus.setText(bean.showText);
|
|
|
|
+ reBuildFilter(currentSelectDate, bean.value);
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (v.getId() == R.id.tv_agency) {
|
|
|
|
+ //选择声部
|
|
|
|
+ if (subjectBeanList.size() == 0) {
|
|
|
|
+ subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
|
|
|
|
+ }
|
|
|
|
+ List<PopMenuBean> popList = new ArrayList<>();
|
|
|
|
+ for (QuerySubjectBean bean : subjectBeanList) {
|
|
|
|
+ PopMenuBean popMenuBean = new PopMenuBean();
|
|
|
|
+ popMenuBean.setActionName(bean.name);
|
|
|
|
+ popList.add(popMenuBean);
|
|
|
|
+ }
|
|
|
|
+ initCoursePop(mViewBinding.tvAgency, popList, position -> {
|
|
|
|
+ QuerySubjectBean bean = subjectBeanList.get(position);
|
|
|
|
+ currentSubjectId = bean.id;
|
|
|
|
+ mViewBinding.tvAgency.setText(bean.name);
|
|
|
|
+ queryCourse(true);
|
|
|
|
+ });
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void initCoursePop(View targetView, List<PopMenuBean> popList, PopupListWindow.PopupListListener listener) {
|
|
|
|
+ PopupListWindow popWindow = new PopupListWindow(getContext());
|
|
|
|
+ popWindow.showListPop(targetView, popList, position -> listener.onPopupListClick(position));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
|
|
|
|
+ subjectBeanList.clear();
|
|
|
|
+ subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
|
|
|
|
+ subjectBeanList.addAll(data);
|
|
|
|
+ }
|
|
}
|
|
}
|