|
@@ -1,24 +1,34 @@
|
|
package com.cooleshow.teacher.ui.course;
|
|
package com.cooleshow.teacher.ui.course;
|
|
|
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.view.ViewGroup;
|
|
|
|
+import android.widget.PopupWindow;
|
|
|
|
|
|
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.cooleshow.base.constanst.Constants;
|
|
import com.cooleshow.base.constanst.Constants;
|
|
|
|
+import com.cooleshow.base.constanst.CourseGroupStatusType;
|
|
|
|
+import com.cooleshow.base.interfaces.IFilterViewData;
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
import com.cooleshow.base.utils.LOG;
|
|
import com.cooleshow.base.utils.LOG;
|
|
|
|
+import com.cooleshow.base.utils.PopupUtil;
|
|
|
|
+import com.cooleshow.base.utils.UiUtils;
|
|
|
|
+import com.cooleshow.base.widgets.CourseGroupFilterView;
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
import com.cooleshow.base.widgets.EmptyViewLayout;
|
|
|
|
+import com.cooleshow.teacher.R;
|
|
import com.cooleshow.teacher.adapter.VIPCourseAdapter;
|
|
import com.cooleshow.teacher.adapter.VIPCourseAdapter;
|
|
import com.cooleshow.teacher.bean.QuerySubjectBean;
|
|
import com.cooleshow.teacher.bean.QuerySubjectBean;
|
|
import com.cooleshow.teacher.bean.VIPCourseGroupListBean;
|
|
import com.cooleshow.teacher.bean.VIPCourseGroupListBean;
|
|
import com.cooleshow.teacher.contract.VipCourseContract;
|
|
import com.cooleshow.teacher.contract.VipCourseContract;
|
|
import com.cooleshow.teacher.databinding.FgVipCourseLayoutBinding;
|
|
import com.cooleshow.teacher.databinding.FgVipCourseLayoutBinding;
|
|
import com.cooleshow.teacher.presenter.course.VipCoursePresenter;
|
|
import com.cooleshow.teacher.presenter.course.VipCoursePresenter;
|
|
|
|
+import com.scwang.smart.refresh.footer.ClassicsFooter;
|
|
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
|
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
|
import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener;
|
|
import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener;
|
|
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
|
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.NonNull;
|
|
@@ -28,17 +38,20 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|
* Author by pq, Date on 2022/5/9.
|
|
* Author by pq, Date on 2022/5/9.
|
|
*/
|
|
*/
|
|
public class VIPCourseGroupFragment extends BaseMVPFragment<FgVipCourseLayoutBinding, VipCoursePresenter> implements VipCourseContract.View, View.OnClickListener {
|
|
public class VIPCourseGroupFragment extends BaseMVPFragment<FgVipCourseLayoutBinding, VipCoursePresenter> implements VipCourseContract.View, View.OnClickListener {
|
|
- private List<QuerySubjectBean> subjectList = new ArrayList<>();
|
|
|
|
|
|
+ private List<IFilterViewData> subjectBeanList = new ArrayList<>();//声部筛选
|
|
private VIPCourseAdapter mAdapter;
|
|
private VIPCourseAdapter mAdapter;
|
|
private int currentPage = 1;
|
|
private int currentPage = 1;
|
|
private boolean hasNext = true;
|
|
private boolean hasNext = true;
|
|
private String status = "";
|
|
private String status = "";
|
|
private String currentSubjectId;
|
|
private String currentSubjectId;
|
|
private String searchCondition;
|
|
private String searchCondition;
|
|
|
|
+ private CourseGroupFilterView mCourseGroupFilterView;
|
|
|
|
+ private PopupWindow mPopupWindow;
|
|
|
|
+ private List<IFilterViewData> statusList;//状态筛选
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void initView(View rootView) {
|
|
protected void initView(View rootView) {
|
|
-
|
|
|
|
|
|
+ mViewBinding.refreshLayout.setRefreshFooter(new ClassicsFooter(getContext()));
|
|
LinearLayoutManager manager = new LinearLayoutManager(getContext());
|
|
LinearLayoutManager manager = new LinearLayoutManager(getContext());
|
|
mViewBinding.recyclerViewList.setLayoutManager(manager);
|
|
mViewBinding.recyclerViewList.setLayoutManager(manager);
|
|
mAdapter = new VIPCourseAdapter();
|
|
mAdapter = new VIPCourseAdapter();
|
|
@@ -51,11 +64,18 @@ public class VIPCourseGroupFragment extends BaseMVPFragment<FgVipCourseLayoutBin
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void initData() {
|
|
protected void initData() {
|
|
|
|
+ CourseGroupStatusType[] values = CourseGroupStatusType.values();
|
|
|
|
+ List<CourseGroupStatusType> courseGroupStatusTypes = Arrays.asList(values);
|
|
|
|
+ statusList = new ArrayList<com.cooleshow.base.interfaces.IFilterViewData>(courseGroupStatusTypes);
|
|
|
|
+
|
|
|
|
+
|
|
initListener();
|
|
initListener();
|
|
getData(true);
|
|
getData(true);
|
|
}
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
private void initListener() {
|
|
|
|
+ mViewBinding.tvFilter.setOnClickListener(this);
|
|
|
|
+ mViewBinding.tvSearch.setOnClickListener(this);
|
|
mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
|
mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
|
@Override
|
|
@Override
|
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
|
@@ -103,6 +123,61 @@ public class VIPCourseGroupFragment extends BaseMVPFragment<FgVipCourseLayoutBin
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onClick(View view) {
|
|
public void onClick(View view) {
|
|
|
|
+ int id = view.getId();
|
|
|
|
+ if (id == R.id.tv_filter) {
|
|
|
|
+ showFilterView();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (id == R.id.tv_search) {
|
|
|
|
+ currentPage = 1;
|
|
|
|
+ searchCondition = mViewBinding.etTargetName.getText().toString().trim();
|
|
|
|
+ getData(false);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private void showFilterView() {
|
|
|
|
+ if (mCourseGroupFilterView == null) {
|
|
|
|
+ mCourseGroupFilterView = new CourseGroupFilterView(getContext());
|
|
|
|
+ mCourseGroupFilterView.setOnEventListener(new CourseGroupFilterView.OnEventListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onDismiss() {
|
|
|
|
+ if (mPopupWindow != null) {
|
|
|
|
+ mPopupWindow.dismiss();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onQuery(String obj, String obj2) {
|
|
|
|
+ if (mPopupWindow != null) {
|
|
|
|
+ mPopupWindow.dismiss();
|
|
|
|
+ }
|
|
|
|
+ currentPage = 1;
|
|
|
|
+ VIPCourseGroupFragment.this.status = obj;
|
|
|
|
+ VIPCourseGroupFragment.this.currentSubjectId = obj2;
|
|
|
|
+ getData(true);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ mCourseGroupFilterView.setData(statusList, subjectBeanList);
|
|
|
|
+ ViewGroup parent = (ViewGroup) mCourseGroupFilterView.getParent();
|
|
|
|
+ if (parent != null) {
|
|
|
|
+ parent.removeView(mCourseGroupFilterView);
|
|
|
|
+ }
|
|
|
|
+ mPopupWindow = PopupUtil.showInDropWrapNObg(getContext(), mCourseGroupFilterView, mViewBinding.viewTopLine, new PopupUtil.ShowListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onShow(View view, PopupWindow popupWindow) {
|
|
|
|
+ UiUtils.refreshFilterTextStyle(true, mViewBinding.tvFilter);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onDismiss() {
|
|
|
|
+ UiUtils.refreshFilterTextStyle(false, mViewBinding.tvFilter);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -164,4 +239,10 @@ public class VIPCourseGroupFragment extends BaseMVPFragment<FgVipCourseLayoutBin
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void querySubjectItemSuccess(List<QuerySubjectBean> data) {
|
|
|
|
+ subjectBeanList.clear();
|
|
|
|
+ subjectBeanList.add(new QuerySubjectBean("全部", 0));
|
|
|
|
+ subjectBeanList.addAll(data);
|
|
|
|
+ }
|
|
}
|
|
}
|