|
@@ -6,6 +6,8 @@ import android.widget.ImageView;
|
|
|
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
import com.bumptech.glide.Glide;
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.chad.library.adapter.base.listener.OnItemClickListener;
|
|
|
import com.cooleshow.base.common.WebConstants;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
@@ -13,10 +15,14 @@ import com.cooleshow.base.utils.SizeUtils;
|
|
|
import com.cooleshow.base.utils.TimeUtils;
|
|
|
import com.cooleshow.base.utils.UiUtils;
|
|
|
import com.cooleshow.base.utils.Utils;
|
|
|
+import com.cooleshow.base.widgets.CommonItemDecoration;
|
|
|
import com.cooleshow.student.R;
|
|
|
import com.cooleshow.student.adapter.HomeHotAlbumAdapter;
|
|
|
import com.cooleshow.student.adapter.HomeHotMusicSheetAdapter;
|
|
|
import com.cooleshow.student.adapter.HomeMenuPagerAdapter;
|
|
|
+import com.cooleshow.student.adapter.HomeRecommendTalentAdapter;
|
|
|
+import com.cooleshow.student.adapter.HomeVideoCourseAdapter;
|
|
|
+import com.cooleshow.student.adapter.NewHomeVideoCourseAdapter;
|
|
|
import com.cooleshow.student.bean.AppHomeBean;
|
|
|
import com.cooleshow.student.bean.CountOfUnreadBean;
|
|
|
import com.cooleshow.student.bean.HelpCenterContentBean;
|
|
@@ -25,6 +31,7 @@ import com.cooleshow.student.bean.HomeHotMusicSheetItemBean;
|
|
|
import com.cooleshow.student.bean.HomeLiveAndVideoBean;
|
|
|
import com.cooleshow.student.bean.HomeStyleBean;
|
|
|
import com.cooleshow.student.bean.HotAlbumBean;
|
|
|
+import com.cooleshow.student.bean.RecommendTalentListBean;
|
|
|
import com.cooleshow.student.bean.StudentUserInfo;
|
|
|
import com.cooleshow.student.constants.CourseConstants;
|
|
|
import com.cooleshow.student.contract.HomeContract;
|
|
@@ -42,8 +49,10 @@ import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import androidx.annotation.NonNull;
|
|
|
import androidx.core.widget.NestedScrollView;
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
+import androidx.recyclerview.widget.GridLayoutManager;
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
import androidx.viewpager.widget.ViewPager;
|
|
|
|
|
@@ -66,6 +75,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
private String noticeId;
|
|
|
private HomeHotAlbumAdapter mAlbumAdapter;
|
|
|
private HomeHotMusicSheetAdapter mHomeHotMusicSheetAdapter;
|
|
|
+ private HomeRecommendTalentAdapter mRecommendTalentAdapter;
|
|
|
+ private NewHomeVideoCourseAdapter mHomeVideoCourseAdapter;
|
|
|
|
|
|
@Override
|
|
|
protected FragmentNewHomeLayoutBinding getLayoutView() {
|
|
@@ -91,6 +102,7 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
|
|
|
@Override
|
|
|
protected void initData() {
|
|
|
+ //热门专辑
|
|
|
LinearLayoutManager manager = new LinearLayoutManager(getContext());
|
|
|
manager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
mViewBinding.rvHotAlbum.setLayoutManager(manager);
|
|
@@ -99,16 +111,36 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
mViewBinding.rvHotAlbum.addItemDecoration(hotAlbumItemDecoration);
|
|
|
mViewBinding.rvHotAlbum.setAdapter(mAlbumAdapter);
|
|
|
|
|
|
-
|
|
|
+ //热门曲目
|
|
|
LinearLayoutManager musicSheetManager = new LinearLayoutManager(getContext());
|
|
|
musicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
mHomeHotMusicSheetAdapter = new HomeHotMusicSheetAdapter();
|
|
|
- HomeHotMusicSheetItemDecoration itemDecoration = new HomeHotMusicSheetItemDecoration(0, SizeUtils.dp2px(12), 0, SizeUtils.dp2px(12), 0);
|
|
|
+ HomeHotMusicSheetItemDecoration itemDecoration = new HomeHotMusicSheetItemDecoration(0, 0, 0, SizeUtils.dp2px(12), 0);
|
|
|
mViewBinding.rvHotTrack.addItemDecoration(itemDecoration);
|
|
|
mViewBinding.rvHotTrack.setLayoutManager(musicSheetManager);
|
|
|
mViewBinding.rvHotTrack.setAdapter(mHomeHotMusicSheetAdapter);
|
|
|
+
|
|
|
+
|
|
|
+ //推荐达人
|
|
|
+ mRecommendTalentAdapter = new HomeRecommendTalentAdapter();
|
|
|
+ CommonItemDecoration commonItemDecoration = new CommonItemDecoration(0, 0, 0, SizeUtils.dp2px(12), 0);
|
|
|
+ LinearLayoutManager recommendTalentManager = new LinearLayoutManager(getContext());
|
|
|
+ recommendTalentManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
+ mViewBinding.recyclerviewRecommendTalent.setLayoutManager(recommendTalentManager);
|
|
|
+ mViewBinding.recyclerviewRecommendTalent.addItemDecoration(commonItemDecoration);
|
|
|
+ mViewBinding.recyclerviewRecommendTalent.setAdapter(mRecommendTalentAdapter);
|
|
|
+
|
|
|
+ GridLayoutManager videoCourseManager = new GridLayoutManager(getContext(),2);
|
|
|
+ mViewBinding.rvVideoCourse.setLayoutManager(videoCourseManager);
|
|
|
+ mHomeVideoCourseAdapter = new NewHomeVideoCourseAdapter();
|
|
|
+ CommonItemDecoration videoListItemDecoration=new CommonItemDecoration(SizeUtils.dp2px(12),SizeUtils.dp2px(5),0,SizeUtils.dp2px(5),0);
|
|
|
+ mViewBinding.rvVideoCourse.addItemDecoration(videoListItemDecoration);
|
|
|
+ mViewBinding.rvVideoCourse.setAdapter(mHomeVideoCourseAdapter);
|
|
|
+
|
|
|
+ mViewBinding.recyclerviewRecommendTalent.setNestedScrollingEnabled(false);
|
|
|
mViewBinding.rvHotTrack.setNestedScrollingEnabled(false);
|
|
|
mViewBinding.rvHotAlbum.setNestedScrollingEnabled(false);
|
|
|
+ mViewBinding.rvVideoCourse.setNestedScrollingEnabled(false);
|
|
|
|
|
|
mMenuPagerAdapter = new HomeMenuPagerAdapter(getParentFragmentManager(), fragments);
|
|
|
mViewBinding.viewpagerMenu.setAdapter(mMenuPagerAdapter);
|
|
@@ -145,6 +177,9 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
presenter.userAccountPage();
|
|
|
//获取热门曲目
|
|
|
presenter.getHotMusicSheetList();
|
|
|
+ //获取推荐达人列表
|
|
|
+ presenter.getRecommendTalentList();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
@@ -157,6 +192,28 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
presenter.getHotMusicSheetList();
|
|
|
});
|
|
|
|
|
|
+ mHomeVideoCourseAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
+ HomeLiveAndVideoBean.VideoCourseBean item = (HomeLiveAndVideoBean.VideoCourseBean) adapter.getItem(position);
|
|
|
+ ARouter.getInstance()
|
|
|
+ .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
+ .withString(WebConstants.WEB_URL, WebConstants.TEACHER_VIDEO_DETAIL + "?groupId=" + item.videoGroupId)
|
|
|
+ .navigation();
|
|
|
+ });
|
|
|
+
|
|
|
+ mRecommendTalentAdapter.setOnItemClickListener(new OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
|
|
|
+ if (position < mRecommendTalentAdapter.getData().size()) {
|
|
|
+ //跳转达人风采
|
|
|
+ RecommendTalentListBean item = mRecommendTalentAdapter.getItem(position);
|
|
|
+ ARouter.getInstance()
|
|
|
+ .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
+ .withString(WebConstants.WEB_URL, WebConstants.STUDENT_TEACHER_HOME + item.userId)
|
|
|
+ .navigation();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
mAlbumAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
|
HotAlbumBean.RowsBean item = (HotAlbumBean.RowsBean) adapter.getItem(position);
|
|
|
ARouter.getInstance()
|
|
@@ -294,7 +351,12 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
if (bean == null) {
|
|
|
return;
|
|
|
}
|
|
|
- this.mRecentCourses = bean.recentCourses;
|
|
|
+ bindVideoCourse(bean.videoList);
|
|
|
+ bindRecentCourse(bean.recentCourses);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void bindRecentCourse(HomeLiveAndVideoBean.RecentCoursesBean recentCoursesBean) {
|
|
|
+ this.mRecentCourses = recentCoursesBean;
|
|
|
presenter.helpCenterContentList();
|
|
|
mViewBinding.ivCourseEnterAnim.clearAnimation();
|
|
|
mViewBinding.flCourseEnter.setVisibility(mRecentCourses != null ? View.VISIBLE : View.GONE);
|
|
@@ -318,6 +380,17 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void bindVideoCourse(List<HomeLiveAndVideoBean.VideoCourseBean> videoList) {
|
|
|
+ if (null == videoList || videoList.size() == 0) {
|
|
|
+ mViewBinding.clVideoCourse.setVisibility(View.GONE);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ mViewBinding.clVideoCourse.setVisibility(View.VISIBLE);
|
|
|
+ if (mHomeVideoCourseAdapter != null) {
|
|
|
+ mHomeVideoCourseAdapter.setNewInstance(videoList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void handleEnterAnim() {
|
|
|
if (mRecentCourses == null) {
|
|
|
mViewBinding.ivCourseEnterAnim.setVisibility(View.GONE);
|
|
@@ -410,6 +483,21 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void getRecommendTalentSuccess(ArrayList<RecommendTalentListBean> talentListBeans) {
|
|
|
+ if (isDetached()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (talentListBeans != null && talentListBeans.size() > 0) {
|
|
|
+ mViewBinding.csRecommendTalent.setVisibility(View.VISIBLE);
|
|
|
+ if (mRecommendTalentAdapter != null) {
|
|
|
+ mRecommendTalentAdapter.setNewInstance(talentListBeans);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mViewBinding.csRecommendTalent.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void onClick(View v) {
|
|
|
int id = v.getId();
|
|
|
if (UiUtils.isFastClick()) {
|