Ver Fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	entry/src/main/ets/pages/AboutPage.ets
#	entry/src/main/ets/pages/NewIndex.ets
#	entry/src/main/ets/pages/SettingPage.ets
#	entry/src/main/ets/view/LocalMusic.ets
chendeben há 1 ano atrás
pai
commit
395820ae4c
92 ficheiros alterados com 409 adições e 315 exclusões
  1. 1 1
      entry/src/main/ets/common/constants/CommonConstants.ets
  2. 33 2
      entry/src/main/ets/common/util/MediaTable.ets
  3. 15 10
      entry/src/main/ets/common/util/NetAxiosUtil.ets
  4. 2 2
      entry/src/main/ets/common/util/RdbUtils.ets
  5. 8 5
      entry/src/main/ets/pages/AboutPage.ets
  6. 106 50
      entry/src/main/ets/pages/NewIndex.ets
  7. 1 1
      entry/src/main/ets/pages/ScanFilePage.ets
  8. 157 145
      entry/src/main/ets/pages/SettingPage.ets
  9. 11 13
      entry/src/main/ets/pages/VipPage.ets
  10. 75 86
      entry/src/main/ets/view/LocalMusic.ets
  11. BIN
      entry/src/main/resources/base/media/add_net.png
  12. BIN
      entry/src/main/resources/base/media/allchannel_normal.png
  13. BIN
      entry/src/main/resources/base/media/allchannel_pressed.png
  14. BIN
      entry/src/main/resources/base/media/delay.png
  15. BIN
      entry/src/main/resources/base/media/dingwei.png
  16. BIN
      entry/src/main/resources/base/media/dir2.png
  17. BIN
      entry/src/main/resources/base/media/dir3.png
  18. BIN
      entry/src/main/resources/base/media/down.png
  19. BIN
      entry/src/main/resources/base/media/fwc.png
  20. BIN
      entry/src/main/resources/base/media/guangpan.png
  21. BIN
      entry/src/main/resources/base/media/hm_dao.png
  22. BIN
      entry/src/main/resources/base/media/hm_dun.png
  23. BIN
      entry/src/main/resources/base/media/hm_huojian.png
  24. BIN
      entry/src/main/resources/base/media/hm_ip.png
  25. BIN
      entry/src/main/resources/base/media/hm_net.png
  26. BIN
      entry/src/main/resources/base/media/ic_action_info_detail.png
  27. BIN
      entry/src/main/resources/base/media/ic_action_open_with.png
  28. BIN
      entry/src/main/resources/base/media/ic_album.png
  29. BIN
      entry/src/main/resources/base/media/ic_avatar10.png
  30. BIN
      entry/src/main/resources/base/media/ic_avatar4.png
  31. BIN
      entry/src/main/resources/base/media/ic_avatar5.png
  32. BIN
      entry/src/main/resources/base/media/ic_avatar6.jpg
  33. BIN
      entry/src/main/resources/base/media/ic_avatar8.png
  34. BIN
      entry/src/main/resources/base/media/ic_content_content_copy.png
  35. BIN
      entry/src/main/resources/base/media/ic_content_copy_black_24dp.png
  36. BIN
      entry/src/main/resources/base/media/ic_dashboard_black_24dp.png
  37. BIN
      entry/src/main/resources/base/media/ic_edit.png
  38. BIN
      entry/src/main/resources/base/media/ic_explore_black_24dp.png
  39. BIN
      entry/src/main/resources/base/media/ic_favorite_border_black_24dp.png
  40. BIN
      entry/src/main/resources/base/media/ic_fire_normal.png
  41. BIN
      entry/src/main/resources/base/media/ic_fire_selected.png
  42. BIN
      entry/src/main/resources/base/media/ic_girl_normal.png
  43. BIN
      entry/src/main/resources/base/media/ic_girl_selected.png
  44. BIN
      entry/src/main/resources/base/media/ic_home_normal.png
  45. BIN
      entry/src/main/resources/base/media/ic_ondemand_video_black_24dp.png
  46. BIN
      entry/src/main/resources/base/media/ic_player_error_place_holder.png
  47. BIN
      entry/src/main/resources/base/media/ic_private.png
  48. BIN
      entry/src/main/resources/base/media/icon_about.png
  49. BIN
      entry/src/main/resources/base/media/icon_dun.png
  50. BIN
      entry/src/main/resources/base/media/icon_heart.png
  51. BIN
      entry/src/main/resources/base/media/icon_key.png
  52. BIN
      entry/src/main/resources/base/media/icon_lock_1.png
  53. BIN
      entry/src/main/resources/base/media/icon_rank.png
  54. BIN
      entry/src/main/resources/base/media/icon_right.png
  55. BIN
      entry/src/main/resources/base/media/icon_signal.png
  56. BIN
      entry/src/main/resources/base/media/icon_storage.png
  57. BIN
      entry/src/main/resources/base/media/icon_tower.png
  58. BIN
      entry/src/main/resources/base/media/icon_wu.png
  59. BIN
      entry/src/main/resources/base/media/local_nor.png
  60. BIN
      entry/src/main/resources/base/media/mi.png
  61. BIN
      entry/src/main/resources/base/media/my_nor.png
  62. BIN
      entry/src/main/resources/base/media/my_phone.png
  63. BIN
      entry/src/main/resources/base/media/my_pr.png
  64. BIN
      entry/src/main/resources/base/media/my_press.png
  65. BIN
      entry/src/main/resources/base/media/my_un.png
  66. BIN
      entry/src/main/resources/base/media/paytype_select.png
  67. BIN
      entry/src/main/resources/base/media/play_64.png
  68. BIN
      entry/src/main/resources/base/media/radar_center.png
  69. BIN
      entry/src/main/resources/base/media/radar_center2.png
  70. BIN
      entry/src/main/resources/base/media/radar_center_carmer.png
  71. BIN
      entry/src/main/resources/base/media/radar_center_safe.png
  72. BIN
      entry/src/main/resources/base/media/radar_center_safe22.png
  73. BIN
      entry/src/main/resources/base/media/right_more.png
  74. BIN
      entry/src/main/resources/base/media/rotate.png
  75. BIN
      entry/src/main/resources/base/media/route.png
  76. BIN
      entry/src/main/resources/base/media/safe_icon2.png
  77. BIN
      entry/src/main/resources/base/media/send.png
  78. BIN
      entry/src/main/resources/base/media/setting.png
  79. BIN
      entry/src/main/resources/base/media/shoucang.png
  80. BIN
      entry/src/main/resources/base/media/small_eye.png
  81. BIN
      entry/src/main/resources/base/media/small_eyeck.png
  82. BIN
      entry/src/main/resources/base/media/small_key.png
  83. BIN
      entry/src/main/resources/base/media/small_lock.png
  84. BIN
      entry/src/main/resources/base/media/small_safe.png
  85. BIN
      entry/src/main/resources/base/media/split_1.png
  86. BIN
      entry/src/main/resources/base/media/split_left_1.png
  87. BIN
      entry/src/main/resources/base/media/split_right_1.png
  88. BIN
      entry/src/main/resources/base/media/success.png
  89. BIN
      entry/src/main/resources/base/media/success_fragment.png
  90. BIN
      entry/src/main/resources/base/media/success_fragment_camera.png
  91. BIN
      entry/src/main/resources/base/media/success_fragment_small.png
  92. BIN
      entry/src/main/resources/base/media/video_s.png

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

