Ver Fonte

修复purax外屏的背景滑动歌词界面变化

onecold há 1 ano atrás
pai
commit
148b96c27a

+ 1 - 1
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -20,7 +20,7 @@ import { VideoSpeed } from '../../viewmodel/VideoSpeed';
  */
 export class CommonConstants {
 
-  static readonly OPEN_DATE: string = '2025-06-06';
+  static readonly OPEN_DATE: string = '2025-06-08';
 
   static readonly ICP_NO: string = '闽ICP备18015191号-16A';
 

+ 130 - 117
entry/src/main/ets/view/LocalMusic.ets

@@ -174,6 +174,7 @@ export struct LocalMusic {
   @State customizeBgPath: string | undefined = '';
   @State isDarkMode: boolean = false
   @State lyricTextWeight: number = 400
+  @State currentSwiperIndex: number = 0
   @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
     ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
 
@@ -4475,6 +4476,10 @@ export struct LocalMusic {
             this.CoverInfo()
             this.PlayerLyrics()
           }
+          .onChange((index:number)=>{
+            this.currentSwiperIndex = index
+
+          })
           .indicator(false)
           // .indicator(this.currentBreakpoint === BreakpointTypeEnum.SM ?
           //   new DotIndicator()
@@ -4521,11 +4526,14 @@ export struct LocalMusic {
 
     }
     // .backgroundImage(this.imageLabelBg)
-    .backgroundImage(this.isPuraWP()?(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover):this.imageLabelBg)
+    .backgroundImage(this.isPuraWP()&&this.currentSwiperIndex===0?(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover):this.imageLabelBg)
     .backgroundImageSize(this.isPuraWP()?{ width: '100%' }:{ height: '150%', width: '100%' })
     // .backgroundImagePosition(Alignment.Center)
-    // .backgroundColor(this.imageColor)
-    .backgroundBlurStyle(this.isPuraWP()?BlurStyle.NONE:BlurStyle.BACKGROUND_ULTRA_THICK)
+    .animation({
+      duration: 666,
+      curve: 'ease-in-out' // 可选动画曲线
+    })
+    .backgroundBlurStyle(this.isPuraWP()&&this.currentSwiperIndex===0?BlurStyle.NONE:BlurStyle.BACKGROUND_ULTRA_THICK)
     .hitTestBehavior(HitTestMode.Transparent)
     .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
   }
@@ -5166,7 +5174,7 @@ export struct LocalMusic {
         Column() {
           Image(this.CONTROL_PlayStatus === PlayStatus.PLAY ?
           $r('app.media.ic_public_play') : $r('app.media.ic_public_pause'))
-            .width(60)
+            .width(this.isPhoneLan()?48:60)
             .aspectRatio(CommonConstants.ASPECT_RATIO)
             .onClick(async () => {
               this.playOrPause()
@@ -5203,109 +5211,116 @@ export struct LocalMusic {
       .margin(10)
 
       //播放进度条
-      Row() {
+      this.playProgressView()
 
-        Column() {
-          if (this.playType === 0) {
-            Image($r('app.media.loop'))
-              .width($r('app.float.control_image_width'))
-              .margin(10)
-              .aspectRatio(CommonConstants.ASPECT_RATIO)
-          } else if (this.playType === 1) {
-            Image($r('app.media.single'))
-              .width($r('app.float.control_image_width'))
-              .margin(10)
-              .aspectRatio(CommonConstants.ASPECT_RATIO)
-          } else if (this.playType === 2) {
-            Image($r('app.media.normal_play'))
-              .width($r('app.float.control_image_width'))
-              .margin(10)
-              .aspectRatio(CommonConstants.ASPECT_RATIO)
-          } else if (this.playType === 3) {
-            Image($r('app.media.random'))
-              .width($r('app.float.control_image_width'))
-              .margin(10)
-              .aspectRatio(CommonConstants.ASPECT_RATIO)
-          }
-        }
-        .onClick(async () => {
-          this.setLoopMode()
+      // .visibility(this.isHide?Visibility.Hidden:Visibility.Visible)
 
+    }
+    .position({ bottom:this.isCoverOpacity()?55: 80 }) // 将  固定在底部
 
-        })
+  }
 
+  //播放进度条
+  @Builder
+  playProgressView(){
+    Row() {
 
-        Text(this.currentTime)
-          .fontSize($r('app.float.slider_font_size'))
-          .fontColor(Color.White)
-          .margin(3)
-        Slider({
-          value: this.progressValue,
-          min: 0,
-          max: this.PROGRESS_MAX_VALUE,
-          step: 1,
-          style: SliderStyle.OutSet
-        })
-          .width('600px')
-          .blockColor(Color.White)
-          .trackColor($r('app.color.track_color'))
-          .selectedColor(Color.White)
-          .trackThickness(PlayConstants.PROGRESS_TRACK_THICKNESS)
-          .layoutWeight(1)
-          .margin({ left: PlayConstants.PROGRESS_MARGIN_LEFT })
-          .showSteps(true)
-          .showTips(true)
-          .enabled(this.slideEnable)
-          .onChange((value: number, mode: SliderChangeMode) => {
-            // if (mode == 2) {
-            this.isSeekTo = true;
-            this.mDestroyPage = false;
-            this.showLoadIng();
-            LogUtils.getInstance().LOGI("slider-->seekValue start:" + value);
-            let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
-            this.seekTo(seekValue + "");
-            // this.setProgress()
-            LogUtils.getInstance().LOGI("slider-->seekValue end:" + seekValue);
-            this.isSeekTo = false;
-            // }
-          })
-        Text(this.totalTime)
-          .fontSize($r('app.float.slider_font_size'))
-          .fontColor(Color.White)
-          .margin(3)
-          .margin({ left: PlayConstants.PROGRESS_MARGIN_LEFT })
+      Column() {
+        if (this.playType === 0) {
+          Image($r('app.media.loop'))
+            .width($r('app.float.control_image_width'))
+            .margin(10)
+            .aspectRatio(CommonConstants.ASPECT_RATIO)
+        } else if (this.playType === 1) {
+          Image($r('app.media.single'))
+            .width($r('app.float.control_image_width'))
+            .margin(10)
+            .aspectRatio(CommonConstants.ASPECT_RATIO)
+        } else if (this.playType === 2) {
+          Image($r('app.media.normal_play'))
+            .width($r('app.float.control_image_width'))
+            .margin(10)
+            .aspectRatio(CommonConstants.ASPECT_RATIO)
+        } else if (this.playType === 3) {
+          Image($r('app.media.random'))
+            .width($r('app.float.control_image_width'))
+            .margin(10)
+            .aspectRatio(CommonConstants.ASPECT_RATIO)
+        }
+      }
+      .onClick(async () => {
+        this.setLoopMode()
 
 
-        //播放列表
-        Image($r('app.media.playlist'))
-          .width($r('app.float.control_image_width'))
-          .margin({ right: 10, left: 20 })
-          .aspectRatio(CommonConstants.ASPECT_RATIO)
-          .bindSheet($$this.isShowSheetView, this.PlayListSheet(), {
-            height: '95%',
-            dragBar: true,
-            showClose: true,
-            preferType: this.currentBreakpoint !== BreakpointTypeEnum.SM ? SheetType.CENTER : SheetType.BOTTOM,
-            blurStyle: BlurStyle.Thin,
-            backgroundColor: Color.Transparent,
-            title: {
-              title: Utility.resourceToString(this.context, $r('app.string.current_play_list'))
-                + `(${this.songList.length}首)`
-            }
-          })
-          .onClick(() => {
-            this.isShowSheetView = !this.isShowSheetView;
-            this.isFrontWhite = true
-          })
+      })
 
-      }
-      .width(PlayConstants.PROGRESS_ROW_WIDTH)
 
-      // .visibility(this.isHide?Visibility.Hidden:Visibility.Visible)
+      Text(this.currentTime)
+        .fontSize($r('app.float.slider_font_size'))
+        .fontColor(Color.White)
+        .margin(3)
+      Slider({
+        value: this.progressValue,
+        min: 0,
+        max: this.PROGRESS_MAX_VALUE,
+        step: 1,
+        style: SliderStyle.OutSet
+      })
+        .width('600px')
+        .blockColor(Color.White)
+        .trackColor($r('app.color.track_color'))
+        .selectedColor(Color.White)
+        .trackThickness(PlayConstants.PROGRESS_TRACK_THICKNESS)
+        .layoutWeight(1)
+        .margin({ left: PlayConstants.PROGRESS_MARGIN_LEFT })
+        .showSteps(true)
+        .showTips(true)
+        .enabled(this.slideEnable)
+        .onChange((value: number, mode: SliderChangeMode) => {
+          // if (mode == 2) {
+          this.isSeekTo = true;
+          this.mDestroyPage = false;
+          this.showLoadIng();
+          LogUtils.getInstance().LOGI("slider-->seekValue start:" + value);
+          let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
+          this.seekTo(seekValue + "");
+          // this.setProgress()
+          LogUtils.getInstance().LOGI("slider-->seekValue end:" + seekValue);
+          this.isSeekTo = false;
+          // }
+        })
+      Text(this.totalTime)
+        .fontSize($r('app.float.slider_font_size'))
+        .fontColor(Color.White)
+        .margin(3)
+        .margin({ left: PlayConstants.PROGRESS_MARGIN_LEFT })
+
+
+      //播放列表
+      Image($r('app.media.playlist'))
+        .width($r('app.float.control_image_width'))
+        .margin({ right: 10, left: 20 })
+        .aspectRatio(CommonConstants.ASPECT_RATIO)
+        .bindSheet($$this.isShowSheetView, this.PlayListSheet(), {
+          height: '95%',
+          dragBar: true,
+          showClose: true,
+          preferType: this.currentBreakpoint !== BreakpointTypeEnum.SM ? SheetType.CENTER : SheetType.BOTTOM,
+          blurStyle: BlurStyle.Thin,
+          backgroundColor: Color.Transparent,
+          title: {
+            title: Utility.resourceToString(this.context, $r('app.string.current_play_list'))
+              + `(${this.songList.length}首)`
+          }
+        })
+        .onClick(() => {
+          this.isShowSheetView = !this.isShowSheetView;
+          this.isFrontWhite = true
+        })
 
     }
-    .position({ bottom:this.isCoverOpacity()?55: 80 }) // 将  固定在底部
-
+    .width(PlayConstants.PROGRESS_ROW_WIDTH)
+    .visibility(this.isPhoneLan()?Visibility.None:Visibility.Visible)
   }
 
   @State isCoverRectangle: boolean = false
@@ -5358,7 +5373,7 @@ export struct LocalMusic {
 
 
         Image(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover)
-          .height(this.isCoverOpacity() ? 152 : this.isCoverRectangle ? 300 : 162)
+          .height(this.isCoverOpacity() ? 220 : this.isCoverRectangle ? 300 : 162)
           .objectFit(this.isCoverRectangle ? ImageFit.Contain : ImageFit.Auto)
           .alt(this.imageLabel)
           .margin({ right: 30, left: 30, top: this.isCoverOpacity() || this.isCoverRectangle ? 0 : 10 })
@@ -5405,7 +5420,7 @@ export struct LocalMusic {
       }
 
       .margin({
-        bottom: this.isCoverOpacity() || this.isCoverRectangle ? 160 : 0,
+        bottom: this.isCoverOpacity() || this.isCoverRectangle ? 110 : 0,
         top: this.isCoverOpacity() ? 0 : this.isCoverRectangle ? 40 : 30
       })
 
@@ -5515,7 +5530,7 @@ export struct LocalMusic {
         Text(`歌词居中:`)
           .fontSize(14)
           .fontColor(Color.White)
-          .margin({ right: 8 })
+          .margin({left:2})
         Row() {
           ForEach(['居中', '居左'], (size: string, index: number) => {
             Button(size)
@@ -5534,12 +5549,11 @@ export struct LocalMusic {
               .margin({ left: 8, right: 8 })
           })
         }
-        .layoutWeight(1)
+        .width('76%')
         Blank()
 
       }
-      .justifyContent(FlexAlign.Start)
-      .margin({ top:10,bottom:10,right:20,left:35})
+      .margin({ top:10,bottom:10,right:20,left:20})
 
       Row() {
         Text(`歌词颜色:`)
@@ -5725,21 +5739,20 @@ export struct LocalMusic {
         Text(`高亮居中:`)
           .fontSize(14)
           .fontColor(Color.White)
-          .layoutWeight(1)
-          .margin({left:15})
-        Blank()
-        Toggle({ type: ToggleType.Switch, isOn: this.isHightLightCenter })
-          .selectedColor($r('app.color.tab_item_bg'))
-          .switchPointColor(Color.White)
-          .margin({ right: 18 })
-          .onChange((checked: boolean) => {
-            this.isHightLightCenter = checked;
-            PreferencesUtil.put(SettingPage.IS_SHOW_SIMI, this.isHightLightCenter)
-            this.lyricController.setHightLightCenter(this.isHightLightCenter)
-          })
-          .width(50)
-          .height(30);
-
+        Column(){
+          Toggle({ type: ToggleType.Switch, isOn: this.isHightLightCenter })
+            .selectedColor($r('app.color.tab_item_bg'))
+            .switchPointColor(Color.White)
+            .onChange((checked: boolean) => {
+              this.isHightLightCenter = checked;
+              PreferencesUtil.put(SettingPage.IS_SHOW_SIMI, this.isHightLightCenter)
+              this.lyricController.setHightLightCenter(this.isHightLightCenter)
+            })
+            .width(50)
+            .height(30)
+        }
+        .justifyContent(FlexAlign.Start)
+          .width('76%')
 
       }
       .margin({