|
@@ -1,6 +1,5 @@
|
|
package com.cooleshow.teacher.ui.course;
|
|
package com.cooleshow.teacher.ui.course;
|
|
|
|
|
|
-import android.graphics.drawable.Drawable;
|
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
@@ -8,13 +7,14 @@ import android.view.ViewGroup;
|
|
import android.widget.PopupWindow;
|
|
import android.widget.PopupWindow;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
+import com.alibaba.android.arouter.launcher.ARouter;
|
|
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
|
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
|
import com.bigkoo.pickerview.listener.CustomListener;
|
|
import com.bigkoo.pickerview.listener.CustomListener;
|
|
import com.bigkoo.pickerview.view.TimePickerView;
|
|
import com.bigkoo.pickerview.view.TimePickerView;
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
|
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
|
import com.chad.library.adapter.base.listener.OnLoadMoreListener;
|
|
import com.chad.library.adapter.base.listener.OnLoadMoreListener;
|
|
-import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
|
|
|
|
|
+import com.cooleshow.base.router.RouterPath;
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
import com.cooleshow.base.utils.LogUtils;
|
|
import com.cooleshow.base.utils.LogUtils;
|
|
import com.cooleshow.base.utils.PopupUtil;
|
|
import com.cooleshow.base.utils.PopupUtil;
|
|
@@ -24,7 +24,7 @@ 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.SparringCourseListBean;
|
|
import com.cooleshow.teacher.bean.SparringCourseListBean;
|
|
-import com.cooleshow.teacher.constants.CourseFilterConstants;
|
|
|
|
|
|
+import com.cooleshow.teacher.constants.CourseConstants;
|
|
import com.cooleshow.teacher.contract.SparringCourseContract;
|
|
import com.cooleshow.teacher.contract.SparringCourseContract;
|
|
import com.cooleshow.teacher.databinding.FragmentSparringCourseLayoutBinding;
|
|
import com.cooleshow.teacher.databinding.FragmentSparringCourseLayoutBinding;
|
|
import com.cooleshow.teacher.presenter.course.SparringCoursePresenter;
|
|
import com.cooleshow.teacher.presenter.course.SparringCoursePresenter;
|
|
@@ -34,7 +34,6 @@ 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;
|
|
@@ -44,7 +43,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|
* Author by pq, Date on 2022/4/25.
|
|
* Author by pq, Date on 2022/4/25.
|
|
*/
|
|
*/
|
|
public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCourseLayoutBinding, SparringCoursePresenter> implements SparringCourseContract.SparringCourseView, View.OnClickListener {
|
|
public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCourseLayoutBinding, SparringCoursePresenter> implements SparringCourseContract.SparringCourseView, View.OnClickListener {
|
|
- private String currentCourseFilterStatus = CourseFilterConstants.COURSE_FILTER_ALL;
|
|
|
|
|
|
+ private String currentCourseFilterStatus = CourseConstants.COURSE_FILTER_ALL;
|
|
private String currentFilterDate;
|
|
private String currentFilterDate;
|
|
private Date currentSelectDate;
|
|
private Date currentSelectDate;
|
|
private int currentSubjectId;
|
|
private int currentSubjectId;
|
|
@@ -75,10 +74,10 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
|
|
|
|
private void buildDefaultCourseStatusFilterList() {
|
|
private void buildDefaultCourseStatusFilterList() {
|
|
mCourseFilterStatusBeans = new ArrayList<>();
|
|
mCourseFilterStatusBeans = new ArrayList<>();
|
|
- mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseFilterConstants.COURSE_FILTER_ALL, "全部"));
|
|
|
|
- mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseFilterConstants.COURSE_FILTER_HAS_NOT_STARTED, "未开始"));
|
|
|
|
- mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseFilterConstants.COURSE_FILTER_IN_PROGRESS, "进行中"));
|
|
|
|
- mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseFilterConstants.COURSE_FILTER_COMPLETED, "已结束"));
|
|
|
|
|
|
+ mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseConstants.COURSE_FILTER_ALL, "全部"));
|
|
|
|
+ mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseConstants.COURSE_FILTER_HAS_NOT_STARTED, "未开始"));
|
|
|
|
+ mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseConstants.COURSE_FILTER_IN_PROGRESS, "进行中"));
|
|
|
|
+ mCourseFilterStatusBeans.add(new CourseFilterStatusBean(CourseConstants.COURSE_FILTER_COMPLETED, "已结束"));
|
|
}
|
|
}
|
|
|
|
|
|
private void reBuildFilter(Date date, String status) {
|
|
private void reBuildFilter(Date date, String status) {
|
|
@@ -89,7 +88,7 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
currentFilterDate = targetDateTimeStr;
|
|
currentFilterDate = targetDateTimeStr;
|
|
- currentCourseFilterStatus = !TextUtils.isEmpty(status) ? status : CourseFilterConstants.COURSE_FILTER_ALL;
|
|
|
|
|
|
+ currentCourseFilterStatus = !TextUtils.isEmpty(status) ? status : CourseConstants.COURSE_FILTER_ALL;
|
|
currentPage = 1;
|
|
currentPage = 1;
|
|
mViewBinding.tvTime.setText(currentFilterDate);
|
|
mViewBinding.tvTime.setText(currentFilterDate);
|
|
queryCourse(true);
|
|
queryCourse(true);
|
|
@@ -115,10 +114,21 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
queryCourse(false);
|
|
queryCourse(false);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ 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).navigation();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
|
mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
|
mViewBinding.recyclerView.setAdapter(mAdapter);
|
|
mViewBinding.recyclerView.setAdapter(mAdapter);
|
|
buildDefaultCourseStatusFilterList();
|
|
buildDefaultCourseStatusFilterList();
|
|
- reBuildFilter(null, CourseFilterConstants.COURSE_FILTER_ALL);
|
|
|
|
|
|
+ reBuildFilter(null, CourseConstants.COURSE_FILTER_ALL);
|
|
}
|
|
}
|
|
|
|
|
|
private void queryCourse(boolean isShowLoading) {
|
|
private void queryCourse(boolean isShowLoading) {
|
|
@@ -127,7 +137,7 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
|
|
LogUtils.i("pq", "currentCourseFilterStatus:" + currentCourseFilterStatus);
|
|
LogUtils.i("pq", "currentCourseFilterStatus:" + currentCourseFilterStatus);
|
|
LogUtils.i("pq", "currentSubjectId:" + currentSubjectId);
|
|
LogUtils.i("pq", "currentSubjectId:" + currentSubjectId);
|
|
LogUtils.i("pq", "currentPage:" + currentPage);
|
|
LogUtils.i("pq", "currentPage:" + currentPage);
|
|
- presenter.querySparringCourse(isShowLoading,currentFilterDate, currentCourseFilterStatus, currentSubjectId, currentPage);
|
|
|
|
|
|
+ presenter.querySparringCourse(isShowLoading, currentFilterDate, currentCourseFilterStatus, currentSubjectId, currentPage);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|