Kaynağa Gözat

修复cue文件报错的问题

onecold 8 ay önce
ebeveyn
işleme
385e5a907b

+ 4 - 3
entry/src/main/ets/common/util/Utility.ets

@@ -945,6 +945,7 @@ export class Utility {
             }
 
             let videoSize =  stat.size
+            const modifyTime = Utility.getFormatDateStr(stat.mtime,'yyyy-MM-dd HH:mm')
             let fileSize = Utility.formatFSize(videoSize)
             //按照添加时间
             let addTime = Utility.getFormatDateStr(new Date(),'yyyy-MM-dd HH:mm');
@@ -1008,6 +1009,7 @@ export class Utility {
             videoItem.artist  = artist;
             videoItem.album  = album;
             videoItem.sampleRate = sampleRate
+            videoItem.modefiyTime = modifyTime
             videoItem.pyStr = pinyin4js.getShortPinyin(name)
             videoItem.fileName  = FileUtil.getFileName(inputPath);
             if(format.duration)
@@ -1073,10 +1075,9 @@ export class Utility {
                 if(isSuccess){
                   imagePath = fileUri.getUriFromPath(imagePath)
                 }else{
-                  imagePath = ''
                   // 使用华为接口提取封面(备用方案)
-                  // console.warn('onecold 提取封面图片失败,使用华为接口提取封面');
-                  // imagePath = await extractCoverWithHwInterface(inputPath, context, name);
+                  console.warn('onecold 提取封面图片失败,使用华为接口提取封面');
+                  imagePath = await extractCoverWithHwInterface(inputPath, context, name);
                 }
                 videoItem.pixelMapPath  = imagePath;
               }else if(Utility.isVideoByExtension(inputPath)){

+ 1 - 0
entry/src/main/ets/pages/NewIndex.ets

@@ -481,6 +481,7 @@ struct NewIndex {
         .backgroundBlurStyle(BlurStyle.BACKGROUND_ULTRA_THICK)
         .backgroundImage(StrUtil.isEmpty(this.cover) ?$r('app.media.alt'):this.cover)
         .visibility(this.isMultiSelect||(this.mType>0&&this.mType<6) ? Visibility.None : Visibility.Visible)
+
         .backgroundImageSize( {  width: '100%' })
         .animation({
           duration: 500,

+ 0 - 4
entry/src/main/ets/pages/WebDavMainPage.ets

@@ -1643,10 +1643,6 @@ export struct WebDavMainPage {
       // 重新加载当前账户的文件信息
       await this.webdavManager.loadFilesInfoFromAccount(this.selectedAccount, this.webdavManager.currentPath);
 
-      // 显示成功提示
-      this.getUIContext().getPromptAction().showToast({
-        message: '文件上传成功,列表已刷新'
-      });
 
       Logger.info(TAG, 'heanup 文件列表刷新完成');
 

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

@@ -42,6 +42,7 @@ import { MessageEvents, util, worker, ErrorEvent, JSON } from '@kit.ArkTS';
 import { Verify } from './Verify';
 import { taskpool } from '@kit.ArkTS';
 import { RotatingCover } from './RotatingCover';
+import { PointLightButton } from './PointLight/PointLightButton';
 import { PlayConstants } from '../common/constants/PlayConstants';
 import { effectKit } from '@kit.ArkGraphics2D';
 import { ColorConversion } from '../common/util/ColorConversion';
@@ -10451,6 +10452,20 @@ export struct LocalMusic {
       .backgroundColor(Color.Transparent)
       .layoutWeight(1)
 
+      // PointLightButton({
+      //   builder: () => {
+      //     this.PlayOrPauseButton()
+      //   },
+      //   isPx: true,
+      //   builderHeight: 60,
+      //   builderWidth: 60,
+      // })
+      //   .layoutWeight(1)
+      //   .onClick(() =>{
+      //     this.playOrPause()
+      //   })
+
+
 
       Button({ type: ButtonType.Circle, stateEffect: true }) {
         Image($r('app.media.ic_next'))
@@ -10478,6 +10493,16 @@ export struct LocalMusic {
     .margin({ bottom:this.isCoverOpacity()?0:15 })
     .justifyContent(FlexAlign.SpaceEvenly)
   }
+  @Builder
+  PlayOrPauseButton(){
+    Image(this.CONTROL_PlayStatus === PlayStatus.PLAY ?
+      (this.isCircleBtn?$r('app.media.hm_pause'):$r('app.media.ic_public_play'))
+      : (this.isCircleBtn?$r('app.media.hm_play2'):$r('app.media.ic_public_pause')))
+      .width(this.isPhoneLan()?45:55)
+      .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
+      .fillColor(Color.White)
+      .aspectRatio(CommonConstants.ASPECT_RATIO)
+  }
 
 
   @Builder
@@ -13682,13 +13707,14 @@ export struct LocalMusic {
 
             this.updateSessionPlayState(true)
             this.setCurrentPlayMode()
+
+            if(startOffset&&startOffset>0){//cue分轨播放
+              this.seekTo(startOffset  + "");
+              this.saveLastPlayList()
+              return
+            }
           }, 500)
 
-          if(startOffset&&startOffset>0){//cue分轨播放
-            this.seekTo(startOffset  + "");
-            this.saveLastPlayList()
-            return
-          }
           //rmvb和flac格式马上记忆播放会报错,会延迟1s在读取记忆播放。
           let timeoutPlay = 0
           if (StrUtil.isNotEmpty(this.videoUrl) &&

+ 77 - 0
entry/src/main/ets/view/PointLight/PointLightButton.ets

@@ -0,0 +1,77 @@
+import { hdsEffect } from "@kit.UIDesignKit"
+
+@Component
+export struct PointLightButton{
+  @BuilderParam builder:() => void
+  @Require isPx: boolean
+  @Require@Prop@Watch('setButtonSize') builderHeight: number
+  @Require@Prop@Watch('setButtonSize') builderWidth: number
+  // 可选
+  public buttonScale: number = 1.7
+  @State pointLightHeight: number = 100
+  public canShadow: boolean = true
+  public canPointLight: boolean = true
+
+
+  @StorageProp("EnablePointLight") enablePointLight: boolean = true
+  @StorageProp("EnableShadow") enableShadow: boolean = true
+
+  @StorageProp("SdkApiVersion") sdkApiVersion: number = 17
+  @State pointLightOptions: hdsEffect.PointLightOptions | undefined = undefined
+  @State buttonHeight: Length = 0
+  @State buttonWidth: Length = 0
+
+  aboutToAppear(): void {
+    this.setButtonSize()
+  }
+
+  setButtonSize(){
+    let buttonHeight = this.builderHeight * this.buttonScale
+    let buttonWidth = this.builderWidth * this.buttonScale
+    if(this.isPx){
+      this.buttonHeight = `${buttonHeight}px`
+      this.buttonWidth = `${buttonWidth}px`
+    }else{
+      this.buttonHeight = buttonHeight
+      this.buttonWidth = buttonWidth
+    }
+  }
+
+  build() {
+    if(this.enablePointLight){
+      Button(){
+        this.builder()
+      }
+      .hitTestBehavior(HitTestMode.Transparent)
+      .height(this.buttonHeight)
+      .width(this.buttonWidth)
+      .stateEffect(false)
+      .clickEffect({level:ClickEffectLevel.LIGHT,scale: 0.9})
+      .backgroundColor(Color.Transparent)
+      .type(ButtonType.Circle)
+      .onTouch((event: TouchEvent) => {
+        if (event.type === TouchType.Down) {
+          this.pointLightOptions = {
+            color: Color.White,
+            intensity: 1,
+            height: this.pointLightHeight
+          }
+        } else if (event.type === TouchType.Up || event.type === TouchType.Cancel) {
+          this.pointLightOptions = undefined
+        }
+      })
+      .shadow(this.canShadow && this.enableShadow ? ShadowStyle.OUTER_DEFAULT_XS : undefined)
+      .visualEffect(this.canPointLight && this.sdkApiVersion >= 20 ?
+        new hdsEffect.HdsEffectBuilder()
+          .pointLight({
+            options: this.pointLightOptions,
+            illuminatedType: hdsEffect.PointLightIlluminatedType.BORDER_CONTENT
+          })
+          .buildEffect()
+        : undefined
+      )
+    }else{
+      this.builder()
+    }
+  }
+}

+ 47 - 0
entry/src/main/ets/view/PointLight/PointLightImage.ets

@@ -0,0 +1,47 @@
+import { hdsEffect } from "@kit.UIDesignKit"
+import { image } from "@kit.ImageKit"
+
+@Component
+export struct PointLightImage{
+  @Link imageUrl: image.PixelMap | ResourceStr | DrawableDescriptor | undefined
+  // 可选
+  @State pointLightHeight: number = 100
+  public canShadow: boolean = true
+  public canPointLight: boolean = true
+
+
+  @StorageProp("EnablePointLight") enablePointLight: boolean = true
+  @StorageProp("EnableShadow") enableShadow: boolean = true
+
+  @StorageProp("SdkApiVersion") sdkApiVersion: number = 17
+  @State pointLightOptions: hdsEffect.PointLightOptions | undefined = undefined
+
+  build() {
+    Image(this.imageUrl === undefined ? $r("app.media.alt") : this.imageUrl)
+      .draggable(false)
+      .objectFit(ImageFit.Auto )
+      .borderRadius(15)
+      .onTouch((event: TouchEvent) => {
+        if (event.type === TouchType.Down) {
+          this.pointLightOptions = {
+            color: Color.White,
+            intensity: 1,
+            height: this.pointLightHeight
+          }
+        } else if (event.type === TouchType.Up || event.type === TouchType.Cancel) {
+          this.pointLightOptions = undefined
+        }
+      })
+      .shadow(this.canShadow && this.enableShadow ? ShadowStyle.OUTER_DEFAULT_MD : undefined)
+      .visualEffect(this.canPointLight && this.enablePointLight && this.sdkApiVersion >= 20?
+        new hdsEffect.HdsEffectBuilder()
+          .pointLight({
+            options: this.pointLightOptions,
+            illuminatedType: hdsEffect.PointLightIlluminatedType.BORDER_CONTENT
+          })
+          .buildEffect()
+        : undefined
+      )
+
+  }
+}