|
@@ -1,9 +1,9 @@
|
|
|
package com.cooleshow.teacher.ui.comment;
|
|
|
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.graphics.Color;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
-import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
@@ -11,34 +11,41 @@ import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
|
|
import com.bigkoo.pickerview.listener.CustomListener;
|
|
|
import com.bigkoo.pickerview.view.TimePickerView;
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
-import com.chad.library.adapter.base.listener.OnItemClickListener;
|
|
|
-import com.chad.library.adapter.base.listener.OnLoadMoreListener;
|
|
|
import com.cooleshow.base.constanst.Constants;
|
|
|
+import com.cooleshow.base.constanst.CourseType;
|
|
|
+import com.cooleshow.base.interfaces.IFilterViewData;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
|
import com.cooleshow.base.utils.TimeUtils;
|
|
|
+import com.cooleshow.base.utils.UiUtils;
|
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
|
+import com.cooleshow.base.widgets.dialog.CommonFilterDialog;
|
|
|
import com.cooleshow.teacher.R;
|
|
|
import com.cooleshow.teacher.adapter.CourseCommentNotReplyAdapter;
|
|
|
+import com.cooleshow.teacher.adapter.ReceivedCommentListAdapter;
|
|
|
import com.cooleshow.teacher.bean.CourseCommentListBean;
|
|
|
+import com.cooleshow.teacher.bean.ReceivedCommentListBean;
|
|
|
+import com.cooleshow.teacher.constants.CommentType;
|
|
|
import com.cooleshow.teacher.contract.CourseCommentContract;
|
|
|
+import com.cooleshow.teacher.contract.ReceivedCommentContract;
|
|
|
import com.cooleshow.teacher.databinding.FragmentCourseCommentNoReplyLayoutBinding;
|
|
|
+import com.cooleshow.teacher.databinding.FragmentCourseReceivedCommentLayoutBinding;
|
|
|
import com.cooleshow.teacher.presenter.comment.CourseCommentPresenter;
|
|
|
-import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
|
|
-import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
|
|
+import com.cooleshow.teacher.presenter.comment.ReceivedCommentPresenter;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
-import androidx.annotation.NonNull;
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
|
|
|
/**
|
|
|
* Author by pq, Date on 2022/5/5.
|
|
|
- * 陪练课评价-未评价学生
|
|
|
+ * 课后评价-我的评价
|
|
|
*/
|
|
|
-public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourseCommentNoReplyLayoutBinding, CourseCommentPresenter> implements CourseCommentContract.CourseCommentView, View.OnClickListener {
|
|
|
- public int courseCommentNotReply = 0;//未回复
|
|
|
+public class ReceivedCommentFragment extends BaseMVPFragment<FragmentCourseReceivedCommentLayoutBinding, ReceivedCommentPresenter> implements ReceivedCommentContract.ReceivedCommentView, View.OnClickListener {
|
|
|
private TimePickerView pvTime;
|
|
|
private Date currentSelectDate;
|
|
|
private String currentFilterDate;
|
|
@@ -46,16 +53,20 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
private int currentPage = 1;
|
|
|
private EmptyViewLayout mEmptyView;
|
|
|
private boolean hasNext = true;
|
|
|
- private CourseCommentNotReplyAdapter mAdapter;
|
|
|
+ private ReceivedCommentListAdapter mAdapter;
|
|
|
+ private List<IFilterViewData> attendanceStatusList;//课程筛选
|
|
|
+ private int currentSelectAttendancePosition = 0;
|
|
|
+ private String courseType;
|
|
|
+ private CommonFilterDialog mCourseTypeFilterDialog;
|
|
|
|
|
|
@Override
|
|
|
- protected FragmentCourseCommentNoReplyLayoutBinding getLayoutView() {
|
|
|
- return FragmentCourseCommentNoReplyLayoutBinding.inflate(getLayoutInflater());
|
|
|
+ protected FragmentCourseReceivedCommentLayoutBinding getLayoutView() {
|
|
|
+ return FragmentCourseReceivedCommentLayoutBinding.inflate(getLayoutInflater());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- protected CourseCommentPresenter createPresenter() {
|
|
|
- return new CourseCommentPresenter();
|
|
|
+ protected ReceivedCommentPresenter createPresenter() {
|
|
|
+ return new ReceivedCommentPresenter();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -65,23 +76,32 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
|
|
|
@Override
|
|
|
protected void initData() {
|
|
|
+ initFilterData();
|
|
|
currentSelectDate = TimeUtils.getNowDate();
|
|
|
- mAdapter = new CourseCommentNotReplyAdapter(R.layout.item_course_comment_list_layout);
|
|
|
+ mAdapter = new ReceivedCommentListAdapter(R.layout.item_received_comment_layout);
|
|
|
mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
|
mViewBinding.recyclerView.setAdapter(mAdapter);
|
|
|
initListener();
|
|
|
reBuildFilter(currentSelectDate, currentStudentName);
|
|
|
+ currentPage = 1;
|
|
|
+ queryComment(false);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onResume() {
|
|
|
super.onResume();
|
|
|
- currentPage = 1;
|
|
|
- queryComment(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initFilterData() {
|
|
|
+ attendanceStatusList = new ArrayList<>();
|
|
|
+ attendanceStatusList.add(CourseType.ALL);
|
|
|
+ attendanceStatusList.add(CourseType.VIP);
|
|
|
+ attendanceStatusList.add(CourseType.PRACTICE);
|
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
|
- mViewBinding.tvDate.setOnClickListener(this);
|
|
|
+ mViewBinding.tvTime.setOnClickListener(this);
|
|
|
+ mViewBinding.tvAgency.setOnClickListener(this);
|
|
|
mViewBinding.tvSearch.setOnClickListener(this);
|
|
|
mViewBinding.refreshLayout.setOnRefreshListener(refreshLayout -> {
|
|
|
currentPage = 1;
|
|
@@ -89,8 +109,8 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
});
|
|
|
mAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
if (position < mAdapter.getData().size()) {
|
|
|
- CourseCommentListBean.RowsBean rowsBean = mAdapter.getData().get(position);
|
|
|
- startDetailActivity(rowsBean);
|
|
|
+ ReceivedCommentListBean.RowsBean rowsBean = mAdapter.getData().get(position);
|
|
|
+// startDetailActivity(rowsBean);
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -116,7 +136,6 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
.withString(CourseCommentDetailActivity.COURSE_GROUP_ID, rowsBean.courseGoupId)
|
|
|
.withString(CourseCommentDetailActivity.STUDENT_ID, rowsBean.userId)
|
|
|
.navigation();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -134,11 +153,11 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
}
|
|
|
currentStudentName = targetStr;
|
|
|
currentFilterDate = targetDateTimeStr;
|
|
|
- mViewBinding.tvDate.setText(currentFilterDate);
|
|
|
+ mViewBinding.tvTime.setText(currentFilterDate);
|
|
|
}
|
|
|
|
|
|
private void queryComment(boolean isShowLoading) {
|
|
|
- presenter.queryCourseCommentList(isShowLoading, courseCommentNotReply, currentFilterDate, currentStudentName, currentPage);
|
|
|
+ presenter.queryReceivedComment(isShowLoading, currentFilterDate, currentStudentName, courseType, currentPage);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -152,27 +171,27 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
currentPage = 1;
|
|
|
queryComment(true);
|
|
|
}).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();
|
|
|
- }
|
|
|
- });
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
.setTextColorOut(getResources().getColor(com.cooleshow.base.R.color.color_aaaaaa))
|
|
|
.setDividerColor(Color.TRANSPARENT)
|
|
|
.setBgColor(Color.TRANSPARENT)
|
|
@@ -193,12 +212,18 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- if (v.getId() == R.id.tv_date) {
|
|
|
+ int id = v.getId();
|
|
|
+ if (id == R.id.tv_time) {
|
|
|
//显示时间选择器
|
|
|
showTimeSelectPicker();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (id == R.id.tv_agency) {
|
|
|
+ selectAttendanceStatus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (v.getId() == R.id.tv_search) {
|
|
|
//搜索
|
|
|
String targetName = mViewBinding.etTargetName.getText().toString();
|
|
@@ -208,8 +233,58 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void selectAttendanceStatus() {
|
|
|
+ if (mCourseTypeFilterDialog == null) {
|
|
|
+ mCourseTypeFilterDialog = new CommonFilterDialog<IFilterViewData>(getContext());
|
|
|
+ mCourseTypeFilterDialog.setOnEventListener(new CommonFilterDialog.OnEventListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClickListener(BaseQuickAdapter baseQuickAdapter, int pos) {
|
|
|
+ if (attendanceStatusList != null && pos < attendanceStatusList.size()) {
|
|
|
+ ReceivedCommentFragment.this.currentSelectAttendancePosition = pos;
|
|
|
+ IFilterViewData iFilterViewData = attendanceStatusList.get(pos);
|
|
|
+ courseType = iFilterViewData.getDataId();
|
|
|
+ mViewBinding.tvAgency.setText(iFilterViewData.getShowName());
|
|
|
+ queryComment(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mCourseTypeFilterDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss(DialogInterface dialog) {
|
|
|
+ UiUtils.refreshFilterTextStyle(false, mViewBinding.tvAgency);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!mCourseTypeFilterDialog.isShowing()) {
|
|
|
+ mCourseTypeFilterDialog.show();
|
|
|
+ UiUtils.refreshFilterTextStyle(true, mViewBinding.tvAgency);
|
|
|
+ }
|
|
|
+ mCourseTypeFilterDialog.setSelectPos(currentSelectAttendancePosition);
|
|
|
+ mCourseTypeFilterDialog.setData(attendanceStatusList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查是否还有下一页
|
|
|
+ *
|
|
|
+ * @param dataSize
|
|
|
+ */
|
|
|
+ private void checkHasNext(int dataSize) {
|
|
|
+ hasNext = dataSize >= Constants.DEFAULT_DATA_SIZE;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showEmptyView() {
|
|
|
+ if (mEmptyView == null) {
|
|
|
+ mEmptyView = new EmptyViewLayout(getContext());
|
|
|
+ }
|
|
|
+ mEmptyView.setContent(com.cooleshow.base.R.drawable.icon_empty_content, "暂无内容~");
|
|
|
+ mAdapter.setEmptyView(mEmptyView);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
- public void queryCourseCommentSuccess(int page, CourseCommentListBean commentListBean) {
|
|
|
+ public void queryCommentSuccess(int page, ReceivedCommentListBean commentListBean) {
|
|
|
if (isDetached()) {
|
|
|
return;
|
|
|
}
|
|
@@ -242,25 +317,8 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 检查是否还有下一页
|
|
|
- *
|
|
|
- * @param dataSize
|
|
|
- */
|
|
|
- private void checkHasNext(int dataSize) {
|
|
|
- hasNext = dataSize >= Constants.DEFAULT_DATA_SIZE;
|
|
|
- }
|
|
|
-
|
|
|
- private void showEmptyView() {
|
|
|
- if (mEmptyView == null) {
|
|
|
- mEmptyView = new EmptyViewLayout(getContext());
|
|
|
- }
|
|
|
- mEmptyView.setContent(com.cooleshow.base.R.drawable.icon_empty_content, "暂无内容~");
|
|
|
- mAdapter.setEmptyView(mEmptyView);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
- public void queryCourseCommentError(int page) {
|
|
|
+ public void queryCommentError(int page) {
|
|
|
if (isDetached()) {
|
|
|
return;
|
|
|
}
|