|
@@ -18,6 +18,7 @@ import com.cooleshow.base.utils.UiUtils;
|
|
|
import com.cooleshow.base.utils.Utils;
|
|
|
import com.cooleshow.base.utils.helper.WebStartHelper;
|
|
|
import com.cooleshow.teacher.R;
|
|
|
+import com.cooleshow.teacher.adapter.HomeGoodMusicSheetAdapter;
|
|
|
import com.cooleshow.teacher.adapter.HomeHotAlbumAdapter;
|
|
|
import com.cooleshow.teacher.adapter.HomeHotMusicSheetAdapter;
|
|
|
import com.cooleshow.teacher.adapter.HomeMenuPageAdapter;
|
|
@@ -62,6 +63,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
* Author by pq, Date on 2022/8/8.
|
|
|
*/
|
|
|
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 String STYLE_TYPE = "STYLE";
|
|
|
public static final String VIDEON_TYPE = "VIDEO";
|
|
|
public static final String LIVE_TYPE = "LIVE";
|
|
@@ -78,6 +81,7 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
private int degreeFlag = 0;//老师学历认证
|
|
|
private String entryStatus = "";//达人认证状态
|
|
|
private SmartRefreshLayout refreshLayout;
|
|
|
+ private HomeGoodMusicSheetAdapter mGoodMusicSheetAdapter;
|
|
|
|
|
|
@Override
|
|
|
protected void initView(View rootView) {
|
|
@@ -96,6 +100,14 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
mViewBinding.rvHotAlbum.addItemDecoration(hotAlbumItemDecoration);
|
|
|
mViewBinding.rvHotAlbum.setAdapter(mAlbumAdapter);
|
|
|
|
|
|
+ mGoodMusicSheetAdapter = new HomeGoodMusicSheetAdapter();
|
|
|
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
|
|
|
+ layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
+ HomeHotMusicSheetItemDecoration itemDecoration2 = new HomeHotMusicSheetItemDecoration(0, SizeUtils.dp2px(12), 0, SizeUtils.dp2px(12), 0);
|
|
|
+ mViewBinding.rvGoodTrack.addItemDecoration(itemDecoration2);
|
|
|
+ mViewBinding.rvGoodTrack.setLayoutManager(layoutManager);
|
|
|
+ mViewBinding.rvGoodTrack.setAdapter(mGoodMusicSheetAdapter);
|
|
|
+
|
|
|
LinearLayoutManager musicSheetManager = new LinearLayoutManager(getContext());
|
|
|
musicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
mHomeHotMusicSheetAdapter = new HomeHotMusicSheetAdapter();
|
|
@@ -139,10 +151,13 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
mViewBinding.bgAnnouncement2.setOnClickListener(this);
|
|
|
mViewBinding.tvHotAlbumMore.setOnClickListener(this);
|
|
|
mViewBinding.tvHotTrackMore.setOnClickListener(this);
|
|
|
+ mViewBinding.tvGoodTrackMore.setOnClickListener(this);
|
|
|
mViewBinding.refreshLayout.setOnRefreshListener(refreshLayout -> {
|
|
|
mViewBinding.refreshLayout.finishRefresh();
|
|
|
presenter.getHotAlbumList();
|
|
|
presenter.getHotMusicSheetList();
|
|
|
+ //精品曲目
|
|
|
+ presenter.getGoodMusicSheetList();
|
|
|
presenter.queryCountOfUnread();
|
|
|
presenter.queryLiveAndVideo();
|
|
|
presenter.appHome();
|
|
@@ -190,6 +205,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
presenter.getHotAlbumList();
|
|
|
//热门曲目
|
|
|
presenter.getHotMusicSheetList();
|
|
|
+ //精品曲目
|
|
|
+ presenter.getGoodMusicSheetList();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -424,6 +441,37 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getGoodMusicSheetListSuccess(HomeHotMusicSheetBean homeHotMusicSheetBean) {
|
|
|
+ if (isDetached() || homeHotMusicSheetBean == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ArrayList<HomeHotMusicSheetItemBean> itemBeans = new ArrayList<>();
|
|
|
+ List<HomeHotMusicSheetBean.RowsBean> rows = homeHotMusicSheetBean.rows;
|
|
|
+ if (rows != null && rows.size() > 0) {
|
|
|
+ mViewBinding.clGoodTrack.setVisibility(View.VISIBLE);
|
|
|
+ int pageCount = 0;
|
|
|
+ int pageResult = rows.size() % MAX_GOOD_MUSIC_LIST_PAGE;
|
|
|
+ if (pageResult == 0) {
|
|
|
+ pageCount = rows.size() / MAX_GOOD_MUSIC_LIST_PAGE;
|
|
|
+ } else {
|
|
|
+ pageCount = (rows.size() / MAX_GOOD_MUSIC_LIST_PAGE) + 1;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < pageCount; i++) {
|
|
|
+ HomeHotMusicSheetItemBean hotMusicSheetItemBean = new HomeHotMusicSheetItemBean();
|
|
|
+ for (int k = i * MAX_GOOD_MUSIC_LIST_PAGE; k < rows.size() && k < (i + 1) * MAX_GOOD_MUSIC_LIST_PAGE; k++) {
|
|
|
+ hotMusicSheetItemBean.sheetBeans.add(rows.get(k));
|
|
|
+ }
|
|
|
+ itemBeans.add(hotMusicSheetItemBean);
|
|
|
+ }
|
|
|
+ if (mGoodMusicSheetAdapter != null) {
|
|
|
+ mGoodMusicSheetAdapter.setNewInstance(itemBeans);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mViewBinding.clGoodTrack.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void getTeacherInfoSuccess(TeacherUserInfo teacherUserInfo) {
|
|
|
if (teacherUserInfo == null) {
|
|
@@ -591,6 +639,11 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
WebStartHelper.startHotMusicSheetList();
|
|
|
return;
|
|
|
}
|
|
|
+ if(id == R.id.tv_good_track_more){
|
|
|
+ //精品曲目更多
|
|
|
+ WebStartHelper.startGoodMusicSheetList();
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (id == R.id.view_badge) {
|
|
|
showBadgeDialog();
|
|
|
return;
|