瀏覽代碼

增加学生端新首页UI

Pq 2 年之前
父節點
當前提交
6a84fcee92

+ 30 - 6
BaseLibrary/src/main/java/com/cooleshow/base/utils/GlideUtils.kt

@@ -8,6 +8,7 @@ import com.bumptech.glide.Glide
 import com.bumptech.glide.load.MultiTransformation
 import com.bumptech.glide.request.RequestOptions
 import com.cooleshow.base.R
+import com.cooleshow.base.widgets.transformation.GlideRoundTransform
 import jp.wasabeef.glide.transformations.BlurTransformation
 
 /*
@@ -18,23 +19,46 @@ object GlideUtils {
         Glide.with(context).load(url).centerCrop().into(imageView)
     }
 
-    fun loadImage(context: Context, url: String?, imageView: ImageView,defaultDrawable : Int) {
-        Glide.with(context).load(url).placeholder(defaultDrawable).error(defaultDrawable).into(imageView)
+    fun loadImage(context: Context, url: String?, imageView: ImageView, defaultDrawable: Int) {
+        Glide.with(context).load(url).placeholder(defaultDrawable).error(defaultDrawable)
+            .into(imageView)
     }
 
     fun loadImageFitCenter(context: Context, url: String?, imageView: ImageView) {
         Glide.with(context).load(url).fitCenter().into(imageView)
     }
 
-    fun loadImageWhitVague(context: Context, url: String?, imageView: ImageView,defaultDrawable : Int) {
+    fun loadImageWhitVague(
+        context: Context,
+        url: String?,
+        imageView: ImageView,
+        defaultDrawable: Int
+    ) {
         Glide.with(context).load(url).apply(
-            RequestOptions.bitmapTransform(MultiTransformation(BlurTransformation(90)))).placeholder(defaultDrawable).error(defaultDrawable).into(imageView)
+            RequestOptions.bitmapTransform(MultiTransformation(BlurTransformation(90)))
+        ).placeholder(defaultDrawable).error(defaultDrawable).into(imageView)
+    }
+
+    /**
+     * 加载顶部圆角图片
+     */
+    fun loadTopRoundImage(
+        context: Context,
+        url: String?,
+        imageView: ImageView,
+        radius: Int,
+        defaultDrawable: Int
+    ) {
+        var options = RequestOptions();
+        options.transform(GlideRoundTransform(radius))
+            .placeholder(defaultDrawable).error(defaultDrawable)
+        Glide.with(context).load(url).apply(options).into(imageView)
     }
 
     /*
         当fragment或者activity失去焦点或者destroyed的时候,Glide会自动停止加载相关资源,确保资源不会被浪费
      */
