浏览代码

增加学生端首页推荐曲目 最新曲目 热门曲目

Pq 2 年之前
父节点
当前提交
e8845fa852

+ 1 - 1
student/src/main/java/com/cooleshow/student/adapter/HomeGoodMusicSheetAdapter.java

@@ -35,7 +35,7 @@ public class HomeGoodMusicSheetAdapter extends BaseQuickAdapter<HomeHotMusicShee
         ll_container.removeAllViews();
         if (homeHotMusicSheetItemBean.sheetBeans != null && homeHotMusicSheetItemBean.sheetBeans.size() > 0) {
             for (int i = 0; i < homeHotMusicSheetItemBean.sheetBeans.size(); i++) {
-                HomeHotMusicSheetBean.RowsBean homeHotMusicSheetBean = homeHotMusicSheetItemBean.sheetBeans.get(i);
+                HomeHotMusicSheetBean.MusicSheetBean homeHotMusicSheetBean = homeHotMusicSheetItemBean.sheetBeans.get(i);
                 HomeHotMusicSheetItemView hotMusicSheetItemView = new HomeHotMusicSheetItemView(getContext());
                 hotMusicSheetItemView.setData(homeHotMusicSheetBean);
                 int result = i % (NewHomeFragment.MAX_HOT_MUSIC_LIST_PAGE - 1);

+ 1 - 1
student/src/main/java/com/cooleshow/student/adapter/HomeHotMusicSheetAdapter.java

@@ -35,7 +35,7 @@ public class HomeHotMusicSheetAdapter extends BaseQuickAdapter<HomeHotMusicSheet
         ll_container.removeAllViews();
         if (homeHotMusicSheetItemBean.sheetBeans != null && homeHotMusicSheetItemBean.sheetBeans.size() > 0) {
             for (int i = 0; i < homeHotMusicSheetItemBean.sheetBeans.size(); i++) {
-                HomeHotMusicSheetBean.RowsBean homeHotMusicSheetBean = homeHotMusicSheetItemBean.sheetBeans.get(i);
+                HomeHotMusicSheetBean.MusicSheetBean homeHotMusicSheetBean = homeHotMusicSheetItemBean.sheetBeans.get(i);
                 HomeHotMusicSheetItemView hotMusicSheetItemView = new HomeHotMusicSheetItemView(getContext());
                 hotMusicSheetItemView.setData(homeHotMusicSheetBean);
                 int result = i % (NewHomeFragment.MAX_HOT_MUSIC_LIST_PAGE - 1);

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

@@ -498,7 +498,7 @@ public interface APIService {
      *
      * @return
      */
-    @POST(STUDENT_GROUP + "music/sheet/list")
+    @POST(STUDENT_GROUP + "music/sheet/appMusicSheet")
     Observable<BaseResponse<HomeHotMusicSheetBean>> getHotMusicSheetList(@Body RequestBody body);
 
 

+ 21 - 26
student/src/main/java/com/cooleshow/student/bean/HomeHotMusicSheetBean.java

@@ -7,32 +7,17 @@ import java.util.List;
  */
 public class HomeHotMusicSheetBean {
 
-    /**
-     * footer : [{"addName":"","addUserAvatar":"","audioFileUrl":"","audioType":"","auditStatus":"","auditVersion":"","canEvaluate":"","chargeType":"","composer":"","createBy":0,"createTime":"","delFlag":true,"extConfigJson":"","favorite":"","favoriteCount":0,"hasBeat":"","hotFlag":"","id":0,"metronomeUrl":"","midiUrl":"","mp3Type":"","musicPrice":0,"musicSheetName":"","musicSubject":"","musicTag":"","musicTagNames":"","notation":"","play":"","playSpeed":0,"reason":"","remark":"","showFingering":"","sortNumber":0,"sourceType":"","state":"","subjectNames":"","submitAuditTime":"","topFlag":"","updateBy":0,"updateTime":"","url":"","userId":0,"xmlFileUrl":""}]
-     * limit : 0
-     * nextPage : 0
-     * offset : 0
-     * pageNo : 0
-     * prePage : 0
-     * rows : [{"addName":"","addUserAvatar":"","audioFileUrl":"","audioType":"","auditStatus":"","auditVersion":"","canEvaluate":"","chargeType":"","composer":"","createBy":0,"createTime":"","delFlag":true,"extConfigJson":"","favorite":"","favoriteCount":0,"hasBeat":"","hotFlag":"","id":0,"metronomeUrl":"","midiUrl":"","mp3Type":"","musicPrice":0,"musicSheetName":"","musicSubject":"","musicTag":"","musicTagNames":"","notation":"","play":"","playSpeed":0,"reason":"","remark":"","showFingering":"","sortNumber":0,"sourceType":"","state":"","subjectNames":"","submitAuditTime":"","topFlag":"","updateBy":0,"updateTime":"","url":"","userId":0,"xmlFileUrl":""}]
-     * statInfo : {}
-     * total : 0
-     * totalPage : 0
-     */
+    public List<MusicSheetBean> hotMusicSheet;
+    public List<MusicSheetBean> newMusicSheet;
+    public List<MusicSheetBean> topMusicSheet;
 
-    public int limit;
-    public int nextPage;
-    public int offset;
-    public int pageNo;
-    public int prePage;
-    public int total;
-    public int totalPage;
-    public List<RowsBean> rows;
-
-    public static class RowsBean {
+    public static class MusicSheetBean {
         /**
+         * accompanimentType :
          * addName :
          * addUserAvatar :
+         * albumNums : 0
+         * albumSortNumber : 0
          * audioFileUrl :
          * audioType :
          * auditStatus :
@@ -43,21 +28,25 @@ public class HomeHotMusicSheetBean {
          * createBy : 0
          * createTime :
          * delFlag : true
+         * exquisiteFlag :
          * extConfigJson :
          * favorite :
          * favoriteCount : 0
+         * firstPassAuditTime :
          * hasBeat :
          * hotFlag :
          * id : 0
          * metronomeUrl :
          * midiUrl :
          * mp3Type :
+         * musicImg :
          * musicPrice : 0
          * musicSheetName :
          * musicSubject :
          * musicTag :
          * musicTagNames :
          * notation :
+         * paymentType :
          * play :
          * playSpeed : 0
          * reason :
@@ -68,6 +57,7 @@ public class HomeHotMusicSheetBean {
          * state :
          * subjectNames :
          * submitAuditTime :
+         * titleImg :
          * topFlag :
          * updateBy : 0
          * updateTime :
@@ -76,8 +66,11 @@ public class HomeHotMusicSheetBean {
          * xmlFileUrl :
          */
 
+        public String accompanimentType;
         public String addName;
         public String addUserAvatar;
+        public int albumNums;
+        public int albumSortNumber;
         public String audioFileUrl;
         public String audioType;
         public String auditStatus;
@@ -88,21 +81,25 @@ public class HomeHotMusicSheetBean {
         public int createBy;
         public String createTime;
         public boolean delFlag;
+        public String exquisiteFlag;
         public String extConfigJson;
         public String favorite;
         public int favoriteCount;
+        public String firstPassAuditTime;
         public String hasBeat;
         public String hotFlag;
         public int id;
         public String metronomeUrl;
         public String midiUrl;
         public String mp3Type;
-        public String musicPrice;
+        public String musicImg;
+        public int musicPrice;
         public String musicSheetName;
         public String musicSubject;
         public String musicTag;
         public String musicTagNames;
         public String notation;
+        public String paymentType;
         public String play;
         public int playSpeed;
         public String reason;
@@ -113,14 +110,12 @@ public class HomeHotMusicSheetBean {
         public String state;
         public String subjectNames;
         public String submitAuditTime;
+        public String titleImg;
         public String topFlag;
         public int updateBy;
         public String updateTime;
         public String url;
         public int userId;
         public String xmlFileUrl;
-        public String exquisiteFlag;//是否是精品曲目 0否 1是
-        public String paymentType;
-        public int albumNums;
     }
 }

+ 1 - 1
student/src/main/java/com/cooleshow/student/bean/HomeHotMusicSheetItemBean.java

@@ -6,5 +6,5 @@ import java.util.ArrayList;
  * Author by pq, Date on 2022/8/8.
  */
 public class HomeHotMusicSheetItemBean {
-    public ArrayList<HomeHotMusicSheetBean.RowsBean> sheetBeans =new ArrayList<>();
+    public ArrayList<HomeHotMusicSheetBean.MusicSheetBean> sheetBeans =new ArrayList<>();
 }

+ 0 - 1
student/src/main/java/com/cooleshow/student/presenter/main/HomePresenter.java

@@ -368,7 +368,6 @@ public class HomePresenter extends BasePresenter<HomeContract.HomeView> implemen
         JSONObject jsonObject = new JSONObject();
         try {
             jsonObject.putOpt("myself", false);
-            jsonObject.putOpt("rows", 21);//暂时先加上21
         } catch (JSONException e) {
             e.printStackTrace();
         }

+ 58 - 7
student/src/main/java/com/cooleshow/student/ui/main/NewHomeFragment.java

@@ -87,7 +87,7 @@ import static com.cooleshow.student.constants.CourseConstants.PIANO_ROOM_COURSE;
  * Author by pq, Date on 2022/8/29.
  */
 public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBinding, HomePresenter> implements HomeContract.HomeView, View.OnClickListener, TalentStyleFragment.OnEventListener, HotNewsFragment.OnEventListener {
-    public static final int MAX_HOT_MUSIC_LIST_PAGE = 3;//热门曲目一页最大条数
+    public static final int MAX_HOT_MUSIC_LIST_PAGE = 4;//热门曲目一页最大条数
     public static final int MAX_GOOD_MUSIC_LIST_PAGE = 3;//精品曲目一页最大条数
     private Banner banner;
     private SmartRefreshLayout refreshLayout;
@@ -99,6 +99,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
     private String noticeId;
     private HomeHotAlbumAdapter mAlbumAdapter;
     private HomeHotMusicSheetAdapter mHomeHotMusicSheetAdapter;
+    private HomeHotMusicSheetAdapter mRecommendAdapter;
+    private HomeHotMusicSheetAdapter mLatestAdapter;
     private HomeRecommendTalentAdapter mRecommendTalentAdapter;
     private NewHomeVideoCourseAdapter mHomeVideoCourseAdapter;
     private TalentStyleFragment mTalentStyleFragment;
@@ -154,6 +156,25 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         mViewBinding.rvHotAlbum.addItemDecoration(hotAlbumItemDecoration);
         mViewBinding.rvHotAlbum.setAdapter(mAlbumAdapter);
 
+
+        LinearLayoutManager recommendMusicSheetManager = new LinearLayoutManager(getContext());
+        recommendMusicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        mRecommendAdapter = new HomeHotMusicSheetAdapter();
+        HomeHotMusicSheetItemDecoration itemDecoration1 = new HomeHotMusicSheetItemDecoration(0, SizeUtils.dp2px(12), 0, SizeUtils.dp2px(12), 0);
+        mViewBinding.rvRecommendTrack.addItemDecoration(itemDecoration1);
+        mViewBinding.rvRecommendTrack.setLayoutManager(recommendMusicSheetManager);
+        mViewBinding.rvRecommendTrack.setAdapter(mRecommendAdapter);
+        mViewBinding.rvRecommendTrack.setNestedScrollingEnabled(false);
+
+        LinearLayoutManager latestMusicSheetManager = new LinearLayoutManager(getContext());
+        latestMusicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        mLatestAdapter = new HomeHotMusicSheetAdapter();
+        HomeHotMusicSheetItemDecoration itemDecoration2 = new HomeHotMusicSheetItemDecoration(0, SizeUtils.dp2px(12), 0, SizeUtils.dp2px(12), 0);
+        mViewBinding.rvLatestTrack.addItemDecoration(itemDecoration2);
+        mViewBinding.rvLatestTrack.setLayoutManager(latestMusicSheetManager);
+        mViewBinding.rvLatestTrack.setAdapter(mLatestAdapter);
+        mViewBinding.rvLatestTrack.setNestedScrollingEnabled(false);
+
         //热门曲目
         LinearLayoutManager musicSheetManager = new LinearLayoutManager(getContext());
         musicSheetManager.setOrientation(LinearLayoutManager.HORIZONTAL);
@@ -626,8 +647,42 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         if (isDetached() || homeHotMusicSheetBean == null) {
             return;
         }
+        //推荐曲目
+        if (homeHotMusicSheetBean.topMusicSheet != null && homeHotMusicSheetBean.topMusicSheet.size() > 0) {
+            mViewBinding.clRecommendTrack.setVisibility(View.VISIBLE);
+            ArrayList<HomeHotMusicSheetItemBean> itemBeans = formatMusicSheetData(homeHotMusicSheetBean.topMusicSheet);
+            if (mRecommendAdapter != null) {
+                mRecommendAdapter.setNewInstance(itemBeans);
+            }
+        } else {
+            mViewBinding.clRecommendTrack.setVisibility(View.GONE);
+        }
+
+        //最新曲目
+        if (homeHotMusicSheetBean.newMusicSheet != null && homeHotMusicSheetBean.newMusicSheet.size() > 0) {
+            mViewBinding.clLatestTrack.setVisibility(View.VISIBLE);
+            ArrayList<HomeHotMusicSheetItemBean> itemBeans = formatMusicSheetData(homeHotMusicSheetBean.newMusicSheet);
+            if (mLatestAdapter != null) {
+                mLatestAdapter.setNewInstance(itemBeans);
+            }
+        } else {
+            mViewBinding.clLatestTrack.setVisibility(View.GONE);
+        }
+
+        //最热曲目
+        if (homeHotMusicSheetBean.hotMusicSheet != null && homeHotMusicSheetBean.hotMusicSheet.size() > 0) {
+            mViewBinding.clHotTrack.setVisibility(View.VISIBLE);
+            ArrayList<HomeHotMusicSheetItemBean> itemBeans = formatMusicSheetData(homeHotMusicSheetBean.hotMusicSheet);
+            if (mHomeHotMusicSheetAdapter != null) {
+                mHomeHotMusicSheetAdapter.setNewInstance(itemBeans);
+            }
+        } else {
+            mViewBinding.clHotTrack.setVisibility(View.GONE);
+        }
+    }
+
+    private ArrayList<HomeHotMusicSheetItemBean> formatMusicSheetData(List<HomeHotMusicSheetBean.MusicSheetBean> rows) {
         ArrayList<HomeHotMusicSheetItemBean> itemBeans = new ArrayList<>();
-        List<HomeHotMusicSheetBean.RowsBean> rows = homeHotMusicSheetBean.rows;
         if (rows != null && rows.size() > 0) {
             mViewBinding.clHotTrack.setVisibility(View.VISIBLE);
             int pageCount = 0;
@@ -644,12 +699,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
                 }
                 itemBeans.add(hotMusicSheetItemBean);
             }
-            if (mHomeHotMusicSheetAdapter != null) {
-                mHomeHotMusicSheetAdapter.setNewInstance(itemBeans);
-            }
-        } else {
-            mViewBinding.clHotTrack.setVisibility(View.GONE);
         }
+        return itemBeans;
     }
 
     @Override

+ 2 - 2
student/src/main/java/com/cooleshow/student/widgets/HomeHotMusicSheetItemView.java

@@ -37,7 +37,7 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
     private TextView mTvUploadAuthor;
     private LinearLayout mLlMusicSubject;
     private View mViewLine;
-    private HomeHotMusicSheetBean.RowsBean mBean;
+    private HomeHotMusicSheetBean.MusicSheetBean mBean;
     private ImageView mIvGoodTag;
     private LinearLayout mTagContainer;
     private View mIvAlbumTag;
@@ -85,7 +85,7 @@ public class HomeHotMusicSheetItemView extends FrameLayout {
 
     }
 
-    public void setData(HomeHotMusicSheetBean.RowsBean data) {
+    public void setData(HomeHotMusicSheetBean.MusicSheetBean data) {
         this.mBean = data;
         //曲谱名称
         if (mTvName != null) {

+ 129 - 3
student/src/main/res/layout/fragment_new_home_layout.xml

@@ -459,12 +459,139 @@
                         </androidx.constraintlayout.widget.ConstraintLayout>
 
                         <androidx.constraintlayout.widget.ConstraintLayout
+                            android:id="@+id/cl_recommend_track"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/dp_18"
+                            android:visibility="gone"
+                            app:layout_constraintTop_toBottomOf="@+id/cl_hot_album">
+
+                            <View
+                                android:id="@+id/tv_recommend_track_line"
+                                android:layout_width="4dp"
+                                android:layout_height="17dp"
+                                android:layout_marginStart="25dp"
+                                android:background="@drawable/shape_course_title_tag_bg"
+                                app:layout_constraintBottom_toBottomOf="@+id/tv_recommend_track"
+                                app:layout_constraintLeft_toLeftOf="parent"
+                                app:layout_constraintTop_toTopOf="@+id/tv_recommend_track" />
+
+                            <TextView
+                                android:id="@+id/tv_recommend_track"
+                                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_track_line"
+                                app:layout_constraintTop_toTopOf="parent" />
+
+                            <TextView
+                                android:id="@+id/tv_recommend_track_more"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_marginRight="@dimen/dp_14"
+                                android:background="@drawable/shape_1a2dc7aa_10dp"
+                                android:drawableEnd="@drawable/icon_arrow_right_green"
+                                android:drawablePadding="5dp"
+                                android:gravity="center"
+                                android:paddingStart="7dp"
+                                android:paddingTop="2dp"
+                                android:paddingEnd="5dp"
+                                android:paddingBottom="2dp"
+                                android:text="更多"
+                                android:textColor="@color/color_2dc7aa"
+                                android:textSize="@dimen/sp_12"
+                                app:layout_constraintBottom_toBottomOf="@+id/tv_recommend_track"
+                                app:layout_constraintRight_toRightOf="parent"
+                                app:layout_constraintTop_toTopOf="@+id/tv_recommend_track" />
+
+                            <androidx.recyclerview.widget.RecyclerView
+                                android:id="@+id/rv_recommend_track"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:layout_marginTop="12dp"
+                                android:overScrollMode="never"
+                                android:paddingLeft="@dimen/dp_14"
+                                android:scrollbars="none"
+                                app:layout_constraintTop_toBottomOf="@+id/tv_recommend_track" />
+
+                        </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+                        <androidx.constraintlayout.widget.ConstraintLayout
+                            android:id="@+id/cl_latest_track"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/dp_18"
+                            android:visibility="gone"
+                            app:layout_constraintTop_toBottomOf="@+id/cl_recommend_track">
+
+                            <View
+                                android:id="@+id/tv_latest_track_line"
+                                android:layout_width="4dp"
+                                android:layout_height="17dp"
+                                android:layout_marginStart="25dp"
+                                android:background="@drawable/shape_course_title_tag_bg"
+                                app:layout_constraintBottom_toBottomOf="@+id/tv_latest_track"
+                                app:layout_constraintLeft_toLeftOf="parent"
+                                app:layout_constraintTop_toTopOf="@+id/tv_latest_track" />
+
+                            <TextView
+                                android:id="@+id/tv_latest_track"
+                                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_latest_track_line"
+                                app:layout_constraintTop_toTopOf="parent" />
+
+                            <TextView
+                                android:id="@+id/tv_latest_track_more"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_marginRight="@dimen/dp_14"
+                                android:background="@drawable/shape_1a2dc7aa_10dp"
+                                android:drawableEnd="@drawable/icon_arrow_right_green"
+                                android:drawablePadding="5dp"
+                                android:gravity="center"
+                                android:paddingStart="7dp"
+                                android:paddingTop="2dp"
+                                android:paddingEnd="5dp"
+                                android:paddingBottom="2dp"
+                                android:text="更多"
+                                android:textColor="@color/color_2dc7aa"
+                                android:textSize="@dimen/sp_12"
+                                app:layout_constraintBottom_toBottomOf="@+id/tv_latest_track"
+                                app:layout_constraintRight_toRightOf="parent"
+                                app:layout_constraintTop_toTopOf="@+id/tv_latest_track" />
+
+                            <androidx.recyclerview.widget.RecyclerView
+                                android:id="@+id/rv_latest_track"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:layout_marginTop="12dp"
+                                android:overScrollMode="never"
+                                android:paddingLeft="@dimen/dp_14"
+                                android:scrollbars="none"
+                                app:layout_constraintTop_toBottomOf="@+id/tv_latest_track" />
+
+                        </androidx.constraintlayout.widget.ConstraintLayout>
+
+                        <androidx.constraintlayout.widget.ConstraintLayout
                             android:id="@+id/cl_hot_track"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:layout_marginTop="@dimen/dp_30"
                             android:visibility="gone"
-                            app:layout_constraintTop_toBottomOf="@+id/cl_hot_album">
+                            app:layout_constraintTop_toBottomOf="@+id/cl_latest_track">
 
                             <View
                                 android:id="@+id/tv_hot_track_line"
@@ -512,7 +639,7 @@
                             <androidx.recyclerview.widget.RecyclerView
                                 android:id="@+id/rv_hot_track"
                                 android:layout_width="match_parent"
-                                android:layout_height="239dp"
+                                android:layout_height="wrap_content"
                                 android:layout_marginTop="12dp"
                                 android:overScrollMode="never"
                                 android:paddingLeft="@dimen/dp_14"
@@ -521,7 +648,6 @@
 
                         </androidx.constraintlayout.widget.ConstraintLayout>
 
-
                         <androidx.constraintlayout.widget.ConstraintLayout
                             android:id="@+id/cs_recommend_talent"
                             android:layout_width="match_parent"

+ 0 - 3
teacher/src/main/java/com/cooleshow/teacher/ui/main/NewHomeFragment.java

@@ -482,9 +482,6 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
                 }
                 itemBeans.add(hotMusicSheetItemBean);
             }
-            if (mHomeHotMusicSheetAdapter != null) {
-                mHomeHotMusicSheetAdapter.setNewInstance(itemBeans);
-            }
         }
         return itemBeans;
     }