Android简易音乐重构MVVM Java版-新增推荐雷达歌单详情列表界面(十八)

Posted 雪の星空朝酱

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android简易音乐重构MVVM Java版-新增推荐雷达歌单详情列表界面(十八)相关的知识,希望对你有一定的参考价值。

android简易音乐重构MVVM Java版-新增推荐、雷达歌单详情列表界面(十八)

关于

  本篇主要实现首页发现中推荐歌单和雷达歌单的点击跳转歌单列表界面和播放功能。
简易音乐app仅作为学习用,禁止用于商业及非法用途,如产生法律纠纷与本人无关

效果

修改ApiService

  增加歌单详情接口

 @GET("playlist/detail")//获取歌单详情列表
    LiveData<ApiResponse<RecommendListEntity>> getPlayList(@Query("id") long creativeId);

增加歌单列表实体类RecommendListEntity

@NoArgsConstructor
@Data
public class RecommendListEntity 

    private int code;
    private Object relatedVideos;
    private PlaylistEntity playlist;
    private Object urls;
    private List<PrivilegesEntity> privileges;
    private Object sharedPrivilege;
    private Object resEntrance;

    @NoArgsConstructor
    @Data
    public static class PlaylistEntity 
        private long id;
        private String name;
        private long coverImgId;
        private String coverImgUrl;
        private String coverImgId_str;
        private int adType;
        private long userId;
        private long createTime;
        private int status;
        private boolean opRecommend;
        private boolean highQuality;
        private boolean newImported;
        private long updateTime;
        private int trackCount;
        private int specialType;
        private int privacy;
        private long trackUpdateTime;
        private String commentThreadId;
        private long playCount;
        private long trackNumberUpdateTime;
        private int subscribedCount;
        private int cloudTrackCount;
        private boolean ordered;
        private String description;
        private List<String> tags;
        private Object updateFrequency;
        private long backgroundCoverId;
        private Object backgroundCoverUrl;
        private long titleImage;
        private Object titleImageUrl;
        private Object englishTitle;
        private Object officialPlaylistType;
        private List<SubscribersEntity> subscribers;
        private boolean subscribed;
        private CreatorEntity creator;
        private List<TracksEntity> tracks;
        private Object videoIds;
        private Object videos;
        private List<TrackIdsEntity> trackIds;
        private int shareCount;
        private int commentCount;
        private Object remixVideo;
        private Object sharedUsers;
        private Object historySharedUsers;
        private String gradeStatus;
        private Object score;
        private Object algTags;

        @NoArgsConstructor
        @Data
        public static class CreatorEntity 
            private boolean defaultAvatar;
            private int province;
            private int authStatus;
            private boolean followed;
            private String avatarUrl;
            private int accountStatus;
            private int gender;
            private int city;
            private int birthday;
            private long userId;
            private int userType;
            private String nickname;
            private String signature;
            private String description;
            private String detailDescription;
            private long avatarImgId;
            private long backgroundImgId;
            private String backgroundUrl;
            private int authority;
            private boolean mutual;
            private List<String> expertTags;
            private ExpertsEntity experts;
            private int djStatus;
            private int vipType;
            private Object remarkName;
            private int authenticationTypes;
            private AvatarDetailEntity avatarDetail;
            private String avatarImgIdStr;
            private String backgroundImgIdStr;
            private boolean anchor;
            private String avatarImgId_str;

            @NoArgsConstructor
            @Data
            public static class ExpertsEntity 
                @SerializedName("1")
                private String _$1;
                @SerializedName("2")
                private String _$2;
            

            @NoArgsConstructor
            @Data
            public static class AvatarDetailEntity 
                private int userType;
                private int identityLevel;
                private String identityIconUrl;
            
        

        @NoArgsConstructor
        @Data
        public static class SubscribersEntity 
            private boolean defaultAvatar;
            private int province;
            private int authStatus;
            private boolean followed;
            private String avatarUrl;
            private int accountStatus;
            private int gender;
            private int city;
            private int birthday;
            private long userId;
            private int userType;
            private String nickname;
            private String signature;
            private String description;
            private String detailDescription;
            private long avatarImgId;
            private long backgroundImgId;
            private String backgroundUrl;
            private int authority;
            private boolean mutual;
            private Object expertTags;
            private Object experts;
            private int djStatus;
            private int vipType;
            private Object remarkName;
            private int authenticationTypes;
            private Object avatarDetail;
            private String avatarImgIdStr;
            private String backgroundImgIdStr;
            private boolean anchor;
            private String avatarImgId_str;
        

        @NoArgsConstructor
        @Data
        public static class TracksEntity 
            private String name;
            private int id;
            private int pst;
            private int t;
            private List<ArEntity> ar;
            private List<String> alia;
            private int pop;
            private int st;
            private String rt;
            private int fee;
            private int v;
            private Object crbt;
            private String cf;
            private AlEntity al;
            private int dt;
            private HEntity h;
            private MEntity m;
            private LEntity l;
            private Object sq;
            private Object hr;
            private Object a;
            private String cd;
            private int no;
            private Object rtUrl;
            private int ftype;
            private List<?> rtUrls;
            private int djId;
            private int copyright;
            private int s_id;
            private long mark;
            private int originCoverType;
            private Object originSongSimpleData;
            private Object tagPicList;
            private boolean resourceState;
            private int version;
            private Object songJumpInfo;
            private Object entertainmentTags;
            private int single;
            private Object noCopyrightRcmd;
            private Object alg;
            private int mst;
            private int cp;
            private int mv;
            private int rtype;
            private Object rurl;
            private long publishTime;

            @NoArgsConstructor
            @Data
            public static class AlEntity 
                private int id;
                private String name;
                private String picUrl;
                private List<?> tns;
                private String pic_str;
                private long pic;
            

            @NoArgsConstructor
            @Data
            public static class HEntity 
                private int br;
                private int fid;
                private int size;
                private int vd;
                private int sr;
            

            @NoArgsConstructor
            @Data
            public static class MEntity 
                private int br;
                private int fid;
                private int size;
                private int vd;
                private int sr;
            

            @NoArgsConstructor
            @Data
            public static class LEntity 
                private int br;
                private int fid;
                private int size;
                private int vd;
                private int sr;
            

            @NoArgsConstructor
            @Data
            public static class ArEntity 
                private int id;
                private String name;
                private List<?> tns;
                private List<?> alias;
            
        

        @NoArgsConstructor
        @Data
        public static class TrackIdsEntity 
            private int id;
            private int v;
            private int t;
            private long at;
            private Object alg;
            private long uid;
            private String rcmdReason;
            private Object sc;
        
    

    @NoArgsConstructor
    @Data
    public static class PrivilegesEntity 
        private int id;
        private int fee;
        private int payed;
        private int realPayed;
        private int st;
        private int pl;
        private int dl;
        private int sp;
        private int cp;
        private int subp;
        private boolean cs;
        private int maxbr;
        private int fl;
        private Object pc;
        private boolean toast;
        private int flag;
        private boolean paidBigBang;
        private boolean preSell;
        private int playMaxbr;
        private int downloadMaxbr;
        private String maxBrLevel;
        private String playMaxBrLevel;
        private String downloadMaxBrLevel;
        private String plLevel;
        private String dlLevel;
        private String flLevel;
        private Object rscl;
        private FreeTrialPrivilegeEntity freeTrialPrivilege;
        private List<ChargeInfoListEntity> chargeInfoList;

        @NoArgsConstructor
        @Data
        public static class FreeTrialPrivilegeEntity 
            private boolean resConsumable;
            private boolean userConsumable;
            private Object listenType;
        

        @NoArgsConstructor
        @Data
        public static class ChargeInfoListEntity 
            private int rate;
            private Object chargeUrl;
            private Object chargeMessage;
            private int chargeType;
        
    