-    fun loadUrlImage(context: Context, url: String?, imageView: ImageView){
+    fun loadUrlImage(context: Context, url: String?, imageView: ImageView) {
 //        Glide.with(context).load(url).placeholder(R.drawable.icon_back).error(R.drawable.icon_back).centerCrop().into(
 //                object : SimpleTarget<GlideDrawable>() {
 //                    override fun onResourceReady(resource: GlideDrawable,
@@ -45,7 +69,7 @@ object GlideUtils {
     }
 
 
-    fun loadVideoThumbnail(context: Context,videoUrl: String, view: ImageView) {
+    fun loadVideoThumbnail(context: Context, videoUrl: String, view: ImageView) {
         Glide.with(context)
             .setDefaultRequestOptions(
                 RequestOptions()

+ 35 - 0
BaseLibrary/src/main/java/com/cooleshow/base/widgets/CommonItemDecoration.java

@@ -0,0 +1,35 @@
+package com.cooleshow.base.widgets;
+
+import android.graphics.Rect;
+import android.view.View;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * Author by pq, Date on 2021/3/18 0018.
+ */
+public class CommonItemDecoration extends RecyclerView.ItemDecoration {
+
+    private int top;
+    private int left;
+    private int bottom;
+    private int right;
+    private int center;
+
+    public CommonItemDecoration(int top, int left, int bottom, int right, int center) {
+        this.top = top;
+        this.left = left;
+        this.bottom = bottom;
+        this.right = right;
+        this.center = center;
+    }
+
+    @Override
+    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+        //每行都只有2个
+        outRect.left = left;
+        outRect.top = top;
+        outRect.bottom = bottom;
+        outRect.right = right;
+    }
+}

+ 65 - 0
BaseLibrary/src/main/java/com/cooleshow/base/widgets/transformation/GlideRoundTransform.java

@@ -0,0 +1,65 @@
+package com.cooleshow.base.widgets.transformation;
+
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapShader;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.RectF;
+
+import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
+import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
+import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
+
+import java.security.MessageDigest;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Author by pq, Date on 2022/8/30.
+ */
+public class GlideRoundTransform extends BitmapTransformation {
+    private static float radius = 0f;
+
+    public GlideRoundTransform() {
+        this(4);
+    }
+
+    public GlideRoundTransform(int dp) {
+        super();
+        this.radius = Resources.getSystem().getDisplayMetrics().density * dp;
+    }
+
+
+    @Override
+    protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) {
+        //变换的时候裁切
+        Bitmap bitmap = TransformationUtils.centerCrop(pool, toTransform, outWidth, outHeight);
+        return roundCrop(pool, bitmap);
+    }
+
+    @Override
+    public void updateDiskCacheKey(MessageDigest messageDigest) {
+
+    }
+
+
+    private static Bitmap roundCrop(BitmapPool pool, Bitmap source) {
+        if (source == null) {
+            return null;
+        }
+        Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
+        if (result == null) {
+            result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
+        }
+        Canvas canvas = new Canvas(result);
+        Paint paint = new Paint();
+        paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
+        paint.setAntiAlias(true);
+        RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
+        canvas.drawRoundRect(rectF, radius, radius, paint);
+        RectF rectRound = new RectF(0f, 100f, source.getWidth(), source.getHeight());
+        canvas.drawRect(rectRound, paint);
+        return result;
+    }
+}

+ 3 - 0
BaseLibrary/src/main/res/values/colors.xml

@@ -120,6 +120,9 @@
     <color name="color_40000000">#40000000</color>
     <color name="color_fff1e7">#fff1e7</color>
     <color name="color_f6f6f6">#F6F6F6</color>
+    <color name="color_ff8b39">#FF8B39</color>
+    <color name="color_ff4046">#ff4046</color>
+    <color name="color_ff8901">#FF8901</color>
 
     <color name="color_25292e">#25292E</color>
     <color name="color_F8F8F8">#F8F8F8</color>

+ 40 - 0
student/src/main/java/com/cooleshow/student/adapter/HomeRecommendTalentAdapter.java

@@ -0,0 +1,40 @@
+package com.cooleshow.student.adapter;
+
+import android.view.View;
+import android.widget.ImageView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.base.utils.GlideUtils;
+import com.cooleshow.student.R;
+import com.cooleshow.student.bean.RecommendTalentListBean;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Author by pq, Date on 2022/8/30.
+ */
+public class HomeRecommendTalentAdapter extends BaseQuickAdapter<RecommendTalentListBean, BaseViewHolder> {
+
+    public HomeRecommendTalentAdapter() {
+        super(R.layout.item_home_recommend_talent_layot);
+    }
+
+    @Override
+    protected void convert(@NonNull BaseViewHolder holder, RecommendTalentListBean data) {
+        //头像
+        ImageView iv_avatar = holder.getView(R.id.iv_avatar);
+        GlideUtils.INSTANCE.loadImage(getContext(), data.avatar, iv_avatar, R.drawable.icon_teacher_default_head);
+        //昵称
+        holder.setText(R.id.tv_name, data.username);
+        //毕业院校
+        holder.setText(R.id.tv_tip, data.graduateSchool);
+        //是否直播中
+        View tv_live_tip = holder.getView(R.id.tv_live_tip);
+        if (data.living) {
+            tv_live_tip.setVisibility(View.VISIBLE);
+        } else {
+            tv_live_tip.setVisibility(View.GONE);
+        }
+    }
+}

+ 44 - 0
student/src/main/java/com/cooleshow/student/adapter/NewHomeVideoCourseAdapter.java

@@ -0,0 +1,44 @@
+package com.cooleshow.student.adapter;
+
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.base.utils.GlideUtils;
+import com.cooleshow.base.utils.SizeUtils;
+import com.cooleshow.base.utils.UiUtils;
+import com.cooleshow.base.widgets.QMUIRadiusImageView;
+import com.cooleshow.student.R;
+import com.cooleshow.student.bean.HomeLiveAndVideoBean;
+
+import java.util.List;
+
+/**
+ * 创建日期:2022/5/27 14:51
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public class NewHomeVideoCourseAdapter extends BaseQuickAdapter<HomeLiveAndVideoBean.VideoCourseBean, BaseViewHolder> {
+
+    public NewHomeVideoCourseAdapter() {
+        super(R.layout.item_home_video_list_layout);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder helper, HomeLiveAndVideoBean.VideoCourseBean item) {
+        ImageView iv_cover = helper.getView(R.id.iv_cover);
+        GlideUtils.INSTANCE.loadTopRoundImage(getContext(), item.lessonCoverUrl, iv_cover, 10, com.cooleshow.base.R.drawable.bg_video_placeholder);
+
+        helper.setText(R.id.subject_name, item.subjectName);
+        TextView tv_title = helper.getView(R.id.tv_title);
+        tv_title.setText(item.videoGroupName);
+        TextView tv_teacher_name = helper.getView(R.id.tv_name);
+        tv_teacher_name.setText(item.teacherName);
+        helper.setText(R.id.tv_tip, item.buyCount + "人在学");
+    }
+}

+ 11 - 0
student/src/main/java/com/cooleshow/student/api/APIService.java

@@ -27,6 +27,7 @@ import com.cooleshow.student.bean.PianoRoomCourseHomeworkBean;
 import com.cooleshow.student.bean.PianoRoomCourseListBean;
 import com.cooleshow.student.bean.PracticeCourseListBean;
 import com.cooleshow.student.bean.QuerySubjectBean;
+import com.cooleshow.student.bean.RecommendTalentListBean;
 import com.cooleshow.student.bean.SelectMyGroupBean;
 import com.cooleshow.student.bean.SparringCourseCommentBean;
 import com.cooleshow.student.bean.SparringCourseHomeworkBean;
@@ -37,6 +38,7 @@ import com.cooleshow.student.bean.VideoCourseListBean;
 import com.cooleshow.usercenter.bean.SetDetailBean;
 import com.cooleshow.usercenter.bean.UserInfo;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -487,4 +489,13 @@ public interface APIService {
     @POST(STUDENT_GROUP + "music/sheet/list")
     Observable<BaseResponse<HomeHotMusicSheetBean>> getHotMusicSheetList(@Body RequestBody body);
 
+
+
+    /**
+     * app首页热门专辑
+     *
+     * @return
+     */
+    @GET(STUDENT_GROUP + "teacher/queryHotTeacherList")
+    Observable<BaseResponse<ArrayList<RecommendTalentListBean>>> getRecommendTalentList();
 }

+ 84 - 0
student/src/main/java/com/cooleshow/student/bean/RecommendTalentListBean.java

@@ -0,0 +1,84 @@
+package com.cooleshow.student.bean;
+
+/**
+ * Author by pq, Date on 2022/8/30.
+ */
+public class RecommendTalentListBean {
+
+
+    /**
+     * avatar :
+     * browse : 0
+     * createTime :
+     * degreeCertificate :
+     * degreeDate :
+     * degreeFlag :
+     * educationBackground :
+     * entryAuthDate :
+     * entryFlag :
+     * gradCertificate :
+     * graduateSchool :
+     * introduction :
+     * liveDate :
+     * liveFlag :
+     * living : true
+     * lockFlag :
+     * memberRankSettingId : 0
+     * membershipEndTime :
+     * membershipStartTime :
+     * memo :
+     * musicDate :
+     * musicianDate :
+     * musicianFlag :
+     * styleDate :
+     * subject :
+     * subjectId :
+     * tag :
+     * teacherCertificate :
+     * teacherDate :
+     * teacherFlag :
+     * technicalTitles :
+     * updateTime :
+     * userId : 0
+     * username :
+     * videoDate :
+     * workUnit :
+     */
+
+    public String avatar;
+    public int browse;
+    public String createTime;
+    public String degreeCertificate;
+    public String degreeDate;
+    public String degreeFlag;
+    public String educationBackground;
+    public String entryAuthDate;
+    public String entryFlag;
+    public String gradCertificate;
+    public String graduateSchool;
+    public String introduction;
+    public String liveDate;
+    public String liveFlag;
+    public boolean living;
+    public String lockFlag;
+    public int memberRankSettingId;
+    public String membershipEndTime;
+    public String membershipStartTime;
+    public String memo;
+    public String musicDate;
+    public String musicianDate;
+    public String musicianFlag;
+    public String styleDate;
+    public String subject;
+    public String subjectId;
+    public String tag;
+    public String teacherCertificate;
+    public String teacherDate;
+    public String teacherFlag;
+    public String technicalTitles;
+    public String updateTime;
+    public int userId;
+    public String username;
+    public String videoDate;
+    public String workUnit;
+}

+ 4 - 0
student/src/main/java/com/cooleshow/student/contract/HomeContract.java

@@ -8,9 +8,11 @@ import com.cooleshow.student.bean.HomeHotMusicSheetBean;
 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.bean.TeachableInstrumentBean;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -36,6 +38,8 @@ public interface HomeContract {
         void queryCountOfUnreadSuccess(List<CountOfUnreadBean> data);
 
         void getHotMusicSheetListSuccess(HomeHotMusicSheetBean homeHotMusicSheetBean);
+
+        void getRecommendTalentSuccess(ArrayList<RecommendTalentListBean> talentListBeans);
     }
 
     interface Presenter {

+ 16 - 11
student/src/main/java/com/cooleshow/student/presenter/main/HomePresenter.java

@@ -12,12 +12,14 @@ import com.cooleshow.student.bean.HomeHotMusicSheetBean;
 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.contract.HomeContract;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -201,17 +203,6 @@ public class HomePresenter extends BasePresenter<HomeContract.HomeView> implemen
                     getView().queryCountOfUnreadSuccess(data);
                 }
             }
-
-            @Override
-            public void onComplete() {
-                super.onComplete();
-            }
-
-            @Override
-            public void onError(Throwable e) {
-                super.onError(e);
-
-            }
         });
     }
 
