|
@@ -28,6 +28,8 @@ import com.cooleshow.base.utils.LogUtils;
|
|
|
import com.cooleshow.base.utils.PopupUtil;
|
|
|
import com.cooleshow.base.utils.TimeUtils;
|
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
|
+import com.cooleshow.base.widgets.poplist.PopMenuBean;
|
|
|
+import com.cooleshow.base.widgets.poplist.PopupListWindow;
|
|
|
import com.cooleshow.student.R;
|
|
|
import com.cooleshow.student.adapter.CourseStatusFilterAdapter;
|
|
|
import com.cooleshow.student.adapter.PracticeCourseListAdapter;
|
|
@@ -75,18 +77,39 @@ public class MinePracticeCourseFragment extends BaseMVPFragment<FragmentPractice
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- switch (view.getId()) {
|
|
|
- case R.id.tv_time:
|
|
|
- //时间筛选
|
|
|
- showTimeSelectPicker();
|
|
|
- break;
|
|
|
- case R.id.tv_course_status:
|
|
|
- //课程状态筛选
|
|
|
- initPopu(mViewBinding.tvCourseStatus);
|
|
|
- break;
|
|
|
- case R.id.tv_agency:
|
|
|
- selectSubject();
|
|
|
- break;
|
|
|
+ int id = view.getId();
|
|
|
+ if (id == R.id.tv_time) {
|
|
|
+ //时间筛选
|
|
|
+ showTimeSelectPicker();
|
|
|
+ } else if (id == R.id.tv_course_status) {
|
|
|
+ //课程状态筛选
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+ } else if (id == 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.tvCourseStatus, popList, position -> {
|
|
|
+ QuerySubjectBean bean = subjectBeanList.get(position);
|
|
|
+ currentSubjectId = bean.id;
|
|
|
+ mViewBinding.tvAgency.setText(bean.name);
|
|
|
+ queryCourse(true);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -287,36 +310,9 @@ public class MinePracticeCourseFragment extends BaseMVPFragment<FragmentPractice
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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(v -> {
|
|
|
- if (mPopupWindow != null) {
|
|
|
- mPopupWindow.dismiss();
|
|
|
- }
|
|
|
- });
|
|
|
- mCourseStatusFilterAdapter = new CourseStatusFilterAdapter(com.cooleshow.base.R.layout.notice_popu_list_item);
|
|
|
- mCourseStatusFilterAdapter.setOnItemClickListener((adapter, view, 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);
|
|
|
+ private void initCoursePop(View targetView, List<PopMenuBean> popList, PopupListWindow.PopupListListener listener) {
|
|
|
+ PopupListWindow popWindow = new PopupListWindow(getContext());
|
|
|
+ popWindow.showListPop(targetView, popList, position -> listener.onPopupListClick(position));
|
|
|
}
|
|
|
|
|
|
private OptionsPickerView pvOptions;
|
|
@@ -325,7 +321,7 @@ public class MinePracticeCourseFragment extends BaseMVPFragment<FragmentPractice
|
|
|
if (subjectBeanList.size() == 0) {
|
|
|
subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
|
|
|
}
|
|
|
- pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
|
|
|
+ pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
|
|
|
currentSubjectId = subjectBeanList.get(options1).id;
|
|
|
mViewBinding.tvAgency.setText(subjectBeanList.get(options1).name);
|
|
|
queryCourse(true);
|