Procházet zdrojové kódy

增加首页部分H5页面跳转

Pq před 1 rokem
rodič
revize
430822dd22

+ 7 - 0
institution/src/main/java/com/cooleshow/institution/stu/constants/JGWebConstants.java

@@ -16,6 +16,13 @@ public class JGWebConstants {
     //帮助中心
     public static final String HELP_CENTER = getBaseUrlH5() + "/#/helpCenter";
 
+    //搜索
+    public static final String SEARCH_PAGE = getBaseUrlH5() + "/#/music-songbook/search";
+    public static final String HOT_MUSIC_SHEET_LIST = getBaseUrlH5() + "/#/music-list";
+
+    //热门专辑
+    public static final String STUDENT_MUSIC_ALBUM = getBaseUrlH5() + "/#/music-album";
+
     private static String getBaseUrlH5() {
         return BuildConfig.BASE_URL_H5_JG;
     }

+ 24 - 0
institution/src/main/java/com/cooleshow/institution/stu/constants/JGWebStartHelper.java

@@ -47,4 +47,28 @@ public class JGWebStartHelper {
                 .navigation();
     }
 
+    public static void startSearch() {
+        ARouter.getInstance()
+                .build(RouterPath.WebCenter.ACTIVITY_HTML)
+                .withString(WebConstants.WEB_URL, JGWebConstants.SEARCH_PAGE)
+                .navigation();
+    }
+
+    /**
+     * 热门曲目
+     */
+    public static void startHotMusicSheetList() {
+        ARouter.getInstance()
+                .build(RouterPath.WebCenter.ACTIVITY_HTML)
+                .withString(WebConstants.WEB_URL, JGWebConstants.HOT_MUSIC_SHEET_LIST)
+                .navigation();
+    }
+
+    public static void startHotAlbumMore() {
+        //热门专辑
+        ARouter.getInstance()
+                .build(RouterPath.WebCenter.ACTIVITY_HTML)
+                .withString(WebConstants.WEB_URL, JGWebConstants.STUDENT_MUSIC_ALBUM)
+                .navigation();
+    }
 }

+ 79 - 0
institution/src/main/java/com/cooleshow/institution/stu/ui/main/HomeMusicFragment.java

@@ -1,16 +1,20 @@
 package com.cooleshow.institution.stu.ui.main;
 
+import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.View;
 
 import com.alibaba.android.arouter.launcher.ARouter;
 import com.bumptech.glide.Glide;
+import com.cooleshow.base.bean.TeachableInstrumentBean;
 import com.cooleshow.base.common.WebConstants;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
 import com.cooleshow.base.utils.SizeUtils;
+import com.cooleshow.base.utils.UiUtils;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.base.utils.helper.WebStartHelper;
 import com.cooleshow.institution.stu.R;
 import com.cooleshow.institution.stu.adapter.HomeHotAlbumAdapter;
 import com.cooleshow.institution.stu.adapter.HomeHotMusicSheetAdapter;
@@ -21,6 +25,7 @@ import com.cooleshow.institution.stu.bean.HomePageMode;
 import com.cooleshow.institution.stu.bean.HotAlbumBean;
 import com.cooleshow.institution.stu.constants.Constants;
 import com.cooleshow.institution.stu.constants.JGWebConstants;
+import com.cooleshow.institution.stu.constants.JGWebStartHelper;
 import com.cooleshow.institution.stu.contract.HomeMusicContract;
 import com.cooleshow.institution.stu.databinding.FgHomeMusicLayoutBinding;
 import com.cooleshow.institution.stu.presenter.HomeMusicPresenter;
@@ -35,6 +40,7 @@ import com.youth.banner.holder.BannerImageHolder;
 import com.youth.banner.indicator.RectangleIndicator;
 import com.youth.banner.listener.OnBannerListener;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -54,6 +60,8 @@ public class HomeMusicFragment extends BaseMVPFragment<FgHomeMusicLayoutBinding,
     private HomeHotMusicSheetAdapter mHomeHotMusicSheetAdapter;
     private BannerImageAdapter mBannerImageAdapter;
 
+    private StudentUserInfo mUserInfo;
+
     private ArrayList<AppHomeBean.ItemBean> itemBeans = new ArrayList<>();
 
     @Override
