|  | @@ -1,387 +1,387 @@
 | 
	
		
			
				|  |  | -package com.cooleshow.student.ui.course;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import android.annotation.SuppressLint;
 | 
	
		
			
				|  |  | -import android.graphics.Color;
 | 
	
		
			
				|  |  | -import android.text.TextUtils;
 | 
	
		
			
				|  |  | -import android.view.LayoutInflater;
 | 
	
		
			
				|  |  | -import android.view.View;
 | 
	
		
			
				|  |  | -import android.view.ViewGroup;
 | 
	
		
			
				|  |  | -import android.widget.ImageView;
 | 
	
		
			
				|  |  | -import android.widget.PopupWindow;
 | 
	
		
			
				|  |  | -import android.widget.TextView;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import androidx.annotation.NonNull;
 | 
	
		
			
				|  |  | -import androidx.recyclerview.widget.LinearLayoutManager;
 | 
	
		
			
				|  |  | -import androidx.recyclerview.widget.RecyclerView;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import com.alibaba.android.arouter.launcher.ARouter;
 | 
	
		
			
				|  |  | -import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 | 
	
		
			
				|  |  | -import com.bigkoo.pickerview.builder.TimePickerBuilder;
 | 
	
		
			
				|  |  | -import com.bigkoo.pickerview.listener.CustomListener;
 | 
	
		
			
				|  |  | -import com.bigkoo.pickerview.listener.OnDismissListener;
 | 
	
		
			
				|  |  | -import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
 | 
	
		
			
				|  |  | -import com.bigkoo.pickerview.view.OptionsPickerView;
 | 
	
		
			
				|  |  | -import com.bigkoo.pickerview.view.TimePickerView;
 | 
	
		
			
				|  |  | -import com.chad.library.adapter.base.BaseQuickAdapter;
 | 
	
		
			
				|  |  | -import com.chad.library.adapter.base.listener.OnItemChildClickListener;
 | 
	
		
			
				|  |  | -import com.chad.library.adapter.base.listener.OnItemClickListener;
 | 
	
		
			
				|  |  | -import com.chad.library.adapter.base.listener.OnLoadMoreListener;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.common.WebConstants;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.constanst.Constants;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.router.RouterPath;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.ui.fragment.BaseMVPFragment;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.utils.LogUtils;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.utils.PopupUtil;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.utils.TimeUtils;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.utils.UiUtils;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.widgets.EmptyViewLayout;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import com.cooleshow.base.widgets.poplist.PopMenuBean;
 | 
	
		
			
				|  |  | -import com.cooleshow.base.widgets.poplist.PopupListWindow;
 | 
	
		
			
				|  |  | -import com.cooleshow.chatmodule.utils.helper.ChatHelper;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.R;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.adapter.CourseStatusFilterAdapter;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.adapter.LiveCourseListAdapter;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.bean.CourseFilterStatusBean;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.bean.LiveCourseListBean;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.bean.QuerySubjectBean;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.constants.CourseConstants;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.contract.LiveCourseContract;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.databinding.FragmentLiveCourseLayoutBinding;
 | 
	
		
			
				|  |  | -import com.cooleshow.student.presenter.course.LiveCoursePresenter;
 | 
	
		
			
				|  |  | -import com.scwang.smart.refresh.layout.api.RefreshLayout;
 | 
	
		
			
				|  |  | -import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import java.util.ArrayList;
 | 
	
		
			
				|  |  | -import java.util.Calendar;
 | 
	
		
			
				|  |  | -import java.util.Date;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -/**
 | 
	
		
			
				|  |  | - * Author by pq, Date on 2022/4/25.
 | 
	
		
			
				|  |  | - */
 | 
	
		
			
				|  |  | -public class LiveCourseFragment extends BaseMVPFragment<FragmentLiveCourseLayoutBinding, LiveCoursePresenter> implements LiveCourseContract.LiveCourseView, View.OnClickListener {
 | 
	
		
			
				|  |  | -    private String currentCourseFilterStatus = CourseConstants.COURSE_FILTER_ALL;
 | 
	
		
			
				|  |  | -    private String currentFilterDate;
 | 
	
		
			
				|  |  | -    private Date currentSelectDate;
 | 
	
		
			
				|  |  | -    private int currentSubjectId;
 | 
	
		
			
				|  |  | -    private int currentPage;
 | 
	
		
			
				|  |  | -    private LiveCourseListAdapter mAdapter;
 | 
	
		
			
				|  |  | -    private EmptyViewLayout mEmptyView;
 | 
	
		
			
				|  |  | -    private TimePickerView pvTime;
 | 
	
		
			
				|  |  | -    private ArrayList<CourseFilterStatusBean> mCourseFilterStatusBeans;
 | 
	
		
			
				|  |  | -    private List<QuerySubjectBean> subjectBeanList = new ArrayList<>();
 | 
	
		
			
				|  |  | -    private boolean hasNext = true;
 | 
	
		
			
				|  |  | -    private boolean isFirstLoad = true;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    public static LiveCourseFragment newInstance() {
 | 
	
		
			
				|  |  | -        LiveCourseFragment fragment = new LiveCourseFragment();
 | 
	
		
			
				|  |  | -        return fragment;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    protected FragmentLiveCourseLayoutBinding getLayoutView() {
 | 
	
		
			
				|  |  | -        return FragmentLiveCourseLayoutBinding.inflate(getLayoutInflater());
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    protected LiveCoursePresenter createPresenter() {
 | 
	
		
			
				|  |  | -        return new LiveCoursePresenter();
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    protected void initView(View rootView) {
 | 
	
		
			
				|  |  | -        mViewBinding.tvTime.setOnClickListener(this);
 | 
	
		
			
				|  |  | -        mViewBinding.tvCourseStatus.setOnClickListener(this);
 | 
	
		
			
				|  |  | -        mViewBinding.tvAgency.setOnClickListener(this);
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    public void onResume() {
 | 
	
		
			
				|  |  | -        super.onResume();
 | 
	
		
			
				|  |  | -        if (isFirstLoad) {
 | 
	
		
			
				|  |  | -            isFirstLoad = false;
 | 
	
		
			
				|  |  | -            reBuildFilter(null, CourseConstants.COURSE_FILTER_ALL);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    public void refreshData() {
 | 
	
		
			
				|  |  | -        super.refreshData();
 | 
	
		
			
				|  |  | -        reBuildFilter(currentSelectDate, currentCourseFilterStatus);
 | 
	
		
			
				|  |  | -        isFirstLoad = false;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private void buildDefaultCourseStatusFilterList() {
 | 
	
		
			
				|  |  | -        mCourseFilterStatusBeans = new ArrayList<>();
 | 
	
		
			
				|  |  | -        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) {
 | 
	
		
			
				|  |  | -        currentSelectDate = date != null ? date : TimeUtils.getNowDate();
 | 
	
		
			
				|  |  | -        String targetDateTimeStr = TimeUtils.date2String(currentSelectDate, TimeUtils.getSafeDateFormat("yyyy-MM"));
 | 
	
		
			
				|  |  | -        if (TextUtils.equals(targetDateTimeStr, currentFilterDate) && TextUtils.equals(currentCourseFilterStatus, status)) {
 | 
	
		
			
				|  |  | -            //防止重复条件触发
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        currentFilterDate = targetDateTimeStr;
 | 
	
		
			
				|  |  | -        currentCourseFilterStatus = !TextUtils.isEmpty(status) ? status : CourseConstants.COURSE_FILTER_ALL;
 | 
	
		
			
				|  |  | -        currentPage = 1;
 | 
	
		
			
				|  |  | -        mViewBinding.tvTime.setText(currentFilterDate);
 | 
	
		
			
				|  |  | -        queryCourse(true);
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    protected void initData() {
 | 
	
		
			
				|  |  | -        mViewBinding.refreshLayout.setOnRefreshListener(refreshLayout -> {
 | 
	
		
			
				|  |  | -            currentPage = 1;
 | 
	
		
			
				|  |  | -            queryCourse(true);
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        mAdapter = new LiveCourseListAdapter(R.layout.item_live_course_list_layout);
 | 
	
		
			
				|  |  | -        mAdapter.getLoadMoreModule().setOnLoadMoreListener(() -> {
 | 
	
		
			
				|  |  | -            //上拉加载
 | 
	
		
			
				|  |  | -            if (hasNext) {
 | 
	
		
			
				|  |  | -                currentPage++;
 | 
	
		
			
				|  |  | -                queryCourse(false);
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                mAdapter.getLoadMoreModule().loadMoreEnd();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | -        mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
 | 
	
		
			
				|  |  | -        mViewBinding.recyclerView.setAdapter(mAdapter);
 | 
	
		
			
				|  |  | -        buildDefaultCourseStatusFilterList();
 | 
	
		
			
				|  |  | -        mAdapter.setOnItemClickListener((adapter, view, position) -> {
 | 
	
		
			
				|  |  | -            LiveCourseListBean.RowsBean item = (LiveCourseListBean.RowsBean) adapter.getItem(position);
 | 
	
		
			
				|  |  | -            ARouter.getInstance()
 | 
	
		
			
				|  |  | -                    .build(RouterPath.WebCenter.ACTIVITY_HTML)
 | 
	
		
			
				|  |  | -                    .withString(WebConstants.WEB_URL, String.format(WebConstants.TEACHER_LIVE_DETAIL_NORMAL_COURSE, item.courseGoupId, item.courseId))
 | 
	
		
			
				|  |  | -                    .navigation();
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        mAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
 | 
	
		
			
				|  |  | -            @Override
 | 
	
		
			
				|  |  | -            public void onItemChildClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
 | 
	
		
			
				|  |  | -                int id = view.getId();
 | 
	
		
			
				|  |  | -                if (id == R.id.iv_chat) {
 | 
	
		
			
				|  |  | -                    LiveCourseListBean.RowsBean item = (LiveCourseListBean.RowsBean) adapter.getItem(position);
 | 
	
		
			
				|  |  | -                    if (item != null) {
 | 
	
		
			
				|  |  | -                        ChatHelper.getInstance().goGroupChat(item.imGroupId, "");
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private void queryCourse(boolean isShowLoading) {
 | 
	
		
			
				|  |  | -        //根据默认筛选条件查询
 | 
	
		
			
				|  |  | -        LogUtils.i("pq", "currentFilterDate:" + currentFilterDate);
 | 
	
		
			
				|  |  | -        LogUtils.i("pq", "currentCourseFilterStatus:" + currentCourseFilterStatus);
 | 
	
		
			
				|  |  | -        LogUtils.i("pq", "currentSubjectId:" + currentSubjectId);
 | 
	
		
			
				|  |  | -        LogUtils.i("pq", "currentPage:" + currentPage);
 | 
	
		
			
				|  |  | -        presenter.queryLiveCourse(isShowLoading, currentFilterDate, currentCourseFilterStatus, currentSubjectId, currentPage);
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private void checkHasNext(int dataSize) {
 | 
	
		
			
				|  |  | -        hasNext = dataSize >= Constants.DEFAULT_DATA_SIZE;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @SuppressLint("NotifyDataSetChanged")
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    public void onGetLiveCourseSuccess(int page, LiveCourseListBean liveCourseListBean) {
 | 
	
		
			
				|  |  | -        if (isDetached()) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if (liveCourseListBean != null) {
 | 
	
		
			
				|  |  | -            if (page == 1) {
 | 
	
		
			
				|  |  | -                //第一页
 | 
	
		
			
				|  |  | -                mViewBinding.refreshLayout.finishRefresh();
 | 
	
		
			
				|  |  | -                if (mAdapter != null) {
 | 
	
		
			
				|  |  | -                    mAdapter.getData().clear();
 | 
	
		
			
				|  |  | -                    mAdapter.notifyDataSetChanged();
 | 
	
		
			
				|  |  | -                    if (liveCourseListBean.rows != null && liveCourseListBean.rows.size() > 0) {
 | 
	
		
			
				|  |  | -                        checkHasNext(liveCourseListBean.rows.size());
 | 
	
		
			
				|  |  | -                        mAdapter.setNewInstance(liveCourseListBean.rows);
 | 
	
		
			
				|  |  | -                    } else {
 | 
	
		
			
				|  |  | -                        showEmptyView();
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                //加载更多
 | 
	
		
			
				|  |  | -                if (mAdapter != null) {
 | 
	
		
			
				|  |  | -                    if (liveCourseListBean.rows != null && liveCourseListBean.rows.size() > 0) {
 | 
	
		
			
				|  |  | -                        mAdapter.getLoadMoreModule().loadMoreComplete();
 | 
	
		
			
				|  |  | -                        checkHasNext(liveCourseListBean.rows.size());
 | 
	
		
			
				|  |  | -                        mAdapter.addData(liveCourseListBean.rows);
 | 
	
		
			
				|  |  | -                    } else {
 | 
	
		
			
				|  |  | -                        mAdapter.getLoadMoreModule().loadMoreEnd();
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    public void onGetCourseError(int page) {
 | 
	
		
			
				|  |  | -        if (isDetached()) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if (page == 1) {
 | 
	
		
			
				|  |  | -            mViewBinding.refreshLayout.finishRefresh();
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -            if (mAdapter != null) {
 | 
	
		
			
				|  |  | -                currentPage--;
 | 
	
		
			
				|  |  | -                mAdapter.getLoadMoreModule().loadMoreFail();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private void showEmptyView() {
 | 
	
		
			
				|  |  | -        if (mEmptyView == null) {
 | 
	
		
			
				|  |  | -            mEmptyView = new EmptyViewLayout(getContext());
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        mEmptyView.setContent(com.cooleshow.base.R.drawable.icon_empty_course, "暂无课程~");
 | 
	
		
			
				|  |  | -        mAdapter.setEmptyView(mEmptyView);
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private void showTimeSelectPicker() {
 | 
	
		
			
				|  |  | -        if (pvTime == null) {
 | 
	
		
			
				|  |  | -            pvTime = new TimePickerBuilder(requireContext(), (date, v) -> {//选中事件回调
 | 
	
		
			
				|  |  | -                reBuildFilter(date, currentCourseFilterStatus);
 | 
	
		
			
				|  |  | -            }).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(v12 -> {
 | 
	
		
			
				|  |  | -                            pvTime.returnData();
 | 
	
		
			
				|  |  | -                            pvTime.dismiss();
 | 
	
		
			
				|  |  | -                        });
 | 
	
		
			
				|  |  | -                        ivCancel.setOnClickListener(v1 -> pvTime.dismiss());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                    }).setTextColorOut(getResources().getColor(com.cooleshow.base.R.color.color_aaaaaa))
 | 
	
		
			
				|  |  | -                    .setDividerColor(Color.TRANSPARENT)
 | 
	
		
			
				|  |  | -                    .setBgColor(Color.TRANSPARENT)
 | 
	
		
			
				|  |  | -                    .setLineSpacingMultiplier(2.5f)
 | 
	
		
			
				|  |  | -                    .setType(new boolean[]{true, true, false, false, false, false})// 默认全部显示
 | 
	
		
			
				|  |  | -                    .setTextColorCenter(getResources().getColor(com.cooleshow.base.R.color.color_1a1a1a))//设置选中项的颜色
 | 
	
		
			
				|  |  | -                    .isDialog(false)//是否显示为对话框样式
 | 
	
		
			
				|  |  | -                    .setLabel("年", "月", "", "", "", "")
 | 
	
		
			
				|  |  | -                    .build();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            pvTime.setOnDismissListener(new OnDismissListener() {
 | 
	
		
			
				|  |  | -                @Override
 | 
	
		
			
				|  |  | -                public void onDismiss(Object o) {
 | 
	
		
			
				|  |  | -                    UiUtils.refreshFilterTextStyle2(false, mViewBinding.tvTime);
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                @Override
 | 
	
		
			
				|  |  | -                public void onShow() {
 | 
	
		
			
				|  |  | -                    UiUtils.refreshFilterTextStyle2(true, mViewBinding.tvTime);
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  | -        calendar.setTime(currentSelectDate);
 | 
	
		
			
				|  |  | -        pvTime.setDate(calendar);
 | 
	
		
			
				|  |  | -        if (!pvTime.isShowing()) {
 | 
	
		
			
				|  |  | -            pvTime.show();
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    public void onClick(View v) {
 | 
	
		
			
				|  |  | -        if (v.getId() == R.id.tv_time) {
 | 
	
		
			
				|  |  | -            //时间筛选
 | 
	
		
			
				|  |  | -            showTimeSelectPicker();
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if (v.getId() == 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);
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -            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;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private void initCoursePop(TextView targetView, List<PopMenuBean> popList, PopupListWindow.PopupListListener listener) {
 | 
	
		
			
				|  |  | -        PopupListWindow popWindow = new PopupListWindow(getContext());
 | 
	
		
			
				|  |  | -        popWindow.showListPop(targetView, popList, position -> listener.onPopupListClick(position));
 | 
	
		
			
				|  |  | -        UiUtils.refreshFilterTextStyle2(true, targetView);
 | 
	
		
			
				|  |  | -        popWindow.getPopupWindow().setOnDismissListener(new PopupWindow.OnDismissListener() {
 | 
	
		
			
				|  |  | -            @Override
 | 
	
		
			
				|  |  | -            public void onDismiss() {
 | 
	
		
			
				|  |  | -                UiUtils.refreshFilterTextStyle2(false, targetView);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
 | 
	
		
			
				|  |  | -        subjectBeanList.clear();
 | 
	
		
			
				|  |  | -        subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
 | 
	
		
			
				|  |  | -        subjectBeanList.addAll(data);
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private OptionsPickerView pvOptions;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    private void selectSubject() {
 | 
	
		
			
				|  |  | -        if (subjectBeanList.size() == 0) {
 | 
	
		
			
				|  |  | -            subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
 | 
	
		
			
				|  |  | -            currentSubjectId = subjectBeanList.get(options1).id;
 | 
	
		
			
				|  |  | -            mViewBinding.tvAgency.setText(subjectBeanList.get(options1).name);
 | 
	
		
			
				|  |  | -            queryCourse(true);
 | 
	
		
			
				|  |  | -        }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_address_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(v12 -> {
 | 
	
		
			
				|  |  | -                pvOptions.returnData();
 | 
	
		
			
				|  |  | -                pvOptions.dismiss();
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -            ivCancel.setOnClickListener(v1 -> pvOptions.dismiss());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        }).setTextColorOut(getResources().getColor(com.cooleshow.base.R.color.color_aaaaaa))
 | 
	
		
			
				|  |  | -                .setDividerColor(Color.TRANSPARENT)
 | 
	
		
			
				|  |  | -                .setBgColor(Color.TRANSPARENT).isDialog(false).build();
 | 
	
		
			
				|  |  | -        pvOptions.setPicker(subjectBeanList);
 | 
	
		
			
				|  |  | -        pvOptions.show();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | +//package com.cooleshow.student.ui.course;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//import android.annotation.SuppressLint;
 | 
	
		
			
				|  |  | +//import android.graphics.Color;
 | 
	
		
			
				|  |  | +//import android.text.TextUtils;
 | 
	
		
			
				|  |  | +//import android.view.LayoutInflater;
 | 
	
		
			
				|  |  | +//import android.view.View;
 | 
	
		
			
				|  |  | +//import android.view.ViewGroup;
 | 
	
		
			
				|  |  | +//import android.widget.ImageView;
 | 
	
		
			
				|  |  | +//import android.widget.PopupWindow;
 | 
	
		
			
				|  |  | +//import android.widget.TextView;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//import androidx.annotation.NonNull;
 | 
	
		
			
				|  |  | +//import androidx.recyclerview.widget.LinearLayoutManager;
 | 
	
		
			
				|  |  | +//import androidx.recyclerview.widget.RecyclerView;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//import com.alibaba.android.arouter.launcher.ARouter;
 | 
	
		
			
				|  |  | +//import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 | 
	
		
			
				|  |  | +//import com.bigkoo.pickerview.builder.TimePickerBuilder;
 | 
	
		
			
				|  |  | +//import com.bigkoo.pickerview.listener.CustomListener;
 | 
	
		
			
				|  |  | +//import com.bigkoo.pickerview.listener.OnDismissListener;
 | 
	
		
			
				|  |  | +//import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
 | 
	
		
			
				|  |  | +//import com.bigkoo.pickerview.view.OptionsPickerView;
 | 
	
		
			
				|  |  | +//import com.bigkoo.pickerview.view.TimePickerView;
 | 
	
		
			
				|  |  | +//import com.chad.library.adapter.base.BaseQuickAdapter;
 | 
	
		
			
				|  |  | +//import com.chad.library.adapter.base.listener.OnItemChildClickListener;
 | 
	
		
			
				|  |  | +//import com.chad.library.adapter.base.listener.OnItemClickListener;
 | 
	
		
			
				|  |  | +//import com.chad.library.adapter.base.listener.OnLoadMoreListener;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.common.WebConstants;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.constanst.Constants;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.router.RouterPath;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.ui.fragment.BaseMVPFragment;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.utils.LogUtils;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.utils.PopupUtil;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.utils.TimeUtils;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.utils.UiUtils;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.widgets.EmptyViewLayout;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.widgets.poplist.PopMenuBean;
 | 
	
		
			
				|  |  | +//import com.cooleshow.base.widgets.poplist.PopupListWindow;
 | 
	
		
			
				|  |  | +//import com.cooleshow.chatmodule.utils.helper.ChatHelper;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.R;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.adapter.CourseStatusFilterAdapter;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.adapter.LiveCourseListAdapter;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.bean.CourseFilterStatusBean;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.bean.LiveCourseListBean;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.bean.QuerySubjectBean;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.constants.CourseConstants;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.contract.LiveCourseContract;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.databinding.FragmentLiveCourseLayoutBinding;
 | 
	
		
			
				|  |  | +//import com.cooleshow.student.presenter.course.LiveCoursePresenter;
 | 
	
		
			
				|  |  | +//import com.scwang.smart.refresh.layout.api.RefreshLayout;
 | 
	
		
			
				|  |  | +//import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//import java.util.ArrayList;
 | 
	
		
			
				|  |  | +//import java.util.Calendar;
 | 
	
		
			
				|  |  | +//import java.util.Date;
 | 
	
		
			
				|  |  | +//import java.util.List;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +///**
 | 
	
		
			
				|  |  | +// * Author by pq, Date on 2022/4/25.
 | 
	
		
			
				|  |  | +// */
 | 
	
		
			
				|  |  | +//public class LiveCourseFragment extends BaseMVPFragment<FragmentLiveCourseLayoutBinding, LiveCoursePresenter> implements LiveCourseContract.LiveCourseView, View.OnClickListener {
 | 
	
		
			
				|  |  | +//    private String currentCourseFilterStatus = CourseConstants.COURSE_FILTER_ALL;
 | 
	
		
			
				|  |  | +//    private String currentFilterDate;
 | 
	
		
			
				|  |  | +//    private Date currentSelectDate;
 | 
	
		
			
				|  |  | +//    private int currentSubjectId;
 | 
	
		
			
				|  |  | +//    private int currentPage;
 | 
	
		
			
				|  |  | +//    private LiveCourseListAdapter mAdapter;
 | 
	
		
			
				|  |  | +//    private EmptyViewLayout mEmptyView;
 | 
	
		
			
				|  |  | +//    private TimePickerView pvTime;
 | 
	
		
			
				|  |  | +//    private ArrayList<CourseFilterStatusBean> mCourseFilterStatusBeans;
 | 
	
		
			
				|  |  | +//    private List<QuerySubjectBean> subjectBeanList = new ArrayList<>();
 | 
	
		
			
				|  |  | +//    private boolean hasNext = true;
 | 
	
		
			
				|  |  | +//    private boolean isFirstLoad = true;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    public static LiveCourseFragment newInstance() {
 | 
	
		
			
				|  |  | +//        LiveCourseFragment fragment = new LiveCourseFragment();
 | 
	
		
			
				|  |  | +//        return fragment;
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    protected FragmentLiveCourseLayoutBinding getLayoutView() {
 | 
	
		
			
				|  |  | +//        return FragmentLiveCourseLayoutBinding.inflate(getLayoutInflater());
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    protected LiveCoursePresenter createPresenter() {
 | 
	
		
			
				|  |  | +//        return new LiveCoursePresenter();
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    protected void initView(View rootView) {
 | 
	
		
			
				|  |  | +//        mViewBinding.tvTime.setOnClickListener(this);
 | 
	
		
			
				|  |  | +//        mViewBinding.tvCourseStatus.setOnClickListener(this);
 | 
	
		
			
				|  |  | +//        mViewBinding.tvAgency.setOnClickListener(this);
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    public void onResume() {
 | 
	
		
			
				|  |  | +//        super.onResume();
 | 
	
		
			
				|  |  | +//        if (isFirstLoad) {
 | 
	
		
			
				|  |  | +//            isFirstLoad = false;
 | 
	
		
			
				|  |  | +//            reBuildFilter(null, CourseConstants.COURSE_FILTER_ALL);
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    public void refreshData() {
 | 
	
		
			
				|  |  | +//        super.refreshData();
 | 
	
		
			
				|  |  | +//        reBuildFilter(currentSelectDate, currentCourseFilterStatus);
 | 
	
		
			
				|  |  | +//        isFirstLoad = false;
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private void buildDefaultCourseStatusFilterList() {
 | 
	
		
			
				|  |  | +//        mCourseFilterStatusBeans = new ArrayList<>();
 | 
	
		
			
				|  |  | +//        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) {
 | 
	
		
			
				|  |  | +//        currentSelectDate = date != null ? date : TimeUtils.getNowDate();
 | 
	
		
			
				|  |  | +//        String targetDateTimeStr = TimeUtils.date2String(currentSelectDate, TimeUtils.getSafeDateFormat("yyyy-MM"));
 | 
	
		
			
				|  |  | +//        if (TextUtils.equals(targetDateTimeStr, currentFilterDate) && TextUtils.equals(currentCourseFilterStatus, status)) {
 | 
	
		
			
				|  |  | +//            //防止重复条件触发
 | 
	
		
			
				|  |  | +//            return;
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        currentFilterDate = targetDateTimeStr;
 | 
	
		
			
				|  |  | +//        currentCourseFilterStatus = !TextUtils.isEmpty(status) ? status : CourseConstants.COURSE_FILTER_ALL;
 | 
	
		
			
				|  |  | +//        currentPage = 1;
 | 
	
		
			
				|  |  | +//        mViewBinding.tvTime.setText(currentFilterDate);
 | 
	
		
			
				|  |  | +//        queryCourse(true);
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    protected void initData() {
 | 
	
		
			
				|  |  | +//        mViewBinding.refreshLayout.setOnRefreshListener(refreshLayout -> {
 | 
	
		
			
				|  |  | +//            currentPage = 1;
 | 
	
		
			
				|  |  | +//            queryCourse(true);
 | 
	
		
			
				|  |  | +//        });
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//        mAdapter = new LiveCourseListAdapter();
 | 
	
		
			
				|  |  | +//        mAdapter.getLoadMoreModule().setOnLoadMoreListener(() -> {
 | 
	
		
			
				|  |  | +//            //上拉加载
 | 
	
		
			
				|  |  | +//            if (hasNext) {
 | 
	
		
			
				|  |  | +//                currentPage++;
 | 
	
		
			
				|  |  | +//                queryCourse(false);
 | 
	
		
			
				|  |  | +//            } else {
 | 
	
		
			
				|  |  | +//                mAdapter.getLoadMoreModule().loadMoreEnd();
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        });
 | 
	
		
			
				|  |  | +//        mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
 | 
	
		
			
				|  |  | +//        mViewBinding.recyclerView.setAdapter(mAdapter);
 | 
	
		
			
				|  |  | +//        buildDefaultCourseStatusFilterList();
 | 
	
		
			
				|  |  | +//        mAdapter.setOnItemClickListener((adapter, view, position) -> {
 | 
	
		
			
				|  |  | +//            LiveCourseListBean.RowsBean item = (LiveCourseListBean.RowsBean) adapter.getItem(position);
 | 
	
		
			
				|  |  | +//            ARouter.getInstance()
 | 
	
		
			
				|  |  | +//                    .build(RouterPath.WebCenter.ACTIVITY_HTML)
 | 
	
		
			
				|  |  | +//                    .withString(WebConstants.WEB_URL, String.format(WebConstants.TEACHER_LIVE_DETAIL_NORMAL_COURSE, item.courseGoupId, item.courseId))
 | 
	
		
			
				|  |  | +//                    .navigation();
 | 
	
		
			
				|  |  | +//        });
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//        mAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
 | 
	
		
			
				|  |  | +//            @Override
 | 
	
		
			
				|  |  | +//            public void onItemChildClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
 | 
	
		
			
				|  |  | +//                int id = view.getId();
 | 
	
		
			
				|  |  | +//                if (id == R.id.iv_chat) {
 | 
	
		
			
				|  |  | +//                    LiveCourseListBean.RowsBean item = (LiveCourseListBean.RowsBean) adapter.getItem(position);
 | 
	
		
			
				|  |  | +//                    if (item != null) {
 | 
	
		
			
				|  |  | +//                        ChatHelper.getInstance().goGroupChat(item.imGroupId, "");
 | 
	
		
			
				|  |  | +//                    }
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        });
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private void queryCourse(boolean isShowLoading) {
 | 
	
		
			
				|  |  | +//        //根据默认筛选条件查询
 | 
	
		
			
				|  |  | +//        LogUtils.i("pq", "currentFilterDate:" + currentFilterDate);
 | 
	
		
			
				|  |  | +//        LogUtils.i("pq", "currentCourseFilterStatus:" + currentCourseFilterStatus);
 | 
	
		
			
				|  |  | +//        LogUtils.i("pq", "currentSubjectId:" + currentSubjectId);
 | 
	
		
			
				|  |  | +//        LogUtils.i("pq", "currentPage:" + currentPage);
 | 
	
		
			
				|  |  | +//        presenter.queryLiveCourse(isShowLoading, currentFilterDate, currentCourseFilterStatus, currentSubjectId, currentPage);
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private void checkHasNext(int dataSize) {
 | 
	
		
			
				|  |  | +//        hasNext = dataSize >= Constants.DEFAULT_DATA_SIZE;
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @SuppressLint("NotifyDataSetChanged")
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    public void onGetLiveCourseSuccess(int page, LiveCourseListBean liveCourseListBean) {
 | 
	
		
			
				|  |  | +//        if (isDetached()) {
 | 
	
		
			
				|  |  | +//            return;
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        if (liveCourseListBean != null) {
 | 
	
		
			
				|  |  | +//            if (page == 1) {
 | 
	
		
			
				|  |  | +//                //第一页
 | 
	
		
			
				|  |  | +//                mViewBinding.refreshLayout.finishRefresh();
 | 
	
		
			
				|  |  | +//                if (mAdapter != null) {
 | 
	
		
			
				|  |  | +//                    mAdapter.getData().clear();
 | 
	
		
			
				|  |  | +//                    mAdapter.notifyDataSetChanged();
 | 
	
		
			
				|  |  | +//                    if (liveCourseListBean.rows != null && liveCourseListBean.rows.size() > 0) {
 | 
	
		
			
				|  |  | +//                        checkHasNext(liveCourseListBean.rows.size());
 | 
	
		
			
				|  |  | +//                        mAdapter.setNewInstance(liveCourseListBean.rows);
 | 
	
		
			
				|  |  | +//                    } else {
 | 
	
		
			
				|  |  | +//                        showEmptyView();
 | 
	
		
			
				|  |  | +//                    }
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//            } else {
 | 
	
		
			
				|  |  | +//                //加载更多
 | 
	
		
			
				|  |  | +//                if (mAdapter != null) {
 | 
	
		
			
				|  |  | +//                    if (liveCourseListBean.rows != null && liveCourseListBean.rows.size() > 0) {
 | 
	
		
			
				|  |  | +//                        mAdapter.getLoadMoreModule().loadMoreComplete();
 | 
	
		
			
				|  |  | +//                        checkHasNext(liveCourseListBean.rows.size());
 | 
	
		
			
				|  |  | +//                        mAdapter.addData(liveCourseListBean.rows);
 | 
	
		
			
				|  |  | +//                    } else {
 | 
	
		
			
				|  |  | +//                        mAdapter.getLoadMoreModule().loadMoreEnd();
 | 
	
		
			
				|  |  | +//                    }
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    public void onGetCourseError(int page) {
 | 
	
		
			
				|  |  | +//        if (isDetached()) {
 | 
	
		
			
				|  |  | +//            return;
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        if (page == 1) {
 | 
	
		
			
				|  |  | +//            mViewBinding.refreshLayout.finishRefresh();
 | 
	
		
			
				|  |  | +//        } else {
 | 
	
		
			
				|  |  | +//            if (mAdapter != null) {
 | 
	
		
			
				|  |  | +//                currentPage--;
 | 
	
		
			
				|  |  | +//                mAdapter.getLoadMoreModule().loadMoreFail();
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private void showEmptyView() {
 | 
	
		
			
				|  |  | +//        if (mEmptyView == null) {
 | 
	
		
			
				|  |  | +//            mEmptyView = new EmptyViewLayout(getContext());
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        mEmptyView.setContent(com.cooleshow.base.R.drawable.icon_empty_course, "暂无课程~");
 | 
	
		
			
				|  |  | +//        mAdapter.setEmptyView(mEmptyView);
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private void showTimeSelectPicker() {
 | 
	
		
			
				|  |  | +//        if (pvTime == null) {
 | 
	
		
			
				|  |  | +//            pvTime = new TimePickerBuilder(requireContext(), (date, v) -> {//选中事件回调
 | 
	
		
			
				|  |  | +//                reBuildFilter(date, currentCourseFilterStatus);
 | 
	
		
			
				|  |  | +//            }).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(v12 -> {
 | 
	
		
			
				|  |  | +//                            pvTime.returnData();
 | 
	
		
			
				|  |  | +//                            pvTime.dismiss();
 | 
	
		
			
				|  |  | +//                        });
 | 
	
		
			
				|  |  | +//                        ivCancel.setOnClickListener(v1 -> pvTime.dismiss());
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                    }).setTextColorOut(getResources().getColor(com.cooleshow.base.R.color.color_aaaaaa))
 | 
	
		
			
				|  |  | +//                    .setDividerColor(Color.TRANSPARENT)
 | 
	
		
			
				|  |  | +//                    .setBgColor(Color.TRANSPARENT)
 | 
	
		
			
				|  |  | +//                    .setLineSpacingMultiplier(2.5f)
 | 
	
		
			
				|  |  | +//                    .setType(new boolean[]{true, true, false, false, false, false})// 默认全部显示
 | 
	
		
			
				|  |  | +//                    .setTextColorCenter(getResources().getColor(com.cooleshow.base.R.color.color_1a1a1a))//设置选中项的颜色
 | 
	
		
			
				|  |  | +//                    .isDialog(false)//是否显示为对话框样式
 | 
	
		
			
				|  |  | +//                    .setLabel("年", "月", "", "", "", "")
 | 
	
		
			
				|  |  | +//                    .build();
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            pvTime.setOnDismissListener(new OnDismissListener() {
 | 
	
		
			
				|  |  | +//                @Override
 | 
	
		
			
				|  |  | +//                public void onDismiss(Object o) {
 | 
	
		
			
				|  |  | +//                    UiUtils.refreshFilterTextStyle2(false, mViewBinding.tvTime);
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                @Override
 | 
	
		
			
				|  |  | +//                public void onShow() {
 | 
	
		
			
				|  |  | +//                    UiUtils.refreshFilterTextStyle2(true, mViewBinding.tvTime);
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//            });
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  | +//        calendar.setTime(currentSelectDate);
 | 
	
		
			
				|  |  | +//        pvTime.setDate(calendar);
 | 
	
		
			
				|  |  | +//        if (!pvTime.isShowing()) {
 | 
	
		
			
				|  |  | +//            pvTime.show();
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    @Override
 | 
	
		
			
				|  |  | +//    public void onClick(View v) {
 | 
	
		
			
				|  |  | +//        if (v.getId() == R.id.tv_time) {
 | 
	
		
			
				|  |  | +//            //时间筛选
 | 
	
		
			
				|  |  | +//            showTimeSelectPicker();
 | 
	
		
			
				|  |  | +//            return;
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//        if (v.getId() == 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);
 | 
	
		
			
				|  |  | +//            });
 | 
	
		
			
				|  |  | +//            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;
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private void initCoursePop(TextView targetView, List<PopMenuBean> popList, PopupListWindow.PopupListListener listener) {
 | 
	
		
			
				|  |  | +//        PopupListWindow popWindow = new PopupListWindow(getContext());
 | 
	
		
			
				|  |  | +//        popWindow.showListPop(targetView, popList, position -> listener.onPopupListClick(position));
 | 
	
		
			
				|  |  | +//        UiUtils.refreshFilterTextStyle2(true, targetView);
 | 
	
		
			
				|  |  | +//        popWindow.getPopupWindow().setOnDismissListener(new PopupWindow.OnDismissListener() {
 | 
	
		
			
				|  |  | +//            @Override
 | 
	
		
			
				|  |  | +//            public void onDismiss() {
 | 
	
		
			
				|  |  | +//                UiUtils.refreshFilterTextStyle2(false, targetView);
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        });
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
 | 
	
		
			
				|  |  | +//        subjectBeanList.clear();
 | 
	
		
			
				|  |  | +//        subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
 | 
	
		
			
				|  |  | +//        subjectBeanList.addAll(data);
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private OptionsPickerView pvOptions;
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    private void selectSubject() {
 | 
	
		
			
				|  |  | +//        if (subjectBeanList.size() == 0) {
 | 
	
		
			
				|  |  | +//            subjectBeanList.add(new QuerySubjectBean("全部声部", 0));
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
 | 
	
		
			
				|  |  | +//            currentSubjectId = subjectBeanList.get(options1).id;
 | 
	
		
			
				|  |  | +//            mViewBinding.tvAgency.setText(subjectBeanList.get(options1).name);
 | 
	
		
			
				|  |  | +//            queryCourse(true);
 | 
	
		
			
				|  |  | +//        }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_address_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(v12 -> {
 | 
	
		
			
				|  |  | +//                pvOptions.returnData();
 | 
	
		
			
				|  |  | +//                pvOptions.dismiss();
 | 
	
		
			
				|  |  | +//            });
 | 
	
		
			
				|  |  | +//            ivCancel.setOnClickListener(v1 -> pvOptions.dismiss());
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//        }).setTextColorOut(getResources().getColor(com.cooleshow.base.R.color.color_aaaaaa))
 | 
	
		
			
				|  |  | +//                .setDividerColor(Color.TRANSPARENT)
 | 
	
		
			
				|  |  | +//                .setBgColor(Color.TRANSPARENT).isDialog(false).build();
 | 
	
		
			
				|  |  | +//        pvOptions.setPicker(subjectBeanList);
 | 
	
		
			
				|  |  | +//        pvOptions.show();
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +//}
 |