Browse Source

文件扫描过程保持屏幕常量
增加一些动画效果

onecold 1 year ago
parent
commit
1039623be1

+ 2 - 2
AppScope/app.json5

@@ -2,8 +2,8 @@
   "app": {
   "app": {
     "bundleName": "com.xgplayer.ttmusic.hm",
     "bundleName": "com.xgplayer.ttmusic.hm",
     "vendor": "example",
     "vendor": "example",
-    "versionCode": 20250616,
-    "versionName": "1.4.0",
+    "versionCode": 20250621,
+    "versionName": "1.4.1",
     "icon": "$media:app_icon",
     "icon": "$media:app_icon",
     "label": "$string:app_name",
     "label": "$string:app_name",
     "multiAppMode": {
     "multiAppMode": {

+ 2 - 2
build-profile.json5

@@ -30,11 +30,11 @@
         "material": {
         "material": {
           "certpath": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.cer",
           "certpath": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.cer",
           "keyAlias": "debugKey",
           "keyAlias": "debugKey",
-          "keyPassword": "0000001A8607A992F101508BFF9FB99305303317193BEAAD3C39D73E4742CA502414E766C05B288C3243",
+          "keyPassword": "0000001B29B765FED2070C793D78E2881AEEC8526F57C200F5CEA8D9D0800526063FAE9F272770E638B009",
           "profile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p7b",
           "profile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p7b",
           "signAlg": "SHA256withECDSA",
           "signAlg": "SHA256withECDSA",
           "storeFile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p12",
           "storeFile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p12",
-          "storePassword": "0000001AF761C52C1BFB02907D9736E34311D0367E4B52712D7229CD1C7CCEDFBFF3EB149B5EA0A4EECF"
+          "storePassword": "0000001BE6DE18C77DCD180738D43C3BC0DC4185EC14C2E0CD4965449D6D02D6B73C246C8100854CC5A55D"
         }
         }
       }
       }
     ]
     ]

+ 19 - 8
entry/src/main/ets/pages/ScanFilePage.ets

@@ -1,5 +1,5 @@
 import TitleBar from '../view/TitleBar'
 import TitleBar from '../view/TitleBar'