@@ -131,7 +139,13 @@ public class HomeMusicFragment extends BaseMVPFragment<FgHomeMusicLayoutBinding,
     }
 
     private void initListener() {
+        mViewBinding.tvSubject.setOnClickListener(this);
         mViewBinding.ivPractice.setOnClickListener(this);
+        mViewBinding.viewSearchBg.setOnClickListener(this);
+        mViewBinding.tvHotAlbumMore.setOnClickListener(this);
+        mViewBinding.tvHotTrackMore.setOnClickListener(this);
+        mViewBinding.tvRecommendTrackMore.setOnClickListener(this);
+        mViewBinding.tvLatestTrackMore.setOnClickListener(this);
         mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
             @Override
             public void onRefresh(@NonNull RefreshLayout refreshLayout) {
@@ -183,6 +197,68 @@ public class HomeMusicFragment extends BaseMVPFragment<FgHomeMusicLayoutBinding,
             mHomeViewModel.getHomePageModeEvent().postValue(new HomePageMode(Constants.PRACTICE_TUTORIALS));
             return;
         }
+
+        if (id == R.id.tv_subject) {
+            goSelectSubject();
+            return;
+        }
+
+        if (id == R.id.view_search_bg) {
+            JGWebStartHelper.startSearch();
+            return;
+        }
+
+        if (id == R.id.tv_hot_track_more) {
+            if (UiUtils.isFastClick()) {
+                return;
+            }
+            //热门曲目更多
+            JGWebStartHelper.startHotMusicSheetList();
+            return;
+        }
+        if (id == R.id.tv_recommend_track_more) {
+            if (UiUtils.isFastClick()) {
+                return;
+            }
+            //推荐曲目 最新曲目更多
+            JGWebStartHelper.startHotMusicSheetList();
+            return;
+        }
+
+        if (id == R.id.tv_latest_track_more) {
+            if (UiUtils.isFastClick()) {
+                return;
+            }
+            //推荐曲目 最新曲目更多
+            JGWebStartHelper.startHotMusicSheetList();
+            return;
+        }
+
+        if (id == R.id.tv_hot_album_more) {
+            if (UiUtils.isFastClick()) {
+                return;
+            }
+            JGWebStartHelper.startHotAlbumMore();
+            return;
+        }
+    }
+
+    private void goSelectSubject() {
+        if (mUserInfo == null) {
+            return;
+        }
+        try {
+            Bundle bundle = new Bundle();
+            TeachableInstrumentBean teachableInstrumentBean = new TeachableInstrumentBean();
+            teachableInstrumentBean.id = Long.parseLong(mUserInfo.subjectId);
+            teachableInstrumentBean.name = mUserInfo.subjectName;
+            bundle.putSerializable("selectTeachableInstrument", (Serializable) teachableInstrumentBean);
+            ARouter.getInstance().build(RouterPath.MineCenter.MINE_TEACHABLE_INSTRUMENT)
+                    .withBundle("bundle", bundle)
+                    .navigation();
+        } catch (Exception e) {
+
+        }
     }
 
     @Override
@@ -294,7 +370,10 @@ public class HomeMusicFragment extends BaseMVPFragment<FgHomeMusicLayoutBinding,
 
     public void refreshUserInfo(StudentUserInfo data) {
         if (data != null) {
+            this.mUserInfo = data;
             mViewBinding.tvName.setText(data.getTenantName());
+            mViewBinding.tvSubject.setText(data.subjectName);
         }
     }
+
 }

binární
institution/src/main/res/drawable-xhdpi/jg_hot_track_title.png


binární
institution/src/main/res/drawable-xxhdpi/jg_hot_track_title.png


+ 4 - 0
institution/src/main/res/layout/fg_home_music_layout.xml

@@ -205,6 +205,7 @@
                         app:layout_constraintTop_toTopOf="parent" />
 
                     <TextView
+                        android:id="@+id/tv_hot_album_more"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:drawableEnd="@drawable/icon_arrow_right"
@@ -250,6 +251,7 @@
                         app:layout_constraintTop_toTopOf="parent" />
 
                     <TextView
+                        android:id="@+id/tv_recommend_track_more"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:drawableEnd="@drawable/icon_arrow_right"
@@ -296,6 +298,7 @@
                         app:layout_constraintTop_toTopOf="parent" />
 
                     <TextView
+                        android:id="@+id/tv_latest_track_more"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:drawableEnd="@drawable/icon_arrow_right"
@@ -341,6 +344,7 @@
                         app:layout_constraintTop_toTopOf="parent" />
 
                     <TextView
+                        android:id="@+id/tv_hot_track_more"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:drawableEnd="@drawable/icon_arrow_right"