@@ -143,7 +143,7 @@ export class CommonConstants {
 
 
   static readonly musicBgList = [$r('app.media.ic_avatar7'),
-    $r('app.media.ic_avatar2'),$r('app.media.welcomeBg'),
+    $r('app.media.ic_avatar2'),$r('app.media.avatar'),
     $r('app.media.ic_avatar4'),$r('app.media.ic_avatar5'),
     $r('app.media.ic_avatar6'),$r('app.media.ic_avatar1'),
     $r('app.media.ic_avatar8'),$r('app.media.ic_avatar9'),$r('app.media.ic_avatar10')

+ 33 - 2
entry/src/main/ets/common/util/MediaTable.ets

@@ -176,6 +176,37 @@ export default class MediaTable {
     });
   }
 
+  // 根据isFav查询数据
+  public queryByisFav(isFav: number, callback: (result: VideoItem[]) => void) {
+    const predicates = new relationalStore.RdbPredicates(RdbUtils.MEDIA_TABLE.tableName);
+    predicates.equalTo('isFav', isFav);
+
+    this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
+      const result = this.parseResultSetToVideoItems(resultSet);
+      callback(result);
+    });
+  }
+
+  // 根据filePath更新isFav的值
+  public updateIsFavByFilePath(filePath: string, isFav: number, callback: (success: boolean, error?: string) => void) {
+    const predicates = new relationalStore.RdbPredicates(RdbUtils.MEDIA_TABLE.tableName);
+    predicates.equalTo('filePath', filePath);
+
+    this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
+      if (resultSet.rowCount === 0) {
+        callback(false, 'Error: File not found');
+        resultSet.close();
+        return;
+      }
+      resultSet.close();
+
+      const valueBucket: relationalStore.ValuesBucket = { isFav: isFav };
+      this.accountTable.updateData(predicates, valueBucket, (success: boolean) => {
+        callback(success, success ? '' : 'Update failed');
+      });
+    });
+  }
+
   // 查询全部,或者某个id(查询的字段,回调,是否查询全部)
   query(id: number, callback: Function, isAll: boolean = true) {
     let predicates = new relationalStore.RdbPredicates(RdbUtils.MEDIA_TABLE.tableName);
@@ -355,7 +386,7 @@ export default class MediaTable {
       safeGet('pixelMapPath'),safeGet('artist'),
       safeGet('album'),safeGet('fileName')
     );
-    item.isFav = rs.getDouble(rs.getColumnIndex('videoSize'));
+    item.isFav = rs.getDouble(rs.getColumnIndex('isFav'));
 
 
 
@@ -375,7 +406,7 @@ function generateBucket(item: VideoItem): relationalStore.ValuesBucket {
   obj.videoSize = item.videoSize;
   obj.cTime = item.cTime;
   obj.parentPath = item.parentPath;
-  // obj.isFav = item.isFav;
+  obj.isFav = item.isFav;
 
   // if(item.pixelMapToString){
   //   obj.pixelMapToString = item.pixelMapToString;

+ 15 - 10
entry/src/main/ets/common/util/NetAxiosUtil.ets

@@ -22,6 +22,9 @@ class NetAxiosUtil{
         LogUtil.debug("Heanup 未设置API");
         return ''
       }
+      if(baseUrl.includes(CommonConstants.LRC_API_2)){
+        isApi2 = true
+      }
       let requestUrl = baseUrl
         + '?title=' + encodeURIComponent(title.trim()) + '&artist=' + encodeURIComponent(artist.trim());
 
@@ -30,8 +33,8 @@ class NetAxiosUtil{
       const httpRequest = http.createHttp();
       const options: http.HttpRequestOptions = {
         method: http.RequestMethod.GET,
-        readTimeout: 60000,
-        connectTimeout: 60000,
+        readTimeout: 3000,
+        connectTimeout: 3000,
       };
 
       const response: http.HttpResponse = await httpRequest.request(requestUrl, options);
@@ -65,23 +68,25 @@ class NetAxiosUtil{
 
     try {
       let baseUrl = cover_api
+      LogUtil.debug("onecold getLyricCover baseUrl = "+baseUrl+title+artist);
       if(cover_api===undefined&&StrUtil.isEmpty(cover_api)){
+        LogUtil.debug("onecold getLyricCover baseUrl2 = "+baseUrl);
         baseUrl =  PreferencesUtil.getStringSync('COVER_API','')
-        if ( baseUrl=='') {
-          LogUtil.debug("Heanup 未设置API");
-          return ''
-        }
       }
-
+      LogUtil.debug("onecold getLyricCover baseUrl3 = "+baseUrl);
+      if ( baseUrl=='') {
+        LogUtil.debug("onecold Heanup 未设置API");
+        return ''
+      }
       const cover_url = baseUrl
         + '?title=' + encodeURIComponent(title.trim()) + '&artist=' + encodeURIComponent(artist.trim());
       const httpRequest = http.createHttp();
       const options: http.HttpRequestOptions = {
         method: http.RequestMethod.GET,
-        readTimeout: 60000,
-        connectTimeout: 60000,
+        readTimeout: 3000,
+        connectTimeout: 3000,
       };
-      LogUtil.debug("Heanup 请求封面URL: " + cover_url);
+      LogUtil.debug("onecold Heanup 请求封面URL: " + cover_url);
       const response: http.HttpResponse = await httpRequest.request(cover_url, options);
       if (response.responseCode === 200) {
         const res = response.result as string;

+ 2 - 2
entry/src/main/ets/common/util/RdbUtils.ets

@@ -134,9 +134,9 @@ export default class RdbUtils {
                 const updateValues: relationalStore.ValuesBucket = { pixelMapPath: newPixelMapPath };
                 this.updateData(predicates, updateValues, (updateSuccess: boolean) => {
                   if (updateSuccess) {
-                    Logger.info(RdbUtils.RDB_TAG, `Updated pixelMapPath for id ${id}.`);
+                    Logger.info(RdbUtils.RDB_TAG, `onecold Updated pixelMapPath for id ${id}.`);
                   } else {
-                    Logger.error(RdbUtils.RDB_TAG, `Failed to update pixelMapPath for id ${id}.`);
+                    Logger.error(RdbUtils.RDB_TAG, `onecold Failed to update pixelMapPath for id ${id}.`);
                   }
                   callback(updateSuccess);
                 });

+ 8 - 5
entry/src/main/ets/pages/AboutPage.ets

@@ -34,7 +34,7 @@ export struct AboutPage{
     })
   @State verName:string = ''
   @State appName:string = ''
-  
+
   // 组件生命周期
   aboutToAppear() {
     this.verName =  AppUtil.getVersionName()
@@ -79,10 +79,12 @@ export struct AboutPage{
               });
             })
 
-          Button('加入讨论组:685109858', { type: ButtonType.Capsule, stateEffect: false })
-            .width('70%')
+          Button('加入Q群:685109858', { type: ButtonType.Capsule, stateEffect: false })
+            .width('60%')
             .height(55)
             .margin({top:50,bottom:20})
+              // .visibility(Visibility.None)
+            .stateEffect(true)
             .backgroundColor(this.isDarkMode ? '#1E90FF' : '#FF4081')
             .stateStyles({
               pressed: { opacity: 0.6 }
@@ -93,8 +95,9 @@ export struct AboutPage{
             })
 
           Button('用户反馈', { type: ButtonType.Capsule, stateEffect: false })
-            .width('70%')
+            .width('60%')
             .height(55)
+            .stateEffect(true)
             .margin({bottom:20})
             .backgroundColor(this.isDarkMode ? '#1E90FF' : '#FF4081')
             .stateStyles({
@@ -104,7 +107,7 @@ export struct AboutPage{
               AlertDialog.show({
                 title:'发送邮件',
                 message:'感谢你的支持,如果有什么不支持的格式不能播放请反馈给我们修复,谢谢!有建议和反馈的请邮件联系我们:'+CommonConstants.CONTACT_MAIL,
-                autoCancel:true, 
+                autoCancel:true,
                 alignment:DialogAlignment.Center,
                 offset:{dx:0,dy:-20},
                 confirm:{

+ 106 - 50
entry/src/main/ets/pages/NewIndex.ets

@@ -1,4 +1,4 @@
-import { AppUtil, DisplayUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils';
+import { AppUtil, DeviceUtil,DisplayUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils';
 import TitleBar from '../view/TitleBar';
 import { router } from '@kit.ArkUI';
 import mainViewModel, { MainViewModel } from '../viewmodel/MainViewModel';
@@ -23,6 +23,8 @@ import { BreakpointSystem, BreakpointTypeEnum } from '../common/util/BreakpointS
 import dataStorage from '@ohos.data.storage';
 import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
 import { SettingPage } from './SettingPage';
+import { deviceInfo } from '@kit.BasicServicesKit';
+import { resourceManager } from '@kit.LocalizationKit';
 
 const TAG = 'NewIndex'; // 日志标签
 
@@ -64,6 +66,8 @@ struct NewIndex{
   @Provide('isMusicZero') isMusicZero:boolean = false;
   /** 本地音乐列表,持久化存储 */
   @StorageLink('musicLocalList')  musicLocalList: Array<VideoItem> = []
+
+  @Provide isFavMusic:boolean =  false
   /** 标题栏配置模型 */
   @State titleBarModel: TitleBar.Model = new TitleBar.Model()
     .setTitleTextStyle(FontStyle.Normal)
@@ -121,7 +125,7 @@ struct NewIndex{
    * - 如果是根目录,双击返回键退出应用,否则提示
    */
   onBackPress(): boolean | void {
-    if(this.currentPath !== this.rootPath||this.isHistory||(this.modeType!==0&&this.isCanBack)){
+    if(this.currentPath !== this.rootPath||this.isHistory||this.isFavMusic||(this.modeType!==0&&this.isCanBack)){
       const eventData: emitter.EventData = {};
       emitter.emit({ eventId: 888 }, eventData); // 发送音频广播通知更新doSwipBack
     }else{
@@ -172,12 +176,12 @@ struct NewIndex{
       // 从持久化存储中读取深色模式设置
       const savedDarkMode = PreferencesUtil.getBooleanSync(SettingPage.IS_DARK_MODE, false);
       this.isDarkMode = savedDarkMode;
-      
+
       // 更新 AppStorage 中的颜色模式
       const colorMode = savedDarkMode ? ConfigurationConstant.ColorMode.COLOR_MODE_DARK : ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
       AppStorage.setOrCreate('currentColorMode', colorMode);
       AppStorage.setOrCreate('isDarkMode', savedDarkMode);
-      
+
       // 通知系统更新颜色模式
       const context = getContext(this) as common.UIAbilityContext;
       context.getApplicationContext().setColorMode(colorMode);
@@ -226,57 +230,65 @@ struct NewIndex{
 
       // 侧边抽屉菜单
       if(this.isShowDrawer){
-        Column() {
           Column() {
-            // 抽屉顶部背景图
-            Image($r('app.media.bg_music'))
-              .width('100%')
-              .height(180)
-            // 动态生成抽屉菜单内容
-            this.getDrawerView()
+            Column() {
+              // 抽屉顶部背景图
+              Image($r('app.media.bg_music'))
+                .width('100%')
+                .visibility(this.isCoverOpacity()?Visibility.None:Visibility.Visible)
+                .height(180)
+              Blank()
+                .backgroundColor($r('app.color.title_bar_bg'))
+                .visibility(this.isCoverOpacity()?Visibility.Visible:Visibility.None)
+                .width('100%')
+                .height(55)
+              // 动态生成抽屉菜单内容
+              this.getDrawerView()
+            }
+            .width(this.currentBreakpoint !== BreakpointTypeEnum.SM?'40%':'75%')
+            .height('100%')
+          .backgroundColor($r('app.color.silvery'))
+            .onClick((event:ClickEvent)=>{
+              // 阻止事件冒泡
+            })
           }
-          .width(this.currentBreakpoint !== BreakpointTypeEnum.SM?'40%':'80%')
+          .width('100%')
           .height('100%')
-          .backgroundColor($r('app.color.silvery'))
+          .backgroundColor($r('app.color.ban_touming'))
+          .alignItems(HorizontalAlign.Start)
           .onClick((event:ClickEvent)=>{
-            // 阻止事件冒泡
-          })
-        }
-        .width('100%')
-        .height('100%')
-        .backgroundColor($r('app.color.ban_touming'))
-        .alignItems(HorizontalAlign.Start)
-        .onClick((event:ClickEvent)=>{
-          // 点击抽屉外部关闭抽屉
-          animateTo({ duration: 555 }, () => {
-            this.isShowDrawer = false
-          })
-        })
-        .translate({ x: this.offsetX, y: 0, z: 0 })
-        .transition({ type: TransitionType.Insert, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
-        .transition({ type: TransitionType.Delete, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
-        .gesture(
-          PanGesture()
-            .onActionUpdate((event:GestureEvent)=>{
-              // 手势滑动更新抽屉偏移
-              if(event.offsetX<0){
-                this.offsetX = event.offsetX;
-              }
-            })
-            .onActionEnd(() => {
-              // 手势结束判断是否关闭抽屉
-              if(this.offsetX<-DisplayUtil.getWidth()/9){
-                animateTo({ duration: 555 }, () => {
-                  this.isShowDrawer = false
-                })
-              }else{
-                animateTo({ duration: 555 }, () => {
-                  this.isShowDrawer = true
-                  this.offsetX = 0
-                })
-              }
+            // 点击抽屉外部关闭抽屉
+            animateTo({ duration: 555 }, () => {
+              this.isShowDrawer = false
             })
-        )
+          })
+          .translate({ x: this.offsetX, y: 0, z: 0 })
+          .transition({ type: TransitionType.Insert, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
+          .transition({ type: TransitionType.Delete, translate: { x: -DisplayUtil.getWidth(), y: 0 } })
+          .gesture(
+            PanGesture()
+              .onActionUpdate((event:GestureEvent)=>{
+                // 手势滑动更新抽屉偏移
+                if(event.offsetX<0){
+                  this.offsetX = event.offsetX;
+                }
+              })
+              .onActionEnd(() => {
+                // 手势结束判断是否关闭抽屉
+                if(this.offsetX<-DisplayUtil.getWidth()/9){
+                  animateTo({ duration: 555 }, () => {
+                    this.isShowDrawer = false
+                  })
+                }else{
+                  animateTo({ duration: 555 }, () => {
+                    this.isShowDrawer = true
+                    this.offsetX = 0
+                  })
+                }
+              })
+          )
+
+
       }
     }
   }
@@ -312,6 +324,7 @@ struct NewIndex{
           }
           .width('100%')
           .height(55)
+          .useEffect(true)
           .onClick(async () => {
             // 根据 item.id 跳转或切换功能
             switch (item.id) {
@@ -423,6 +436,7 @@ struct NewIndex{
         }
         .width('90%')
         .height(55)
+
       })
     }
     .width('100%')
@@ -542,6 +556,48 @@ struct NewIndex{
     this.status = "广告加载中..."
   }
 
+
+
+  @StorageProp('currentHeightBreakpoint') currentHeightBreakpoint: HeightBreakpoint | undefined =
+    HeightBreakpoint.HEIGHT_LG;
+  @StorageProp('currentWidthBreakpoint') currentWidthBreakpoint: WidthBreakpoint | undefined = WidthBreakpoint.WIDTH_SM;
+
+  //是否是Pura X外屏,或者小屏幕
+  isPuraWP() {
+    return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM
+      && this.currentHeightBreakpoint === HeightBreakpoint.HEIGHT_MD
+  }
+  //是否是Pura X外屏,或者小屏幕或者手机横屏
+  isCoverOpacity() {
+    if (this.isPuraWP()) {
+      return true
+    }
+
+    if (this.isPhoneLan()) {
+      return true
+    }
+
+    if (deviceInfo.marketName.includes('Pura X')
+      && this.currentHeightBreakpoint === HeightBreakpoint.HEIGHT_SM) {
+      return true
+    }
+
+
+    return false
+  }
+
+  //是不是手机横屏
+  isPhoneLan() {
+    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
+      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
+      if (DisplayUtil.getFoldStatus() === 0 || DisplayUtil.getFoldStatus() === 2) {
+        return true
+      }
+    }
+
+    return false
+  }
+
   /**
    * 展示Banner广告
    */

+ 1 - 1
entry/src/main/ets/pages/ScanFilePage.ets

@@ -198,7 +198,7 @@ export struct ScanFilePage{
             Column() {
               Button($r('app.string.start_scan'), { type: ButtonType.Capsule, stateEffect: false })
 
-                .width('80%')
+                .width('60%')
                 .height(55)
                 .margin({ top: 50, bottom: 20 })
                 .linearGradient({

+ 157 - 145
entry/src/main/ets/pages/SettingPage.ets

@@ -115,7 +115,7 @@ export struct SettingPage {
     this.isMediacodec = PreferencesUtil.getBooleanSync(SettingPage.IS_MIDIACODEC_OPEN, false)
     this.isMusicMemoryPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false)
     this.isMusicBGCover = PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_BG_COVER, true)
-    
+
     // 从持久化存储中读取深色模式设置
     const savedDarkMode = PreferencesUtil.getBooleanSync(SettingPage.IS_DARK_MODE, false);
     this.isDarkMode = savedDarkMode;
@@ -136,14 +136,14 @@ export struct SettingPage {
   async toggleDarkMode(checked: boolean) {
     try {
       const newMode = checked ? ConfigurationConstant.ColorMode.COLOR_MODE_DARK : ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
-      
+
       // 更新 AppStorage 中的颜色模式
       AppStorage.setOrCreate('currentColorMode', newMode);
       AppStorage.setOrCreate('isDarkMode', checked);
-      
+
       // 保存深色模式设置到持久化存储
       PreferencesUtil.putSync(SettingPage.IS_DARK_MODE, checked);
-      
+
       // 通知系统更新颜色模式
       const context = getContext(this) as common.UIAbilityContext;
       context.getApplicationContext().setColorMode(newMode);
@@ -166,48 +166,49 @@ export struct SettingPage {
   }
 
   build() {
+
     Column() {
       TitleBar({ model: $titleBarModel })
-      Column() {
+      Scroll() {
+        Column() {
         // 主题设置
-        Row() {
+          Row() {
           Text('主题设置')
-            .margin({ left: 38, right: 20 })
-            .fontSize(16)
-            .fontColor(Color.Gray)
-            .fontWeight(480)
-          Blank()
-        }
-        .width('100%')
-        .height(55)
-
-        Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+              .margin({ left: 38, right: 20 })
+              .fontSize(16)
+              .fontColor(Color.Gray)
+              .fontWeight(480)
+            Blank()
+          }
+          .width('100%')
+          .height(55)
+          Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
 
         // 深色模式开关
-        Row() {
-          Image($r('app.media.kp_music_nor'))
-            .width(22)
-            .height(22)
-            .alignSelf(ItemAlign.Center)
-            .margin({ left: 28 })
+          Row() {
+            Image($r('app.media.kp_music_nor'))
+              .width(22)
+              .height(22)
+              .alignSelf(ItemAlign.Center)
+              .margin({ left: 28 })
           Text('深色模式')
-            .margin({ left: 10, right: 20 })
-            .fontSize(15)
-            .fontColor(Color.Gray)
-            .fontWeight(480)
-          Blank()
+              .margin({ left: 10, right: 20 })
+              .fontSize(15)
+              .fontColor(Color.Gray)
+              .fontWeight(480)
+            Blank()
           Toggle({ type: ToggleType.Switch, isOn: this.isDarkMode })
             .selectedColor($r('app.color.title_bar_bg'))
             .switchPointColor(Color.White)
-            .margin({ right: 28 })
+              .margin({ right: 28 })
             .onChange((checked: boolean) => {
               this.toggleDarkMode(checked);
-            })
-            .width(50)
-            .height(30);
-        }
-        .width('100%')
-        .height(55)
+              })
+              .width(50)
+              .height(30);
+          }
+          .width('100%')
+          .height(55)
 
         Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
 
@@ -223,19 +224,19 @@ export struct SettingPage {
         .width('100%')
         .height(55)
 
-        Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
-        Row() {
-          Image($r('app.media.kp_music_nor'))
-            .width(22)
-            .height(22)
-            .alignSelf(ItemAlign.Center)
-            .margin({ left: 28 })
+          Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+          Row() {
+            Image($r('app.media.kp_music_nor'))
+              .width(22)
+              .height(22)
+              .alignSelf(ItemAlign.Center)
+              .margin({ left: 28 })
           Text('记忆播放')
-            .margin({ left: 10, right: 20 })
-            .fontSize(15)
-            .fontColor(Color.Gray)
-            .fontWeight(480)
-          Blank()
+              .margin({ left: 10, right: 20 })
+              .fontSize(15)
+              .fontColor(Color.Gray)
+              .fontWeight(480)
+            Blank()
           Toggle({ type: ToggleType.Switch, isOn: this.isMusicMemoryPlay })
             .selectedColor($r('app.color.title_bar_bg'))// 设置开关打开时的背景颜色为蓝色
             .switchPointColor(Color.White)// 设置开关关闭时的滑块颜色为白色
@@ -243,119 +244,130 @@ export struct SettingPage {
             .onChange((checked: boolean) => { // 选择开关状态变化时触发事件
               this.isMusicMemoryPlay = checked;
               PreferencesUtil.put(SettingPage.iS_MUSIC_MEMORY_PLAY, this.isMusicMemoryPlay)
-            })
+              })
             .width(50)
             .height(30);
-        }
-        .width('100%')
-        .height(55)
+          }
+          .width('100%')
+          .height(55)
 
-        Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
-        Row() {
-          Image($r('app.media.kp_music_nor'))
-            .width(22)
-            .height(22)
-            .alignSelf(ItemAlign.Center)
-            .margin({ left: 28 })
-          Text('播放背景随音乐封面')
-            .margin({ left: 10, right: 20 })
-            .fontSize(15)
-            .fontColor(Color.Gray)
-            .fontWeight(480)
-          Blank()
-          Toggle({ type: ToggleType.Switch, isOn: this.isMusicBGCover })
-            .selectedColor($r('app.color.title_bar_bg'))// 设置开关打开时的背景颜色为蓝色
-            .switchPointColor(Color.White)// 设置开关关闭时的滑块颜色为白色
-            .margin({ right: 28 })
-            .onChange((checked: boolean) => { // 选择开关状态变化时触发事件
-              this.isMusicBGCover = checked;
-              PreferencesUtil.put(SettingPage.iS_MUSIC_BG_COVER, this.isMusicBGCover)
+          Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+          Row() {
+            Image($r('app.media.kp_music_nor'))
+              .width(22)
+              .height(22)
+              .alignSelf(ItemAlign.Center)
+              .margin({ left: 28 })
+            Text('播放背景随音乐封面')
+              .margin({ left: 10, right: 20 })
+              .fontSize(15)
+              .fontColor(Color.Gray)
+              .fontWeight(480)
+            Blank()
+            Toggle({ type: ToggleType.Switch, isOn: this.isMusicBGCover })
+              .selectedColor($r('app.color.title_bar_bg'))// 设置开关打开时的背景颜色为蓝色
+              .switchPointColor(Color.White)// 设置开关关闭时的滑块颜色为白色
+              .margin({ right: 28 })
+              .onChange((checked: boolean) => { // 选择开关状态变化时触发事件
+                this.isMusicBGCover = checked;
+                PreferencesUtil.put(SettingPage.iS_MUSIC_BG_COVER, this.isMusicBGCover)
 
-            })
-            .width(50)
-            .height(30);
-        }
-        .width('100%')
-        .height(55)
+              })
+              .width(50)
+              .height(30);
+          }
+          .width('100%')
+          .height(55)
 
-        Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+          Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
 
-        // API设置(合并标题)
-        Row() {
-          Text('API设置')
-            .margin({ left: 38, right: 20 })
-            .fontSize(16)
-            .fontColor(Color.Gray)
-            .fontWeight(480)
-        }
-        .width('100%')
-        .height(55)
+          // API设置(合并标题)
+          Row() {
+            Text('API设置')
+              .margin({ left: 38, right: 20 })
+              .fontSize(16)
+              .fontColor(Color.Gray)
+              .fontWeight(480)
+          }
+          .width('100%')
+          .height(55)
 
-        Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
-        // 歌词API地址展示
-        Row() {
-          Text('歌词:')
-            .margin({ left: 38, right: 6 })
-            .fontSize(15)
-            .fontColor(Color.Gray)
-          Text(this.lyricApiUrl)
-            .margin({ right: 10 })
-            .fontSize(15)
-            .fontColor(Color.Gray)
-            .layoutWeight(1)
-          // 编辑图标按钮
-          Image($r('app.media.edit'))
-            .width(28)
-            .height(28)
-            .margin({ right: 18 })
-            .onClick(() => {
-              this.apiDialogType = 'lyric'
-              this.tempApiUrl = this.lyricApiUrl
-              this.apiDialogController.open()
-            })
-          Blank()
-        }
-        .width('100%')
-        .margin({ top: 8, bottom: 12 })
+          Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
+          // 歌词API地址展示
+          Row() {
+            Text('歌词:')
+              .margin({ left: 38, right: 6 })
+              .fontSize(15)
+              .fontColor(Color.Gray)
+            Text(this.lyricApiUrl)
+              .margin({ right: 10 })
+              .fontSize(15)
+              .fontColor(Color.Gray)
+              .layoutWeight(1)
+            // 编辑图标按钮
+            Image($r('app.media.edit'))
+              .width(28)
+              .height(28)
+              .margin({ right: 18 })
+              .onClick(() => {
+                this.apiDialogType = 'lyric'
+                this.tempApiUrl = this.lyricApiUrl
+                this.apiDialogController.open()
+              })
+            Blank()
+          }
+          .width('100%')
+          .margin({ top: 8, bottom: 12 })
+
+          // 封面API地址展示
+          Row() {
+            Text('封面:')
+              .margin({ left: 38, right: 6 })
+              .fontSize(15)
+              .fontColor(Color.Gray)
+            Text(this.coverApiUrl)
+              .margin({ right: 10 })
+              .fontSize(15)
+              .fontColor(Color.Gray)
+              .layoutWeight(1)
+            // 编辑图标按钮
+            Image($r('app.media.edit'))
+              .width(28)
+              .height(28)
+              .margin({ right: 18 })
+              .onClick(() => {
+                this.apiDialogType = 'cover'
+                this.tempApiUrl = this.coverApiUrl
+                this.apiDialogController.open()
+              })
+            Blank()
+          }
+          .width('100%')
+          .margin({ top: 8, bottom: 12 })
 
-        // 封面API地址展示
-        Row() {
-          Text('封面:')
-            .margin({ left: 38, right: 6 })
-            .fontSize(15)
-            .fontColor(Color.Gray)
-          Text(this.coverApiUrl)
-            .margin({ right: 10 })
-            .fontSize(15)
-            .fontColor(Color.Gray)
-            .layoutWeight(1)
-          // 编辑图标按钮
-          Image($r('app.media.edit'))
-            .width(28)
-            .height(28)
-            .margin({ right: 18 })
-            .onClick(() => {
-              this.apiDialogType = 'cover'
-              this.tempApiUrl = this.coverApiUrl
-              this.apiDialogController.open()
-            })
-          Blank()
         }
-        .width('100%')
-        .margin({ top: 8, bottom: 12 })
+      .backgroundColor(this.isDarkMode ? '#1E1E1E' : Color.White)
+        .margin({
+          left: 25,
+          right: 25,
+          top: 20,
+          bottom: 50
+        })
+        .layoutWeight(1)
+        .justifyContent(FlexAlign.Start) // Align items to the start
+        .borderRadius(30)
+
 
       }
-      .backgroundColor(this.isDarkMode ? '#1E1E1E' : Color.White)
-      .margin({
-        left: 15,
-        right: 15,
-        top: 20,
-        bottom: 10
-      })
-      .borderRadius(30)
+      .scrollBar(BarState.Auto)
+      .height('100%')
+      .width('100%')
+      .margin({bottom:18})
+
     }
     .backgroundColor(this.isDarkMode ? '#121212' : $r('app.color.index_background'))
     .height('100%')
+    .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
   }
 
 }

+ 11 - 13
entry/src/main/ets/pages/VipPage.ets

@@ -118,7 +118,7 @@ export  struct  VipPage{
 
     Column() {
       TitleBar({ model: $titleBarModel })
-      // Scroll() {
+      Scroll() {
       Column() {
         Column() {
           Column() {
@@ -150,14 +150,13 @@ export  struct  VipPage{
           .height(72)
           .borderRadius(30)
         }
-
+        .height(72)
         .margin({
           left: 15,
           right: 15,
           top: 15,
           bottom: 0
         })
-        .justifyContent(FlexAlign.Center)
 
         Column() {
           Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
@@ -450,8 +449,7 @@ export  struct  VipPage{
           Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
         }
         .margin({top:20,bottom:15})
-        .layoutWeight(1)
-        Blank()
+
 
         Row(){
 
@@ -466,16 +464,16 @@ export  struct  VipPage{
               this.doPay()
             })
         }
-        .position({bottom:50})
-        .margin({top:15})
-
+        .margin({top:15,bottom:66})
+        .width('60%')
 
       }
-      // }
-      // .scrollBar(BarState.Off)
-      // .height('100%')
-      // .alignSelf(ItemAlign.Start)
-      // .width('100%')
+      .layoutWeight(1)
+      }
+      .scrollBar(BarState.Auto)
+      .height('100%')
+      .alignSelf(ItemAlign.Start)
+      .width('100%')
     }
   }
 

+ 75 - 86
entry/src/main/ets/view/LocalMusic.ets

@@ -180,6 +180,7 @@ export struct LocalMusic {
   }
 
   onModeChange() {
+    this.isFavMusic = false
     if (this.modeType === 2 || this.modeType === 3) {
       this.titleBarModel.setRightIcon(null)
     } else {
@@ -224,6 +225,9 @@ export struct LocalMusic {
   @Consume offsetX: number;
   @State isFac: boolean = false;
   @State facList: Array<String> = []
+
+  @State favList: Array<VideoItem>= []
+  @Consume isFavMusic:boolean
   @State isClickedPLayAll: boolean = false;
   private scrollerForlist: ListScroller = new ListScroller();
   imagesF: ImageFrameInfo[] = [
@@ -233,10 +237,7 @@ export struct LocalMusic {
     { src: $r("app.media.app_loading3") },
   ]
   @State animationState: AnimationStatus = AnimationStatus.Initial
-  imagesOk: ImageFrameInfo[] = [
-    { src: $r("app.media.success") }
 
-  ]
   // 缓存机制
   private cache: Map<string, Array<VideoItem>> = new Map();
   private stringCache: Map<string, string> = new Map(); // 新增字符串缓存
@@ -335,7 +336,7 @@ export struct LocalMusic {
       return
     }
 
-    if (this.isHistory) {
+    if (this.isHistory||this.isFavMusic) {
       this.isHistory = false
       this.getSortedFiles(this.currentPath)
       return
@@ -535,6 +536,7 @@ export struct LocalMusic {
     }
 
     this.getSortedFiles(this.rootPath).then(() => {
+      this.isFavMusic = false
       //穿山甲
       this.loadBannerAd(CSJUtil.getBannerID())
 
@@ -563,10 +565,20 @@ export struct LocalMusic {
     })
 
 
-    if (FileUtil.accessSync(this.favPath)) {
-      this.facList = FileUtil.listFileSync(this.favPath)
-    }
+    // if (FileUtil.accessSync(this.favPath)) {
+    //   this.facList = FileUtil.listFileSync(this.favPath)
+    // }
+    this.getFavList(false)
+  }
 
+  getFavList(isFavRefresh:boolean){
+    this.table.queryByisFav(1, async (result: VideoItem[]) => {
+      this.favList = result
+      if(isFavRefresh||this.isFavMusic){//如果是我的收藏,更新我的收藏数据
+        this.videoLocalList = this.favList
+        this.updateListData(this.videoLocalList)
+      }
+    })
   }
 
   // 组件消失生命周期
@@ -585,6 +597,7 @@ export struct LocalMusic {
   }
 
   async getSortedFiles(curPath: string, isWorkerPost?: boolean, destPath?: string, isOpen?: boolean) {
+    this.isFavMusic = false
     if (isWorkerPost) {
       workerInstance.postMessage({ code: 2, data: this.context }); //刷新媒体库列表
     }
@@ -696,7 +709,7 @@ export struct LocalMusic {
       console.info(`onecold gengxin 1: ${this.videoLocalList.length}`);
       // for (let i = 0; i < this.videoLocalList.length; i++) {
       //
-      //   console.info(`onecold gengxin 1: ${this.videoLocalList[i].name}`);
+      //   console.info(`onecold gengxin 1: ${this.videoLocalList[i].pixelMapPath}`);
       //
       // }
 
@@ -1807,6 +1820,7 @@ export struct LocalMusic {
               .width('35%')
               .height(60)
               .margin({ top: 10, bottom: 10, right: 6 })
+              .visibility(this.isFavMusic?Visibility.None:Visibility.Visible)
               .backgroundColor($r('app.color.tab_item_bg'))
               .onClick(() => {
                 this.showWarnIsDelete()
@@ -2021,51 +2035,37 @@ export struct LocalMusic {
     }
   }
 
-  //加入收藏
-  addFac(item: VideoItem) {
-    const newPath = this.favPath + '/' + item.fileName;
-    FileUtil.copyFile(item.filePath, newPath, 0).then(async () => {
-      let newItem: VideoItem = await Utility.uriGetMusicAssetsFromFile(this.context, newPath,
-        CommonConstants.TYPE_LOCAL, true);
-      this.table.insert(newItem, (id: number) => {
-        //加入数据库
-      });
-      ToastUtil.showToast('收藏成功');
-      this.cache.delete(this.favPath); // 删除目标路径缓存
-      if (FileUtil.accessSync(this.favPath)) {
-        this.facList = FileUtil.listFileSync(this.favPath)
-        this.isFac = Utility.getIsFac(this.facList, item)
-      }
+  doFav(item:VideoItem){
+    LogUtil.info('onecold doFav isFav=' +item.isFav)
 
-    }).catch((error: Error) => {
-      console.error(error.message);
-    });
-  }
+    let isFav = 0
+    if(Utility.getIsFav(this.favList,item)){
+      isFav = 0
+    }else{
+      isFav = 1
+    }
 
-  //取消收藏
-  async cancelFac(item: VideoItem) {
-    const newPath = this.favPath + '/' + item.fileName;
-    let newItem: VideoItem = await Utility.uriGetMusicAssetsFromFile(this.context, newPath,
-      CommonConstants.TYPE_LOCAL, true);
-    this.table.deleteData(newItem, () => {
-      FileUtil.unlink(newPath).then(() => {
-        ToastUtil.showToast('取消收藏成功');
-        this.cache.delete(this.favPath); // 删除目标路径缓存
-        if (FileUtil.accessSync(this.favPath)) {
-          this.facList = FileUtil.listFileSync(this.favPath)
-          this.isFac = Utility.getIsFac(this.facList, item)
+    this.table.updateIsFavByFilePath(item.filePath,isFav, async (result: boolean) => {
+      if(result){
+        if(isFav===1){
+          ToastUtil.showToast('收藏成功');
+        }else{
+          ToastUtil.showToast('取消收藏成功');
         }
-        if (this.currentPath === this.favPath) {
-          this.getSortedFiles(this.favPath)
+        this.deleteCache(this.currentPath)
+        this.getFavList(false)
+        if(this.modeType===0&&!this.isFavMusic){
+          LogUtil.info('onecold doFav currentPath ='+ this.currentPath)
+          this.getSortedFiles(this.currentPath)
         }
-
-      }).catch((error: Error) => {
-        console.error(error.message);
-      });
-    });
+        workerInstance.postMessage({ code: 2, data: this.context });
+        workerInstance.postMessage({ code: 3, data: this.context });
+        workerInstance.postMessage({ code: 4, data: this.context });
+      }
+    })
+  }
 
 
-  }
 
   //多选复制文件
   showCopyDialogForMultipleFiles(isCurrent: boolean, viewId: string) {
@@ -2551,8 +2551,12 @@ export struct LocalMusic {
           })// .opacity(this.opacityItem)
           .clickEffect({ level: ClickEffectLevel.MIDDLE })
           .onClick(() => {
-            this.deleteCache(this.currentPath)
-            this.getSortedFiles(this.currentPath)
+            if(this.isFavMusic){
+              this.getFavList(true)
+            }else{
+              this.deleteCache(this.currentPath)
+              this.getSortedFiles(this.currentPath)
+            }
           })
 
         Image($r("app.media.top_rank"))
@@ -2915,7 +2919,16 @@ export struct LocalMusic {
           }
           this.isHistory = true
           this.titleBarModel.setLeftIconMain($r('app.media.left_back_white'))
-        } else {
+        } else if(item.name === LocalMusic.STR_FAC_VIDEO){
+          this.titleBarModel.setTitleName('我的收藏')
+          //加载动画效果
+          this.updateListData(this.favList)
+          if(ArrayUtil.isEmpty(this.favList)){
+            ToastUtil.showToast('无音乐收藏记录')
+          }
+          this.isFavMusic = true
+          this.titleBarModel.setLeftIconMain($r('app.media.left_back_white'))
+        }else {
           this.currentPath = item.filePath
           this.getSortedFiles(this.currentPath)
         }
@@ -4907,19 +4920,13 @@ export struct LocalMusic {
 
             })
           //添加或取消收藏
-          Image(this.isFac ? $r('app.media.add_fac_light') : $r('app.media.add_fac'))
+          Image(Utility.getIsFav(this.favList,this.currentSong)?$r('app.media.add_fac_light'):$r('app.media.add_fac'))
             .width(24)
             .aspectRatio(CommonConstants.ASPECT_RATIO)
             .onClick(async () => {
-              if (this.currentSong) {
-                if (this.isFac) {
-                  this.cancelFac(this.currentSong)
-                } else {
-                  this.addFac(this.currentSong)
-                }
+              if(this.currentSong){
+                this.doFav(this.currentSong)
               }
-
-
             })
         }
         .margin({ right: 33 })
@@ -5030,7 +5037,7 @@ export struct LocalMusic {
       // .visibility(this.isHide?Visibility.Hidden:Visibility.Visible)
 
     }
-    .position({ bottom: 30 }) // 将  固定在底部
+    .position({ bottom:this.isCoverOpacity()?30: 55 }) // 将  固定在底部
 
   }
 
@@ -5104,7 +5111,7 @@ export struct LocalMusic {
         // 唱针以左上角为点选择逆时针40度
         Image($r('app.media.ic_music_cover_hand'))
           .height(130)
-          .margin({ bottom: 180, top: 10 })
+          .margin({ bottom: 220, top: 0 })
           .align(Alignment.Top)
           .rotate({ angle: this.rotateAngle2, centerX: 0, centerY: 0 })
           .opacity(this.isCoverOpacity() || this.isCoverRectangle ? 0 : 1)
@@ -6954,7 +6961,7 @@ export struct LocalMusic {
     // 应用启动时/内部切换循环模式,需要把应用内的当前的循环模式设置给AVSession。
     let playBState: avSession.AVPlaybackState = {
       loopMode: mLoopMode,
-      // isFavorite:Utility.getIsFav(this.favList,this.currentSong),
+      isFavorite:Utility.getIsFav(this.favList,this.currentSong),
     };
     this.avSessionController.getAvSession()?.setAVPlaybackState(playBState).then(() => {
       console.info(`set setLoopMode AVPlaybackState successfully`);
@@ -6968,19 +6975,11 @@ export struct LocalMusic {
       console.info(`on toggleFavorite `);
       // 应用收到收藏命令,进行收藏处理。
 
-      if (FileUtil.accessSync(this.favPath)) {
-        this.facList = FileUtil.listFileSync(this.favPath)
-        this.isFac = Utility.getIsFac(this.facList, this.currentSong)
-      }
-
-      if (this.isFac) {
-        this.cancelFac(this.currentSong)
-      } else {
-        this.addFac(this.currentSong)
-      }
+      this.isFac = Utility.getIsFav(this.favList,this.currentSong)
+      this.doFav(this.currentSong)
       // 应用内完成或者取消收藏,把新的收藏状态设置给AVSession。
       let playbackState: avSession.AVPlaybackState = {
-        isFavorite: !this.isFac,
+        isFavorite:!this.isFac,
       };
       this.avSessionController.getAvSession()?.setAVPlaybackState(playbackState).then(() => {
         console.info(`SetAVPlaybackState successfully`);
@@ -7633,7 +7632,7 @@ export struct LocalMusic {
     Row() {
       //加入收藏
       Button() {
-        Image(Utility.getIsFac(this.facList, item) ? $r('app.media.add_fac_light2') : $r('app.media.add_fac'))
+        Image(Utility.getIsFav(this.favList,item)?$r('app.media.add_fac_light2'):$r('app.media.add_fac'))
           .fillColor(Color.White)
           .width(20)
       }
@@ -7644,18 +7643,8 @@ export struct LocalMusic {
       .margin(5)
       .visibility(item.type === CommonConstants.TYPE_IS_DIR ? Visibility.None : Visibility.Visible)
       .onClick(() => {
-        if (item) {
-          if (FileUtil.accessSync(this.favPath)) {
-            this.facList = FileUtil.listFileSync(this.favPath)
-
-            this.isFac = Utility.getIsFac(this.facList, item)
-          }
-
-          if (this.isFac) {
-            this.cancelFac(item)
-          } else {
-            this.addFac(item)
-          }
+        if(item){
+          this.doFav(item)
         }
       })
 

BIN
entry/src/main/resources/base/media/add_net.png


BIN
entry/src/main/resources/base/media/allchannel_normal.png


BIN
entry/src/main/resources/base/media/allchannel_pressed.png


BIN
entry/src/main/resources/base/media/delay.png


BIN
entry/src/main/resources/base/media/dingwei.png


BIN
entry/src/main/resources/base/media/dir2.png


BIN
entry/src/main/resources/base/media/dir3.png


BIN
entry/src/main/resources/base/media/down.png


BIN
entry/src/main/resources/base/media/fwc.png


BIN
entry/src/main/resources/base/media/guangpan.png


BIN
entry/src/main/resources/base/media/hm_dao.png


BIN
entry/src/main/resources/base/media/hm_dun.png


BIN
entry/src/main/resources/base/media/hm_huojian.png


BIN
entry/src/main/resources/base/media/hm_ip.png


BIN
entry/src/main/resources/base/media/hm_net.png


BIN
entry/src/main/resources/base/media/ic_action_info_detail.png


BIN
entry/src/main/resources/base/media/ic_action_open_with.png


BIN
entry/src/main/resources/base/media/ic_album.png


BIN
entry/src/main/resources/base/media/ic_avatar10.png


BIN
entry/src/main/resources/base/media/ic_avatar4.png


BIN
entry/src/main/resources/base/media/ic_avatar5.png


BIN
entry/src/main/resources/base/media/ic_avatar6.jpg


BIN
entry/src/main/resources/base/media/ic_avatar8.png


BIN
entry/src/main/resources/base/media/ic_content_content_copy.png


BIN
entry/src/main/resources/base/media/ic_content_copy_black_24dp.png


BIN
entry/src/main/resources/base/media/ic_dashboard_black_24dp.png


BIN
entry/src/main/resources/base/media/ic_edit.png


BIN
entry/src/main/resources/base/media/ic_explore_black_24dp.png


BIN
entry/src/main/resources/base/media/ic_favorite_border_black_24dp.png


BIN
entry/src/main/resources/base/media/ic_fire_normal.png


BIN
entry/src/main/resources/base/media/ic_fire_selected.png


BIN
entry/src/main/resources/base/media/ic_girl_normal.png


BIN
entry/src/main/resources/base/media/ic_girl_selected.png


BIN
entry/src/main/resources/base/media/ic_home_normal.png


BIN
entry/src/main/resources/base/media/ic_ondemand_video_black_24dp.png


BIN
entry/src/main/resources/base/media/ic_player_error_place_holder.png


BIN
entry/src/main/resources/base/media/ic_private.png


BIN
entry/src/main/resources/base/media/icon_about.png


BIN
entry/src/main/resources/base/media/icon_dun.png


BIN
entry/src/main/resources/base/media/icon_heart.png


BIN
entry/src/main/resources/base/media/icon_key.png


BIN
entry/src/main/resources/base/media/icon_lock_1.png


BIN
entry/src/main/resources/base/media/icon_rank.png


BIN
entry/src/main/resources/base/media/icon_right.png


BIN
entry/src/main/resources/base/media/icon_signal.png


BIN
entry/src/main/resources/base/media/icon_storage.png


BIN
entry/src/main/resources/base/media/icon_tower.png


BIN
entry/src/main/resources/base/media/icon_wu.png


BIN
entry/src/main/resources/base/media/local_nor.png


BIN
entry/src/main/resources/base/media/mi.png


BIN
entry/src/main/resources/base/media/my_nor.png


BIN
entry/src/main/resources/base/media/my_phone.png


BIN
entry/src/main/resources/base/media/my_pr.png


BIN
entry/src/main/resources/base/media/my_press.png


BIN
entry/src/main/resources/base/media/my_un.png


BIN
entry/src/main/resources/base/media/paytype_select.png


BIN
entry/src/main/resources/base/media/play_64.png


BIN
entry/src/main/resources/base/media/radar_center.png


BIN
entry/src/main/resources/base/media/radar_center2.png


BIN
entry/src/main/resources/base/media/radar_center_carmer.png


BIN
entry/src/main/resources/base/media/radar_center_safe.png


BIN
entry/src/main/resources/base/media/radar_center_safe22.png


BIN
entry/src/main/resources/base/media/right_more.png


BIN
entry/src/main/resources/base/media/rotate.png


BIN
entry/src/main/resources/base/media/route.png


BIN
entry/src/main/resources/base/media/safe_icon2.png


BIN
entry/src/main/resources/base/media/send.png


BIN
entry/src/main/resources/base/media/setting.png


BIN
entry/src/main/resources/base/media/shoucang.png


BIN
entry/src/main/resources/base/media/small_eye.png


BIN
entry/src/main/resources/base/media/small_eyeck.png


BIN
entry/src/main/resources/base/media/small_key.png


BIN
entry/src/main/resources/base/media/small_lock.png


BIN
entry/src/main/resources/base/media/small_safe.png


BIN
entry/src/main/resources/base/media/split_1.png


BIN
entry/src/main/resources/base/media/split_left_1.png


BIN
entry/src/main/resources/base/media/split_right_1.png


BIN
entry/src/main/resources/base/media/success.png


BIN
entry/src/main/resources/base/media/success_fragment.png


BIN
entry/src/main/resources/base/media/success_fragment_camera.png


BIN
entry/src/main/resources/base/media/success_fragment_small.png


BIN
entry/src/main/resources/base/media/video_s.png