@@ -238,4 +229,18 @@ public class HomePresenter extends BasePresenter<HomeContract.HomeView> implemen
             }
         });
     }
+
+    /**
+     * 获取推荐达人列表
+     */
+    public void getRecommendTalentList(){
+        addSubscribe(create(APIService.class).getRecommendTalentList(), new BaseObserver<ArrayList<RecommendTalentListBean>>(getView()) {
+            @Override
+            protected void onSuccess(ArrayList<RecommendTalentListBean> data) {
+                if (null != getView()) {
+                    getView().getRecommendTalentSuccess(data);
+                }
+            }
+        });
+    }
 }

+ 6 - 0
student/src/main/java/com/cooleshow/student/ui/main/HomeFragment.java

@@ -48,6 +48,7 @@ import com.cooleshow.student.bean.HomeHotMusicSheetBean;
 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;
@@ -623,4 +624,9 @@ public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, Hom
     public void getHotMusicSheetListSuccess(HomeHotMusicSheetBean homeHotMusicSheetBean) {
 
     }
+
+    @Override
+    public void getRecommendTalentSuccess(ArrayList<RecommendTalentListBean> talentListBeans) {
+
+    }
 }

+ 91 - 3
student/src/main/java/com/cooleshow/student/ui/main/NewHomeFragment.java