-import {  router } from '@kit.ArkUI'
+import {  router, window } from '@kit.ArkUI'
 import { AppUtil, DeviceUtil, DisplayUtil, FileUtil, LogUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils'
 import { AppUtil, DeviceUtil, DisplayUtil, FileUtil, LogUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils'
 import lottie from '@ohos/lottie'
 import lottie from '@ohos/lottie'
 import { AnimationItem } from '@ohos/lottie'
 import { AnimationItem } from '@ohos/lottie'
@@ -41,6 +41,7 @@ export struct ScanFilePage{
   @State isDarkMode: boolean = false
   @State isDarkMode: boolean = false
   @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
   @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
     ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
     ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
+  private windowClass: window.Window = globalThis.windowClass
   initLottie(lpath:string,isLoop:boolean){
   initLottie(lpath:string,isLoop:boolean){
     lottie.destroy(); //加载动画前先销毁之前加载的动画
     lottie.destroy(); //加载动画前先销毁之前加载的动画
     this.animateItem = lottie.loadAnimation({
     this.animateItem = lottie.loadAnimation({
@@ -58,7 +59,13 @@ export struct ScanFilePage{
     lottie.setSpeed(0.7)
     lottie.setSpeed(0.7)
 
 
   }
   }
+  onPageShow() {
+    this.initLottie(this.path,true)
+    setTimeout(()=>{
+      lottie.pause()
+    },88)
 
 
+  }
   // 组件生命周期
   // 组件生命周期
   async aboutToAppear() {
   async aboutToAppear() {
     Utility.getAppName(getContext(this)).then((appName:string)=>{
     Utility.getAppName(getContext(this)).then((appName:string)=>{
@@ -83,7 +90,7 @@ export struct ScanFilePage{
   endScan(isOnekey:boolean){
   endScan(isOnekey:boolean){
     const eventData: emitter.EventData = {};
     const eventData: emitter.EventData = {};
     emitter.emit({ eventId: 101 }, eventData); // 发送视频打开广播事件
     emitter.emit({ eventId: 101 }, eventData); // 发送视频打开广播事件
-
+    this.watchStatus(false)
     ToastUtil.showToast('扫描文件入库成功!')
     ToastUtil.showToast('扫描文件入库成功!')
     if(isOnekey){
     if(isOnekey){
       this.isStartCover = false
       this.isStartCover = false
@@ -100,6 +107,10 @@ export struct ScanFilePage{
 
 
   }
   }
 
 
+  //扫描过程中屏幕要保存常亮
+  watchStatus(isKeep:boolean) {
+      this.windowClass.setWindowKeepScreenOn(isKeep);
+  }
   // 组件生命周期
   // 组件生命周期
   aboutToDisappear() {
   aboutToDisappear() {
     lottie.destroy();
     lottie.destroy();
@@ -134,7 +145,7 @@ export struct ScanFilePage{
   }
   }
 
 
   doOptimize(isOnekey:boolean){
   doOptimize(isOnekey:boolean){
-
+    this.watchStatus(true)
     this.initState(isOnekey)
     this.initState(isOnekey)
     const task = new taskpool.Task(scanDirectoryTask, getContext(this), this.rootPath,
     const task = new taskpool.Task(scanDirectoryTask, getContext(this), this.rootPath,
       this.lockPath,PreferencesUtil.getStringSync('COVER_API',''));
       this.lockPath,PreferencesUtil.getStringSync('COVER_API',''));
@@ -173,14 +184,14 @@ export struct ScanFilePage{
         Stack() {
         Stack() {
           // 居中标题
           // 居中标题
           Text('文件扫描')
           Text('文件扫描')
-            .fontSize(20)
+            .fontSize(18)
             .fontColor(Color.White)
             .fontColor(Color.White)
             .align(Alignment.Center)
             .align(Alignment.Center)
           // 左右按钮
           // 左右按钮
           Row() {
           Row() {
             Image($r('app.media.left_back_white'))
             Image($r('app.media.left_back_white'))
-              .width(32)
-              .height(32)
+              .width(28)
+              .height(28)
               .margin({ left: 12, right: 8 })
               .margin({ left: 12, right: 8 })
               .onClick(() => {
               .onClick(() => {
                 router.back();
                 router.back();
@@ -208,8 +219,8 @@ export struct ScanFilePage{
 
 
           Stack(){
           Stack(){
             Image($r('app.media.file_search'))
             Image($r('app.media.file_search'))
-              .width(80)
-              .height(80)
+              .width(48)
+              .height(48)
               .fillColor(this.themeColor)
               .fillColor(this.themeColor)
               .alignSelf(ItemAlign.Center)
               .alignSelf(ItemAlign.Center)
             //lottie动画
             //lottie动画

+ 27 - 13
entry/src/main/ets/view/LocalMusic.ets

@@ -581,14 +581,15 @@ export struct LocalMusic {
   makeWorker() {
   makeWorker() {
     setTimeout(() => {
     setTimeout(() => {
       if (PreferencesUtil.getBooleanSync('isFirstApp', true)) {
       if (PreferencesUtil.getBooleanSync('isFirstApp', true)) {
-        //发送worker通知扫描文件入库
-        workerInstance.postMessage({
-          code: 1,
-          data1: this.context,
-          data2: this.rootPath,
-          data3: this.lockPath,
-          data4: PreferencesUtil.getStringSync('COVER_API', ''),
-        });
+        ToastUtil.showToast('请到文件扫描页面导入音乐!')
+        //发送worker通知扫描文件入库,用户反馈4000多首用这个方法扫描会闪退。
+        // workerInstance.postMessage({
+        //   code: 1,
+        //   data1: this.context,
+        //   data2: this.rootPath,
+        //   data3: this.lockPath,
+        //   data4: PreferencesUtil.getStringSync('COVER_API', ''),
+        // });
         PreferencesUtil.putSync('isFirstApp', false)
         PreferencesUtil.putSync('isFirstApp', false)
       } else {
       } else {
         workerInstance.postMessage({ code: 2, data: this.context });
         workerInstance.postMessage({ code: 2, data: this.context });
@@ -3004,6 +3005,8 @@ export struct LocalMusic {
     .width('100%')
     .width('100%')
     .height('100%')
     .height('100%')
     .editMode(true)
     .editMode(true)
+    .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+      .animation({ duration: 500, curve: Curve.Ease }))
     .margin({ bottom: this.isCoverOpacity() ? 80 : 175 })
     .margin({ bottom: this.isCoverOpacity() ? 80 : 175 })
     .layoutWeight(1)
     .layoutWeight(1)
     .scrollBar(BarState.Off)
     .scrollBar(BarState.Off)
@@ -3434,6 +3437,8 @@ export struct LocalMusic {
     .margin({ bottom: this.isCoverOpacity() ? 80 : 166 })
     .margin({ bottom: this.isCoverOpacity() ? 80 : 166 })
     .cachedCount(6)
     .cachedCount(6)
     .borderRadius(20)
     .borderRadius(20)
+    .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+      .animation({ duration: 500, curve: Curve.Ease }))
     .layoutWeight(1)
     .layoutWeight(1)
     .visibility(this.isGridMusic?Visibility.None:Visibility.Visible)
     .visibility(this.isGridMusic?Visibility.None:Visibility.Visible)
     .lanes(
     .lanes(
@@ -4698,6 +4703,8 @@ export struct LocalMusic {
     }
     }
     .width('100%')
     .width('100%')
     .height('100%')
     .height('100%')
+    .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+      .animation({ duration: 500, curve: Curve.Ease }))
     .cachedCount(10)
     .cachedCount(10)
 
 
     .padding({
     .padding({
@@ -5081,7 +5088,7 @@ export struct LocalMusic {
   @State lyricTextSize: number = 24
   @State lyricTextSize: number = 24
   @State lyricContent: string = ''
   @State lyricContent: string = ''
   @State isDebug: boolean = false
   @State isDebug: boolean = false
-  @State isHightLightCenter: boolean = false
+  @State isHightLightCenter: boolean = true
   /**
   /**
    * 初始化歌词加载与展示逻辑
    * 初始化歌词加载与展示逻辑
    * @param lyricPath 歌词文件路径(支持普通.lrc和加密.lrcc)
    * @param lyricPath 歌词文件路径(支持普通.lrc和加密.lrcc)
@@ -5124,7 +5131,7 @@ export struct LocalMusic {
     this.lyricController.setLineSpace(PreferencesUtil.getNumberSync('LyricLineSpace', 52))
     this.lyricController.setLineSpace(PreferencesUtil.getNumberSync('LyricLineSpace', 52))
     this.changeLyricColor(PreferencesUtil.getStringSync('LyricColor', '#FFFFFF'),false)
     this.changeLyricColor(PreferencesUtil.getStringSync('LyricColor', '#FFFFFF'),false)
     this.changeLyricHightLightColor(PreferencesUtil.getStringSync('LyricHighLightColor', '#FFFFFF'),false)
     this.changeLyricHightLightColor(PreferencesUtil.getStringSync('LyricHighLightColor', '#FFFFFF'),false)
-    this.isHightLightCenter = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_SIMI, false)
+    this.isHightLightCenter = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_SIMI, true)
     this.lyricController.setHightLightCenter(this.isHightLightCenter)
     this.lyricController.setHightLightCenter(this.isHightLightCenter)
     this.lyricTextWeight = PreferencesUtil.getNumberSync('lyricTextWeight',400)
     this.lyricTextWeight = PreferencesUtil.getNumberSync('lyricTextWeight',400)
     this.lyricController.setTextWeight(this.lyricTextWeight)
     this.lyricController.setTextWeight(this.lyricTextWeight)
@@ -5918,12 +5925,18 @@ export struct LocalMusic {
         Text(this.name)
         Text(this.name)
           .fontSize(this.name.length >= 28 || this.isCoverOpacity() ? 18 : 22)
           .fontSize(this.name.length >= 28 || this.isCoverOpacity() ? 18 : 22)
           .fontWeight(FontWeight.Bold)
           .fontWeight(FontWeight.Bold)
-          .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
+          .textOverflow({ overflow: TextOverflow.Ellipsis })
           .maxLines(1)
           .maxLines(1)
+          .width('80%')
+          .textAlign(TextAlign.Center)
           .fontColor(Color.White)
           .fontColor(Color.White)
         Text(this.artist + '  ' + this.currentSong?.album)
         Text(this.artist + '  ' + this.currentSong?.album)
           .fontSize(this.isCoverOpacity() ? 12 : 15)
           .fontSize(this.isCoverOpacity() ? 12 : 15)
+          .textOverflow({ overflow: TextOverflow.Ellipsis })
           .fontColor(Color.White)
           .fontColor(Color.White)
+          .textAlign(TextAlign.Center)
+          .width('60%')
+          .maxLines(1)
       }
       }
       .margin({ top: this.isCoverOpacity() ? 20 : 66 })
       .margin({ top: this.isCoverOpacity() ? 20 : 66 })
       .justifyContent(FlexAlign.Center)
       .justifyContent(FlexAlign.Center)
@@ -6199,7 +6212,7 @@ export struct LocalMusic {
               .height(28)
               .height(28)
               .fontSize(12)
               .fontSize(12)
               .fontColor('#FFFFFF')
               .fontColor('#FFFFFF')
-              .backgroundColor(this.currentLyricAlignMode === index ? this.themeColor :Color.Transparent)
+              .backgroundColor((!isPip&&this.currentLyricAlignMode === index)||(isPip&&this.currentLyricAlignModePip === index) ? this.themeColor :Color.Transparent)
               .border({
               .border({
                 color: (!isPip&&this.currentLyricAlignMode === index) || (isPip&&this.currentLyricAlignModePip === index)?
                 color: (!isPip&&this.currentLyricAlignMode === index) || (isPip&&this.currentLyricAlignModePip === index)?
                   '#007DFF' : '#DDDDDD',
                   '#007DFF' : '#DDDDDD',
@@ -7048,7 +7061,7 @@ export struct LocalMusic {
 
 
       Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
       Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
 
 
-        ForEach(this.moreItems, (more: MoreItem) => {
+        ForEach(this.moreItems, (more: MoreItem,index:number) => {
           Button({ type: ButtonType.Capsule, stateEffect: true }) {
           Button({ type: ButtonType.Capsule, stateEffect: true }) {
             Row() {
             Row() {
               if (more.id === 3) {
               if (more.id === 3) {
@@ -7312,6 +7325,7 @@ export struct LocalMusic {
             .borderRadius(12)
             .borderRadius(12)
             .margin({ bottom: 6 })
             .margin({ bottom: 6 })
           }
           }
+          .transition(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 600, curve: Curve.Ease, delay: 60*index }))
           .backgroundColor(Color.Transparent)
           .backgroundColor(Color.Transparent)
           .onClick(() => {
           .onClick(() => {
             this.doMore(more.id)
             this.doMore(more.id)

+ 1 - 1
entry/src/main/ets/viewmodel/MainViewModel.ets

@@ -67,7 +67,7 @@ export  class  MainViewModel{
   getDrawerData2(): Array<ItemData> {
   getDrawerData2(): Array<ItemData> {
     let drawerGridData: ItemData[] = [
     let drawerGridData: ItemData[] = [
       new ItemData($r('app.string.local_music'), { type: 'symbol', value: $r('sys.symbol.music') }, MainViewModel.MENU_MUSIC, false),
       new ItemData($r('app.string.local_music'), { type: 'symbol', value: $r('sys.symbol.music') }, MainViewModel.MENU_MUSIC, false),
-      new ItemData($r('app.string.user_center'), { type: 'symbol', value: $r('sys.symbol.person') }, MainViewModel.MENU_USER, false),
+      // new ItemData($r('app.string.user_center'), { type: 'symbol', value: $r('sys.symbol.person') }, MainViewModel.MENU_USER, false),
       new ItemData($r('app.string.file_scan'), { type: 'symbol', value: $r('sys.symbol.doc_text_badge_magnifyingglass') },MainViewModel.MENU_FILE_SCAN,false),
       new ItemData($r('app.string.file_scan'), { type: 'symbol', value: $r('sys.symbol.doc_text_badge_magnifyingglass') },MainViewModel.MENU_FILE_SCAN,false),
       new ItemData($r('app.string.vip'), { type: 'symbol', value: $r('sys.symbol.vip_hand') }, MainViewModel.MENU_VIP, false),
       new ItemData($r('app.string.vip'), { type: 'symbol', value: $r('sys.symbol.vip_hand') }, MainViewModel.MENU_VIP, false),
       new ItemData($r('app.string.haoping'), { type: 'symbol', value: $r('sys.symbol.flower') },MainViewModel.MENU_HAOPING,false),
       new ItemData($r('app.string.haoping'), { type: 'symbol', value: $r('sys.symbol.flower') },MainViewModel.MENU_HAOPING,false),

+ 2 - 0
lib/src/main/ets/view/LyricView2.ets

@@ -225,6 +225,8 @@ export struct LyricView2 {
         .height('100%')
         .height('100%')
         .scrollBar(BarState.Off)
         .scrollBar(BarState.Off)
         .cachedCount(this.cacheSize)
         .cachedCount(this.cacheSize)
+        .transition(TransitionEffect.move(TransitionEdge.BOTTOM)
+            .animation({ duration: 500, curve: Curve.Ease }))
         .visibility(this.isLoadingData ? Visibility.Hidden : Visibility.Visible)
         .visibility(this.isLoadingData ? Visibility.Hidden : Visibility.Visible)
         .onScrollIndex((_, __, center) => {
         .onScrollIndex((_, __, center) => {
             const now = Date.now()
             const now = Date.now()