Browse Source

增加全选导入音频

onecold 1 năm trước cách đây
mục cha
commit
7fcae5be06
2 tập tin đã thay đổi với 38 bổ sung8 xóa
  1. 7 6
      build-profile.json5
  2. 31 2
      entry/src/main/ets/view/LocalMusic.ets

+ 7 - 6
build-profile.json5

@@ -4,6 +4,7 @@
       {
         "name": "default",
         "signingConfig": "default",
+        "targetSdkVersion": "5.0.5(17)",
         "compatibleSdkVersion": "5.0.0(12)",
         "runtimeOS": "HarmonyOS",
         "buildOption": {
@@ -27,13 +28,13 @@
         "name": "default",
         "type": "HarmonyOS",
         "material": {
-          "storeFile": "D:/chendeben/certs/myp12.p12",
-          "storePassword": "0000001DAA9835AF419CD3787F313188F96B61EA7B785570D4C2E9A4E7AEDE6DAC5522CD6BB3C33173FEFF6C7A",
-          "keyAlias": "chendeben",
-          "keyPassword": "0000001D7D111CE4E687E42E8C20E73447BDC91E7DDD4AA833E4CE7C57CA9041B162E8EDAFDF7521D45A184B07",
+          "certpath": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.cer",
+          "keyAlias": "debugKey",
+          "keyPassword": "0000001A8607A992F101508BFF9FB99305303317193BEAAD3C39D73E4742CA502414E766C05B288C3243",
+          "profile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p7b",
           "signAlg": "SHA256withECDSA",
-          "profile": "D:/chendeben/certs/chendeben-debugDebug.p7b",
-          "certpath": "D:/chendeben/certs/chendeben.cer"
+          "storeFile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p12",
+          "storePassword": "0000001AF761C52C1BFB02907D9736E34311D0367E4B52712D7229CD1C7CCEDFBFF3EB149B5EA0A4EECF"
         }
       }
     ]

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

@@ -1235,7 +1235,7 @@ export struct LocalMusic {
         { value: "新建歌单", fontColor:  $r('app.color.text_color') },
         { value: "手动导入", fontColor:  $r('app.color.text_color') },
         { value: "自动导入", fontColor:  $r('app.color.text_color') },
-
+        { value: "全选导入", fontColor:  $r('app.color.text_color') },
       ],
       maskColor: Color.Transparent,
       backgroundColor: $r('app.color.bg_card'),
@@ -1256,12 +1256,41 @@ export struct LocalMusic {
           case 2:
             this.showTips()
             break;
-
+          case 3:
+            this.goSelectMusic()
+            break;
         }
       }
     })
   }
 
+  //拉起音频
+  goSelectMusic(){
+
+    try {
+      let documentSelectOptions = new picker.DocumentSelectOptions();
+      documentSelectOptions.authMode = true
+      documentSelectOptions.multiAuthMode = true
+      documentSelectOptions.mergeMode = picker.MergeTypeMode.AUDIO;
+      let documentPicker = new picker.DocumentViewPicker(this.context);
+      documentPicker.select(documentSelectOptions).then((documentSelectResult: Array<string>) => {
+        if (documentSelectResult !== null && documentSelectResult !== undefined) {
+          this.saveVideoDatas(documentSelectResult)
+        }
+        console.info('DocumentViewPicker.select successfully, documentSelectResult uri: ' + JSON.stringify(documentSelectResult));
+      }).catch((err: BusinessError) => {
+        console.error(`DocumentViewPicker.select failed with err, code is: ${err.code}, message is: ${err.message}`);
+      });
+
+    } catch (error) {
+      let err: BusinessError = error as BusinessError;
+      console.error('AudioViewPicker failed with err: ' + JSON.stringify(err));
+    }
+
+
+
+  }
+
   async showTips() {
     DialogHelper.showTipsDialog({
       title: '使用提示:自动导入教程',