Răsfoiți Sursa

实现播放页流光背景

onecold 9 luni în urmă
părinte
comite
85688fcdb1

+ 4 - 0
entry/src/main/ets/dialog/WebDavAccountDialog.ets

@@ -336,6 +336,10 @@ export struct WebDavAccountDialog {
    */
   private handleRemoveCover() {
     if (this.coverPath) {
+      if(!this.account){
+        this.coverPath = ''
+        return
+      }
       // 只有当封面不是原来的封面时才删除文件
       if (this.coverPath !== this.account.coverPath) {
         ImagePickerUtil.deleteImage(this.coverPath)

+ 1 - 29
entry/src/main/ets/pages/UserCenter.ets

@@ -821,7 +821,7 @@ export struct UserCenter {
         this.deleteAccountDialogController.open();
       })
     }
-    .width('100%')
+    .width('90%')
     .backgroundColor($r('app.color.user_center_card_background'))
     .borderRadius(24)
     .margin({
@@ -1357,34 +1357,6 @@ export struct UserCenter {
         .width('100%')
         .margin({ bottom: 20 })
 
-      // Text('包括但不限于:')
-      //   .fontSize(14)
-      //   .fontColor(Color.Gray)
-      //   .textAlign(TextAlign.Start)
-      //   .width('100%')
-      //   .margin({ bottom: 10 })
-      //
-      // Text('• 个人信息和设置(含订阅套餐)')
-      //   .fontSize(13)
-      //   .fontColor(Color.Gray)
-      //   .textAlign(TextAlign.Start)
-      //   .width('100%')
-      //   .margin({ left: 20, bottom: 5 })
-      //
-      // Text('• 收藏和播放列表')
-      //   .fontSize(13)
-      //   .fontColor(Color.Gray)
-      //   .textAlign(TextAlign.Start)
-      //   .width('100%')
-      //   .margin({ left: 20, bottom: 5 })
-      //
-      // Text('• 播放历史记录')
-      //   .fontSize(13)
-      //   .fontColor(Color.Gray)
-      //   .textAlign(TextAlign.Start)
-      //   .width('100%')
-      //   .margin({ left: 20, bottom: 15 })
-
       Text('请确认您已了解此操作的后果。')
         .fontSize(14)
         .fontColor($r('app.color.text_color'))

+ 3 - 50
entry/src/main/ets/pages/WebDavMainPage.ets

@@ -564,54 +564,6 @@ export struct WebDavMainPage {
       // 加载按钮和面包屑导航
       Column({ space: 8 }) {
 
-        // 账户信息显示
-        // if (this.selectedAccount) {
-        //   Row({ space: 12 }) {
-        //     // 账户封面
-        //     Stack() {
-        //       if (this.selectedAccount.coverPath) {
-        //         Image(this.selectedAccount.coverPath)
-        //           .width(20)
-        //           .height(20)
-        //           .borderRadius(10)
-        //           .objectFit(ImageFit.Cover)
-        //           .border({ width: 2, color: this.themeColor })
-        //       } else {
-        //
-        //         Image($r('app.media.cloudDisk'))
-        //           .width(20)
-        //           .height(20)
-        //           .fillColor(this.themeColor)
-        //       }
-        //     }
-        //
-        //     // 账户信息
-        //     Column({ space: 4 }) {
-        //       Text(this.selectedAccount.name || '未知账户')
-        //         .fontSize(16)
-        //         .fontWeight(FontWeight.Medium)
-        //         .fontColor(this.isDarkMode ? '#FFFFFF' : $r('app.color.text_color'))
-        //         .maxLines(1)
-        //         .textOverflow({ overflow: TextOverflow.Ellipsis })
-        //
-        //       Text(`${this.selectedAccount.host}:${this.selectedAccount.port}`)
-        //         .fontSize(12)
-        //         .fontColor(this.isDarkMode ? '#8E8E93' : $r('app.color.index_tab_font_color'))
-        //         .opacity(0.7)
-        //         .maxLines(1)
-        //         .textOverflow({ overflow: TextOverflow.Ellipsis })
-        //     }
-        //     .alignItems(HorizontalAlign.Start)
-        //     .layoutWeight(1)
-        //
-        //   }
-        //   .width('100%')
-        //   .padding({ left: 4, right: 4, top: 8, bottom: 8 })
-        //   .backgroundColor(this.isDarkMode ? 'rgba(44,44,46,0.8)' : 'rgba(248,248,248,0.8)')
-        //   .borderRadius(8)
-        //   .margin({ bottom: 8 })
-        // }
-        //
 
         // 面包屑导航
         if (this.webdavManager.currentPath !== '') {
@@ -668,9 +620,10 @@ export struct WebDavMainPage {
               .layoutWeight(1)
               .textAlign(TextAlign.Start)
             Blank()
-            Button('一键创建歌单')
+            Button('一键创建歌单',{ type: ButtonType.Capsule, stateEffect: true })
               .type(ButtonType.Normal)
-              .fontSize(13)
+              .fontSize(12)
+              .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.8 })
               .backgroundColor(this.themeColor)
               .fontColor(Color.White)
               .padding({ left: 12, right: 12, top: 6, bottom: 6 })

+ 82 - 4
entry/src/main/ets/view/LocalMusic.ets

@@ -104,7 +104,13 @@ import { AudioFormatConverter } from './AudioFormatConverter';
 import { MergeAudio } from './MergeAudio';
 import { AIVoiceSeparation } from './AIVoiceSeparation';
 import { WebDavUrlUtil } from '../common/util/WebDavUrlUtil';
-
+import {
+  hdsEffect,
+  HdsVisualComponent,
+  HdsSceneController,
+  HdsSceneType,
+  HdsVisualComponentAttribute,
+} from '@kit.UIDesignKit';
 const TAG = 'LocalMusic';
 
 /**
@@ -219,6 +225,21 @@ const ITEM_HEIGHT_BIG: number = 78; // 列表项大高度
 @Preview
 @Component
 export struct LocalMusic {
+  @State sceneBgController: HdsSceneController = new HdsSceneController()
+    .setSceneParams({
+      backgroundMaskColors: [Color.Green, Color.Red],
+      firstEdgeFlowLight: {
+        startPos: 0,
+        endPos: 0.5,
+        color: Color.Red
+      },
+      secondEdgeFlowLight: {
+        startPos: 0,
+        endPos: -0.5,
+        color: Color.Green
+      }
+    })
+  // @State controller: hdsEffect.ShaderEffectController = new hdsEffect.ShaderEffectController();
   @State isEditAudio:boolean = false
   @State isExtractAcc:boolean = false
   @State isConverter:boolean = false
@@ -3636,7 +3657,7 @@ export struct LocalMusic {
                   ? Visibility.Visible : Visibility.None)
                 .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
                 Color.Gray)
-                .margin({ left: 10 })
+                .margin({ left: StrUtil.isEmpty(item.artist) ?0:10 })
             }
             .gesture(LongPressGesture()
               .onAction(async () => {
@@ -8503,7 +8524,16 @@ export struct LocalMusic {
   @Builder
   IjkMusicPlayerView() {
 
-    Column() {
+    Stack() {
+
+        HdsVisualComponent()
+          .scene(HdsSceneType.DUAL_EDGE_FLOW_LIGHT_WITH_BACKGROUND_MASK, this.sceneBgController, () => {
+            console.info('Succeeded in finishing');
+          })
+          .width('100%')
+          .height('100%')
+          .visibility(this.isShowBgLiuGUANG?Visibility.Visible:Visibility.None)
+
 
       Column() {
 
@@ -10017,6 +10047,34 @@ export struct LocalMusic {
               .onClick(() => {
                 this.getImageColor()
               })
+              // .visualEffect(new hdsEffect.HdsEffectBuilder()
+              //   .shaderEffect({
+              //     effectType: hdsEffect.EffectType.DUAL_EDGE_FLOW_LIGHT,
+              //     animation: {
+              //       duration: 4000,
+              //       iterations: -1,
+              //       autoPlay: true,
+              //       onFinish: () => {
+              //         console.info('Succeeded in finishing');
+              //       }
+              //     },
+              //     controller: this.controller,
+              //     params: {
+              //       firstEdgeFlowLight: {
+              //         startPos: 0,
+              //         endPos: 1.0,
+              //         color: '#1AD0F1',
+              //       },
+              //       secondEdgeFlowLight: {
+              //         startPos: 0.5,
+              //         endPos: 1.5,
+              //         color: '#FFA4E5',
+              //       }
+              //     }
+              //   })
+              //   .buildEffect())
+
+
 
             this.musicNameInfo(false)
           } else {
@@ -11355,9 +11413,9 @@ export struct LocalMusic {
                 Image(more.image)
                   .width(24)
                   .height(24)
+                  .fillColor(Color.White)
                   .margin({ left: 10, right: 10 })
                   .onClick(() => {
-
                     this.doMore(more.id)
                   })
                 Text(more.id == 17 ? (this.isLandscape ? '竖屏模式' : '横屏模式') : more.title)
@@ -11496,6 +11554,22 @@ export struct LocalMusic {
                   .width(48)
                   .height(24);
 
+                Toggle({ type: ToggleType.Switch, isOn: this.isShowBgLiuGUANG })
+                  .selectedColor(this.themeColor)
+                  .switchPointColor(Color.White)
+                  .clickEffect({ level: ClickEffectLevel.LIGHT, scale: 0.5 })
+                  .margin({ right: 15 })
+                  .visibility(more.id == 21 ? Visibility.Visible : Visibility.None)
+                  .onChange((checked: boolean) => { // 是否开启背景流光效果
+                    if (more.id == 21) {
+                      this.isShowBgLiuGUANG  = checked;
+                      PreferencesUtil.putSync('isShowBgLiuGUANG',this.isShowBgLiuGUANG)
+                    }
+
+                  })
+                  .width(48)
+                  .height(24);
+
               }
 
 
@@ -11573,12 +11647,15 @@ export struct LocalMusic {
 
     { id: 13, image: $r('app.media.rectangle'), title: '封面方形' },
 
+    { id : 21, image: $r('app.media.music_red'), title: '开启背景流光' },
+
     { id: 8, image: $r('app.media.cut_current'), title: '保存播放模式' },
 
     { id: 7, image: $r('app.media.playlist2'), title: '播放背景随音乐封面' },
 
 
   ];
+  @State isShowBgLiuGUANG: boolean = true;
   @State isShowMoreView: boolean = false;
   @State isMusicMemoryPlay: boolean = false //是否启用记忆播放
   @State isShowTimeCloseMore: boolean = false
@@ -12374,6 +12451,7 @@ export struct LocalMusic {
   }
 
   private async play(url: string,startOffset?:number) {
+    this.isShowBgLiuGUANG = PreferencesUtil.getBooleanSync('isShowBgLiuGUANG', true)
     console.info('onecold this.url 1= '+url)
     if(!url.toLowerCase().startsWith('http')){
       let hasPermission = await PermissionUtil.activatePermission(url)