新增歌单列表界面

  新增页面activity_mine_play_list.xml:

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".ui.daily.MinePlayListActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/Theme.PersonalMusic.AppBarOverlay">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            style="@style/Widget.MaterialComponents.Toolbar.Primary"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:toolbarId="@+id/toolbar">

            <ImageView
                android:id="@+id/img_bg"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_collapseMode="parallax"
                />

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_gravity="top"
                android:layout_width="match_parent"
                android:layout_height="@dimen/dp_45"
                app:layout_collapseMode="pin">

                <include
                    android:id="@+id/title"
                    layout="@layout/ui_common_play_title"
                    app:layout_collapseMode="pin"/>
            </androidx.appcompat.widget.Toolbar>

        </com.google.android.material.appbar.CollapsingToolbarLayout>
    </com.google.android.material.appbar.AppBarLayout>

    <include layout="@layout/content_scrolling"
        android:id="@+id/content"/>



</androidx.coordinatorlayout.widget.CoordinatorLayout>

  对应content_scrolling.xml:

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".ui.daily.MinePlayListActivity"
    tools:showIn="@layout/activity_mine_play_list">

   <androidx.constraintlayout.widget.ConstraintLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent">

       <RelativeLayout
           android:id="@+id/rv_play_top"
           android:layout_width="match_parent"
           android:layout_height="@dimen/dp_40"
           app:layout_constraintTop_toTopOf="parent"
           tools:ignore="RtlSymmetry">

           <TextView
               android:id="@+id/img_play"
               android:layout_width="@dimen/dp_24"
               android:layout_height="@dimen/dp_24"
           

以上是关于Android简易音乐重构MVVM Java版-新增推荐雷达歌单详情列表界面(十八)的主要内容,如果未能解决你的问题,请参考以下文章

Android简易音乐重构MVVM Java版-新增启动动画

Android简易音乐重构MVVM Java版-新增推荐菜单及侧边栏展示

Android简易音乐重构MVVM Java版-BottomNavigationView+viewpager主界面结构

Android简易音乐重构MVVM Java版-新增推荐雷达歌单详情列表界面(十八)

Android简易音乐重构MVVM Java版-新增推荐雷达歌单详情列表界面(十八)

Android简易音乐重构MVVM Java版-新增歌曲播放界面+状态栏黑科技(十七)