|  | @@ -1,5 +1,6 @@
 | 
	
		
			
				|  |  |  package com.cooleshow.teacher.ui.main;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import android.content.Intent;
 | 
	
		
			
				|  |  |  import android.text.TextUtils;
 | 
	
		
			
				|  |  |  import android.view.Gravity;
 | 
	
		
			
				|  |  |  import android.view.View;
 | 
	
	
		
			
				|  | @@ -67,6 +68,7 @@ import java.util.Date;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import androidx.annotation.NonNull;
 | 
	
		
			
				|  |  | +import androidx.annotation.Nullable;
 | 
	
		
			
				|  |  |  import androidx.fragment.app.Fragment;
 | 
	
		
			
				|  |  |  import androidx.recyclerview.widget.LinearLayoutManager;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -76,6 +78,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
 | 
	
		
			
				|  |  |  public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBinding, HomePresenter> implements HomeContract.HomeView, View.OnClickListener {
 | 
	
		
			
				|  |  |      public static final int MAX_HOT_MUSIC_LIST_PAGE = 4;//热门曲目一页最大条数
 | 
	
		
			
				|  |  |      public static final int MAX_GOOD_MUSIC_LIST_PAGE = 4;//精品曲目一页最大条数
 | 
	
		
			
				|  |  | +    public static final int SELECT_SUBJECT_REQUEST_CODE = 1001;//获取乐器筛选条件
 | 
	
		
			
				|  |  |      public static final String STYLE_TYPE = "STYLE";
 | 
	
		
			
				|  |  |      public static final String VIDEON_TYPE = "VIDEO";
 | 
	
		
			
				|  |  |      public static final String LIVE_TYPE = "LIVE";
 | 
	
	
		
			
				|  | @@ -94,9 +97,6 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
 | 
	
		
			
				|  |  |      private SmartRefreshLayout refreshLayout;
 | 
	
		
			
				|  |  |      private HomeHotMusicSheetAdapter mRecommendAdapter;
 | 
	
		
			
				|  |  |      private HomeHotMusicSheetAdapter mLatestAdapter;
 | 
	
		
			
				|  |  | -    private OptionsPickerView pvOptions;
 | 
	
		
			
				|  |  | -    private List<SubjectBean> subjectBeanList = new ArrayList<>();
 | 
	
		
			
				|  |  | -    private int currentSelectSubjectPosition = 0;
 | 
	
		
			
				|  |  |      private String currentSubjectId = "";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -157,7 +157,6 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
 | 
	
		
			
				|  |  |          //banner自带图片轮播的适配器
 | 
	
		
			
				|  |  |          mViewBinding.banner.setAdapter(mBannerImageAdapter, true);
 | 
	
		
			
				|  |  |          initListener();
 | 
	
		
			
				|  |  | -        presenter.queryAllSubjects();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -184,7 +183,6 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
 | 
	
		
			
				|  |  |          mViewBinding.tvCurrentSubject.setOnClickListener(this);
 | 
	
		
			
				|  |  |          mViewBinding.refreshLayout.setOnRefreshListener(refreshLayout -> {
 | 
	
		
			
				|  |  |              mViewBinding.refreshLayout.finishRefresh();
 | 
	
		
			
				|  |  | -            presenter.queryAllSubjects();//查询所有声部
 | 
	
		
			
				|  |  |              refreshMusicData();
 | 
	
		
			
				|  |  |              presenter.queryCountOfUnread();
 | 
	
		
			
				|  |  |              presenter.queryLiveAndVideo();
 | 
	
	
		
			
				|  | @@ -514,29 +512,6 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    public void subjectSelectSuccess(List<TeachableInstrumentBean> data) {
 | 
	
		
			
				|  |  | -        if (isDetached() || !isAdded()) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        //添加所有声部
 | 
	
		
			
				|  |  | -        subjectBeanList.clear();
 | 
	
		
			
				|  |  | -        if (data != null && data.size() > 0) {
 | 
	
		
			
				|  |  | -            for (int i = 0; i < data.size(); i++) {
 | 
	
		
			
				|  |  | -                TeachableInstrumentBean teachableInstrumentBean = data.get(i);
 | 
	
		
			
				|  |  | -                SubjectBean subjectBean = new SubjectBean(teachableInstrumentBean.name, String.valueOf(teachableInstrumentBean.id));
 | 
	
		
			
				|  |  | -                subjectBeanList.add(subjectBean);
 | 
	
		
			
				|  |  | -                if( teachableInstrumentBean.subjects!=null &&  teachableInstrumentBean.subjects.size()>0){
 | 
	
		
			
				|  |  | -                    for (int j = 0; j < teachableInstrumentBean.subjects.size(); j++) {
 | 
	
		
			
				|  |  | -                        TeachableInstrumentBean child = teachableInstrumentBean.subjects.get(j);
 | 
	
		
			
				|  |  | -                        SubjectBean childSubjectBean = new SubjectBean(child.name, String.valueOf(child.id));
 | 
	
		
			
				|  |  | -                        subjectBeanList.add(childSubjectBean);
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      private void showAwardTipDialog() {
 | 
	
		
			
				|  |  |          if (UserHelper.getShowAwardDialogTipIsCompleted()) {
 | 
	
		
			
				|  |  |              return;
 | 
	
	
		
			
				|  | @@ -768,36 +743,32 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
 | 
	
		
			
				|  |  |          badgeDesDialog.show();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private void selectSubject() {
 | 
	
		
			
				|  |  | -        if (subjectBeanList.size() == 0) {
 | 
	
		
			
				|  |  | -            subjectBeanList.add(new SubjectBean("全部", ""));
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        pvOptions = new OptionsPickerBuilder(getContext(), (options1, options2, options3, v) -> {
 | 
	
		
			
				|  |  | -            this.currentSelectSubjectPosition = options1;
 | 
	
		
			
				|  |  | -            SubjectBean bean = subjectBeanList.get(options1);
 | 
	
		
			
				|  |  | -            currentSubjectId = bean.id;
 | 
	
		
			
				|  |  | -            mViewBinding.tvCurrentSubject.setText(bean.name);
 | 
	
		
			
				|  |  | -            if (presenter != null) {
 | 
	
		
			
				|  |  | -                //同步选中id
 | 
	
		
			
				|  |  | -                presenter.syncSubjectFilter(currentSubjectId);
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
 | 
	
		
			
				|  |  | +        super.onActivityResult(requestCode, resultCode, data);
 | 
	
		
			
				|  |  | +        if (requestCode == SELECT_SUBJECT_REQUEST_CODE) {
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                List<TeachableInstrumentBean> selectTeachableInstrument = (List<TeachableInstrumentBean>) data.getSerializableExtra("selectTeachableInstrument");
 | 
	
		
			
				|  |  | +                if (selectTeachableInstrument != null && selectTeachableInstrument.size() > 0) {
 | 
	
		
			
				|  |  | +                    TeachableInstrumentBean teachableInstrumentBean = selectTeachableInstrument.get(0);
 | 
	
		
			
				|  |  | +                    currentSubjectId = String.valueOf(teachableInstrumentBean.id);
 | 
	
		
			
				|  |  | +                    mViewBinding.tvCurrentSubject.setText(teachableInstrumentBean.name);
 | 
	
		
			
				|  |  | +                    if (presenter != null) {
 | 
	
		
			
				|  |  | +                        //同步选中id
 | 
	
		
			
				|  |  | +                        presenter.syncSubjectFilter(currentSubjectId);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    refreshMusicData();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } catch (Exception e) {
 | 
	
		
			
				|  |  | +                e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            refreshMusicData();
 | 
	
		
			
				|  |  | -        }).setLayoutRes(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());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        }).isDialog(false).build();
 | 
	
		
			
				|  |  | -        pvOptions.setPicker(subjectBeanList);
 | 
	
		
			
				|  |  | -        if (currentSelectSubjectPosition < subjectBeanList.size()) {
 | 
	
		
			
				|  |  | -            pvOptions.setSelectOptions(currentSelectSubjectPosition);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        pvOptions.show();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void selectSubject() {
 | 
	
		
			
				|  |  | +        ARouter.getInstance().build(RouterPath.MineCenter.MINE_TEACHABLE_INSTRUMENT)
 | 
	
		
			
				|  |  | +                .withBoolean("isSingleSelect", true)
 | 
	
		
			
				|  |  | +                .navigation(getActivity(), SELECT_SUBJECT_REQUEST_CODE);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 |