Browse Source

增加顶部大封面的开关
因为启动该开关部分设备封面太大导致和音乐控制重叠。
修复EntryAbility不判断是不是会员

onecold 1 year ago
parent
commit
d510b2f81d

+ 3 - 1
entry/src/main/ets/entryability/EntryAbility.ets

@@ -23,6 +23,7 @@ import { systemShare } from '@kit.ShareKit';
 import Logger from '../common/util/Logger';
 import statusBarManager from '@hms.pcService.statusBarManager';
 import StatusBarViewExtensionAbility from '@hms.pcService.StatusBarViewExtensionAbility';
+import { SpiderMan } from '@simplepeng/spider-man';
 
 /**
  * 主Ability类,继承自UIAbility
@@ -148,7 +149,8 @@ export default class EntryAbility extends UIAbility {
 
     onWindowStageCreate(windowStage: window.WindowStage) {
         // Main window is created, set main page for this ability
-        hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');;
+        hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+        SpiderMan.init();
         AppUtil.init(this.context);
         //1.获取应用主窗口。
         let windowClass: window.Window | null = null;

+ 3 - 3
entry/src/main/ets/entryability/ShareUIAbility.ets

@@ -31,9 +31,9 @@ export default class ShareUIAbility extends UIAbility {
 
   onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
     AppStorage.setOrCreate('context', this.context);
-    let timeout = 5000
-    if(Utility.isNoble())
-      timeout = 2000
+    let timeout = 2000
+    // if(Utility.isNoble())
+    //   timeout = 2000
     setTimeout(()=>{
       this.handleShare(want)//分享打开的音频
     },timeout)

+ 59 - 1
entry/src/main/ets/pages/SettingPage.ets

@@ -41,8 +41,10 @@ export struct SettingPage {
   static readonly BG_BRIGHTNESS: string = 'bg_brightness';
   static readonly IS_SHOW_ALLBAR: string = 'IS_SHOW_ALLBAR';
   static readonly IS_SHOW_TITLTBAR: string = 'IS_SHOW_TITLTBAR';
+  static readonly IS_SHOW_PLAYPAGE_BACK: string = 'IS_SHOW_PLAYPAGE_BACK';
   static readonly IS_CIRCLE_BTN: string = 'isCircleBtn';
   static readonly IS_COVER_TOP: string = 'IS_COVER_TOP';
+  static readonly IS_COVER_TOP_BIG: string = 'IS_COVER_TOP_BIG';
   public static THEME_COLOR_KEY: string = 'THEME_COLOR';
   public static TWO_FINGER_TYPE: string = 'twoFingerType';
   public static THEME_COLOR_LIST: Array<ThemeColorItem> = [
@@ -80,6 +82,7 @@ export struct SettingPage {
   @State isShowSimi: boolean = false //是否显示私密音频
   @State isShowFAV: boolean = true //是否显示我的收藏
   @State isShowHistory: boolean = true //是否显示最近播放
+  @State isShowPlayPageBack: boolean = false //是否显示播放页返回键
   @State isCustomizeBg: boolean = false //自定义背景界面
   @State isCustomizeBgSheet: boolean = false //自定义背景界面
   @State isShowTitleBar: boolean = true //是否显示分类导航条
@@ -93,6 +96,8 @@ export struct SettingPage {
   @State isSameTimePlay: boolean = false //是否和其他app同时播放
   @State isSavePlayMode: boolean = true
   @State isCoverTop: boolean = true
+  @State isCoverTopBig: boolean = false//顶部大封面部分手机显示会和播放控制页重叠
+
   @State customizeBgPath: string | undefined = '';
   context = getContext(this);
   @State showCoverApiDialog: boolean = false
@@ -203,6 +208,8 @@ export struct SettingPage {
     this.isCoverTop = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP, false)
     this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
     this.isShowAllBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_ALLBAR, true)
+    this.isShowPlayPageBack = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_PLAYPAGE_BACK, false)
+    this.isCoverTopBig = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP_BIG, false)
     // 只用 themeMode 控制主题
     this.themeMode = PreferencesUtil.getNumberSync(SettingPage.THEME_MODE, 0)
     this.applyThemeMode(this.themeMode)
@@ -665,7 +672,7 @@ export struct SettingPage {
 
             // 网格封面大
             Row() {
-              Text('大封面')
+              Text('列表封面大小')
                 .margin({ left: 18 })
                 .fontSize(15)
                 .fontColor(Color.Gray)
@@ -714,6 +721,32 @@ export struct SettingPage {
             .height(55)
             .clickEffect({ level: ClickEffectLevel.HEAVY })
 
+            Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+            // 封面顶部
+            Row() {
+              Text('顶部大封面')
+                .margin({ left: 18 })
+                .fontSize(15)
+                .fontColor(Color.Gray)
+                .fontWeight(480)
+                .layoutWeight(1)
+              Toggle({ type: ToggleType.Switch, isOn: this.isCoverTopBig })
+                .selectedColor(this.themeColor)
+                .switchPointColor(Color.White)
+                .margin({ right: 18 })
+                .onChange((checked: boolean) => {
+                  this.isCoverTopBig = checked;
+                  if(this.isCoverTopBig){
+                    ToastUtil.showToast('启动该开关部分设备封面太大导致和音乐控制重叠!')
+                  }
+                  PreferencesUtil.put(SettingPage.IS_COVER_TOP_BIG, this.isCoverTopBig)
+                  this.sendChangeEvent()
+                })
+                .width(50)
+                .height(30);
+            }
+            .height(55)
+            .clickEffect({ level: ClickEffectLevel.HEAVY })
 
 
             Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
@@ -1078,6 +1111,31 @@ export struct SettingPage {
       .height(55)
       .clickEffect({ level: ClickEffectLevel.HEAVY })
 
+
+      Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+      // 播放页返回键
+      Row() {
+        Text('显示播放页返回键')
+          .margin({ left: 18 })
+          .fontSize(15)
+          .fontColor(Color.Gray)
+          .fontWeight(480)
+          .layoutWeight(1)
+        Toggle({ type: ToggleType.Switch, isOn: this.isShowPlayPageBack })
+          .selectedColor(this.themeColor)
+          .switchPointColor(Color.White)
+          .margin({ right: 18 })
+          .onChange((checked: boolean) => {
+            this.isShowPlayPageBack = checked;
+            PreferencesUtil.put(SettingPage.IS_SHOW_PLAYPAGE_BACK, this.isShowPlayPageBack)
+            this.sendChangeEvent()
+          })
+          .width(50)
+          .height(30);
+      }
+      .height(55)
+      .clickEffect({ level: ClickEffectLevel.HEAVY })
+
       Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
       // 显示我的收藏
       Row() {

+ 24 - 5
entry/src/main/ets/view/LocalMusic.ets

@@ -173,7 +173,9 @@ export struct LocalMusic {
   @State isScrollHide: boolean = false //是否滚动隐藏
   @State isSameTimePlay: boolean = false //是否和其他app同时播放
   @State isStartAutoPlay: boolean = false //启动后自动播放
+  @State isShowPlayPageBack: boolean = false //是否显示播放页返回键
   @State isMemoryLastPlay: boolean = false //是否启用应用退出记忆最后一首的播放进度
+  @State isCoverTopBig: boolean = false//顶部大封面部分手机显示会和播放控制页重叠
   @State customizeBgPath: string | undefined = '';
   @State isDarkMode: boolean = false
   @State lyricTextWeight: number = 400
@@ -569,6 +571,8 @@ export struct LocalMusic {
     this.twoFingerType = PreferencesUtil.getNumberSync(SettingPage.TWO_FINGER_TYPE, 3)
     this.isCoverTop = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP, false)
     this.isCircleBtn = PreferencesUtil.getBooleanSync(SettingPage.IS_CIRCLE_BTN, false)
+    this.isShowPlayPageBack = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_PLAYPAGE_BACK, false)
+    this.isCoverTopBig = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP_BIG, false)
     if (this.isSavePlayMode) {
       this.playType = PreferencesUtil.getNumberSync('musicPlayType', 0)
     }
@@ -3097,7 +3101,7 @@ export struct LocalMusic {
         // [EndExclude GridItem_start]
       }, (item: VideoItem) => item.filePath)
     }
-    .width('100%')
+    .width('94%')
     .height('100%')
     .editMode(true)
     .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
@@ -3108,7 +3112,7 @@ export struct LocalMusic {
     .supportAnimation(true)
     .cachedCount(3)
     // .columnsTemplate('1fr '.repeat(this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM ? 2 : 5))
-    .columnsTemplate(this.twoFingerType==3?'repeat(auto-fit, 150)':this.twoFingerType==2?'repeat(auto-fit, 110)':'repeat(auto-fit, 80)')
+    .columnsTemplate(this.twoFingerType==3?'repeat(auto-fit, 160)':this.twoFingerType==2?'repeat(auto-fit, 110)':'repeat(auto-fit, 80)')
     .rowsGap(this.twoFingerType==3?10:this.twoFingerType==2?5:1)
     .visibility(this.isGridMusic?Visibility.Visible:Visibility.None)
     .scale({x:this.scaleValue,y:this.scaleValue,z:1})
@@ -5229,7 +5233,7 @@ export struct LocalMusic {
           .margin({ top: 0 })
           .height(PlayConstants.HEIGHT)
           .visibility(DeviceUtil.getDeviceType()==resourceManager.DeviceType.DEVICE_TYPE_2IN1?
-          Visibility.Visible:Visibility.None)
+          Visibility.Visible:this.isShowPlayPageBack?Visibility.Visible:Visibility.None)
 
           // .visibility(this.currentBreakpoint !== BreakpointTypeEnum.SM
           //   ?Visibility.Visible:Visibility.Visible)
@@ -6231,6 +6235,21 @@ export struct LocalMusic {
       curve: 'ease-in-out' // 可选动画曲线
     })
   }
+
+  isBigScreen(){
+    if(this.currentWidthBreakpoint == WidthBreakpoint.WIDTH_LG){
+      return true
+    }
+    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
+      && this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM
+      &&this.currentHeightBreakpoint == HeightBreakpoint.HEIGHT_LG) {
+      return false
+    }else{
+      return true
+    }
+    return false
+  }
+
   @State isAutoHide: boolean = true//手机横屏自动隐藏播放进退条,点击屏幕可以显示,倒计时4秒后又自动隐藏
   @State isCoverRectangle: boolean = false
   @State isCoverTop: boolean = true
@@ -6278,10 +6297,10 @@ export struct LocalMusic {
           if(this.isCoverTop&&!this.isCoverOpacity()&&this.isCoverRectangle){
             Image(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover)
               // .height(this.isCoverOpacity() ? 250 : this.isCoverRectangle ? 320 : 162)
-              .width('100%')
+              .width(this.isBigScreen()?'72%':this.isCoverTopBig?'100%':'86%')
               .objectFit(this.isCoverRectangle ? ImageFit.Contain : ImageFit.Auto)
               .alt(this.imageLabel)
-              .margin({ right: 8, left: 8 })
+              .margin({ right: 8, left: 8,top:8 })
               .aspectRatio(1)
               .visibility(this.isPuraWP()?Visibility.None:Visibility.Visible)
               .borderRadius(this.isCoverRectangle ? 20 : '100%')