@@ -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()) {

+ 5 - 0
student/src/main/res/drawable/shape_ff8901_4dp.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="@color/color_ff8901" />
+    <corners android:radius="4dp" />
+</shape>

+ 8 - 0
student/src/main/res/drawable/shape_home_live_tip_bg.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient android:startColor="@color/color_ff8b39"
+        android:endColor="@color/color_ff4046"/>
+    <corners android:radius="7dp"/>
+    <stroke android:color="@color/white" android:width="0.5dp"/>
+
+</shape>

+ 67 - 54
student/src/main/res/layout/fragment_new_home_layout.xml

@@ -483,60 +483,72 @@
                 </androidx.constraintlayout.widget.ConstraintLayout>
 
 
-                <View
-                    android:id="@+id/tv_recommend_teacher_line"
-                    android:layout_width="4dp"
-                    android:layout_height="17dp"
-                    android:layout_marginStart="14dp"
-                    android:background="@drawable/shape_course_title_tag_bg"
-                    app:layout_constraintBottom_toBottomOf="@+id/tv_recommend_teacher_title"
-                    app:layout_constraintLeft_toLeftOf="parent"
-                    app:layout_constraintTop_toTopOf="@+id/tv_recommend_teacher_title" />
 
-                <TextView
-                    android:id="@+id/tv_recommend_teacher_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_marginLeft="@dimen/dp_6"
-                    android:layout_marginTop="30dp"
-                    android:gravity="center"
-                    android:text="推荐达人"
-                    android:textColor="@color/color_333333"
-                    android:textSize="@dimen/sp_18"
-                    android:textStyle="bold"
-                    app:layout_constraintLeft_toRightOf="@+id/tv_recommend_teacher_line"
-                    app:layout_constraintTop_toBottomOf="@+id/cl_hot_track" />
-
-                <TextView
-                    android:id="@+id/tv_recommend_teacher_more"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_marginRight="@dimen/dp_14"
-                    android:background="@drawable/shape_f2f2f2_9dp"
-                    android:drawableEnd="@drawable/icon_next_right"
-                    android:drawablePadding="1dp"
-                    android:gravity="center"
-                    android:paddingStart="7dp"
-                    android:paddingTop="2dp"
-                    android:paddingEnd="3dp"
-                    android:paddingBottom="2dp"
-                    android:text="更多"
-                    android:textColor="@color/color_999999"
-                    android:textSize="@dimen/sp_12"
-                    app:layout_constraintBottom_toBottomOf="@+id/tv_recommend_teacher_title"
-                    app:layout_constraintRight_toRightOf="parent"
-                    app:layout_constraintTop_toTopOf="@+id/tv_recommend_teacher_title" />
-
-
-                <androidx.recyclerview.widget.RecyclerView
-                    android:id="@+id/recyclerview_recommend_talent"
+                <androidx.constraintlayout.widget.ConstraintLayout
+                    android:id="@+id/cs_recommend_talent"
                     android:layout_width="match_parent"
-                    android:layout_height="146dp"
-                    android:layout_marginTop="12dp"
-                    android:overScrollMode="never"
-                    android:paddingLeft="@dimen/dp_14"
-                    android:scrollbars="none"
-                    app:layout_constraintTop_toBottomOf="@+id/tv_recommend_teacher_title" />
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="@dimen/dp_30"
+                    android:visibility="visible"
+                    app:layout_constraintTop_toBottomOf="@+id/cl_hot_track">
+
+                    <View
+                        android:id="@+id/tv_recommend_teacher_line"
+                        android:layout_width="4dp"
+                        android:layout_height="17dp"
+                        android:layout_marginStart="14dp"
+                        android:background="@drawable/shape_course_title_tag_bg"
+                        app:layout_constraintBottom_toBottomOf="@+id/tv_recommend_teacher_title"
+                        app:layout_constraintLeft_toLeftOf="parent"
+                        app:layout_constraintTop_toTopOf="@+id/tv_recommend_teacher_title" />
+
+                    <TextView
+                        android:id="@+id/tv_recommend_teacher_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="@dimen/dp_6"
+                        android:gravity="center"
+                        android:text="推荐达人"
+                        android:textColor="@color/color_333333"
+                        android:textSize="@dimen/sp_18"
+                        android:textStyle="bold"
+                        app:layout_constraintLeft_toRightOf="@+id/tv_recommend_teacher_line"
+                        app:layout_constraintTop_toTopOf="parent" />
+
+                    <TextView
+                        android:id="@+id/tv_recommend_teacher_more"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginRight="@dimen/dp_14"
+                        android:background="@drawable/shape_f2f2f2_9dp"
+                        android:drawableEnd="@drawable/icon_next_right"
+                        android:drawablePadding="1dp"
+                        android:gravity="center"
+                        android:paddingStart="7dp"
+                        android:paddingTop="2dp"
+                        android:paddingEnd="3dp"
+                        android:paddingBottom="2dp"
+                        android:text="更多"
+                        android:textColor="@color/color_999999"
+                        android:textSize="@dimen/sp_12"
+                        app:layout_constraintBottom_toBottomOf="@+id/tv_recommend_teacher_title"
+                        app:layout_constraintRight_toRightOf="parent"
+                        app:layout_constraintTop_toTopOf="@+id/tv_recommend_teacher_title" />
+
+                    <androidx.recyclerview.widget.RecyclerView
+                        android:id="@+id/recyclerview_recommend_talent"
+                        android:layout_width="match_parent"
+                        android:layout_height="146dp"
+                        android:layout_marginTop="12dp"
+                        android:overScrollMode="never"
+                        android:paddingLeft="@dimen/dp_14"
+                        android:scrollbars="none"
+                        app:layout_constraintTop_toBottomOf="@+id/tv_recommend_teacher_title" />
+
+                </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+
 
                 <androidx.constraintlayout.widget.ConstraintLayout
                     android:id="@+id/cl_video_course"
@@ -545,7 +557,7 @@
                     android:layout_marginTop="@dimen/dp_30"
                     android:visibility="visible"
                     app:layout_constraintLeft_toLeftOf="parent"
-                    app:layout_constraintTop_toBottomOf="@+id/recyclerview_recommend_talent">
+                    app:layout_constraintTop_toBottomOf="@+id/cs_recommend_talent">
 
                     <View
                         android:id="@+id/tv_video_course_line"
@@ -592,11 +604,12 @@
 
 
                     <androidx.recyclerview.widget.RecyclerView
+                        android:layout_marginStart="9dp"
+                        android:layout_marginEnd="9dp"
                         android:id="@+id/rv_video_course"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:overScrollMode="never"
-                        android:paddingTop="@dimen/dp_7"
                         android:scrollbars="none"
                         app:layout_constraintTop_toBottomOf="@+id/tv_video_course_title" />
 

+ 78 - 0
student/src/main/res/layout/item_home_recommend_talent_layot.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="110dp"
+    android:layout_height="146dp"
+    android:background="@drawable/shape_10dp_white">
+
+    <de.hdodenhof.circleimageview.CircleImageView
+        android:id="@+id/iv_avatar"
+        android:layout_width="59dp"
+        android:layout_height="59dp"
+        android:layout_marginTop="17dp"
+        app:civ_border_color="@color/color_2dc7aa"
+        app:civ_border_width="1dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <View
+        android:id="@+id/view_avatar_help_line"
+        android:layout_width="1px"
+        android:layout_height="1px"
+        app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
+        app:layout_constraintLeft_toLeftOf="parent" />
+
+    <TextView
+        android:id="@+id/tv_live_tip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="@drawable/shape_home_live_tip_bg"
+        android:includeFontPadding="false"
+        android:paddingStart="5dp"
+        android:paddingTop="1dp"
+        android:paddingEnd="5dp"
+        android:paddingBottom="1dp"
+        android:text="直播中"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_8"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="@+id/view_avatar_help_line"
+        app:layout_constraintLeft_toLeftOf="@+id/iv_avatar"
+        app:layout_constraintRight_toRightOf="@+id/iv_avatar"
+        app:layout_constraintTop_toTopOf="@+id/view_avatar_help_line" />
+
+    <TextView
+        android:id="@+id/tv_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="14dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="1"
+        android:paddingStart="5dp"
+        android:paddingEnd="5dp"
+        android:textColor="@color/color_333333"
+        android:textSize="@dimen/sp_14"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/iv_avatar"
+        tools:text="可爱的小星星" />
+
+
+    <TextView
+        android:id="@+id/tv_tip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="4dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="1"
+        android:textColor="@color/color_999999"
+        android:textSize="@dimen/sp_12"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_name"
+        tools:text="中国音乐学院" />
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 92 - 0
student/src/main/res/layout/item_home_video_list_layout.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/bg_white_10dp"
+    android:paddingBottom="8dp">
+
+    <ImageView
+        android:scaleType="centerCrop"
+        android:id="@+id/iv_cover"
+        android:layout_width="match_parent"
+        android:layout_height="94.5dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/subject_name"
+        android:layout_width="wrap_content"
+        android:layout_height="@dimen/dp_13"
+        android:layout_marginLeft="@dimen/dp_8"
+        android:layout_marginTop="@dimen/dp_8"
+        android:background="@drawable/gray_1_radius_bg"
+        android:gravity="center"
+        android:paddingLeft="@dimen/dp_4"
+        android:paddingRight="@dimen/dp_4"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_9"
+        app:layout_constraintLeft_toLeftOf="@+id/iv_cover"
+        app:layout_constraintTop_toTopOf="@+id/iv_cover" />
+
+    <TextView
+        android:id="@+id/tv_title"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="11dp"
+        android:layout_marginTop="7dp"
+        android:layout_marginEnd="11dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="1"
+        android:textColor="@color/color_333333"
+        android:textSize="@dimen/sp_14"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/iv_cover"
+        tools:text="长笛入门教学" />
+
+
+    <TextView
+        android:id="@+id/tv_name"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="11dp"
+        android:layout_marginTop="6dp"
+        android:layout_marginEnd="5dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="1"
+        android:textColor="@color/color_999999"
+        android:textSize="@dimen/sp_12"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@+id/view_point"
+        app:layout_constraintTop_toBottomOf="@+id/tv_title"
+        tools:text="长笛入门教学" />
+
+    <TextView
+        android:id="@+id/tv_tip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="6dp"
+        android:layout_marginEnd="12dp"
+        android:ellipsize="end"
+        android:includeFontPadding="false"
+        android:maxLines="1"
+        android:textColor="@color/color_ff8901"
+        android:textSize="@dimen/sp_12"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tv_title"
+        tools:text="1422人在学" />
+
+    <View
+        android:id="@+id/view_point"
+        android:layout_width="4dp"
+        android:layout_height="4dp"
+        android:layout_marginEnd="5dp"
+        android:layout_marginBottom="5dp"
+        android:background="@drawable/shape_ff8901_4dp"
+        app:layout_constraintBottom_toBottomOf="@+id/tv_tip"
+        app:layout_constraintRight_toLeftOf="@+id/tv_tip" />
+</androidx.constraintlayout.widget.ConstraintLayout>