Parcourir la source

hicar针对宽扁平的处理

onecold il y a 1 an
Parent
commit
b7f18b1f07
2 fichiers modifiés avec 36 ajouts et 13 suppressions
  1. 6 6
      build-profile.json5
  2. 30 7
      entry/src/main/ets/view/LocalMusic.ets

+ 6 - 6
build-profile.json5

@@ -28,13 +28,13 @@
         "name": "default",
         "type": "HarmonyOS",
         "material": {
-          "storeFile": "D:/signapk/harmony/qimeng.p12",
-          "storePassword": "00000018A3D3FBBEB5EA0BA9438C36B708624CDB49110D2462C473D9A4111F5E82195A1777A4F4B6",
-          "keyAlias": "qimeng",
-          "keyPassword": "00000018A4DC1320416DBDB398C49D093BE522D91611B80161AB8D84BE287239496457749A32A922",
+          "certpath": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.cer",
+          "keyAlias": "debugKey",
+          "keyPassword": "0000001AB566250EBD7C67D2C8924C31CD3DFD677F81C557634D6A43B297C0A495387873160D9D53B05E",
+          "profile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p7b",
           "signAlg": "SHA256withECDSA",
-          "profile": "D:/signapk/harmony/qimeng/天天静听Release.p7b",
-          "certpath": "D:/signapk/harmony/qimeng.cer"
+          "storeFile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p12",
+          "storePassword": "0000001AFC825305444178D488204AA8C04191C31A741521056131690BAFC0531CDA7D19F1D5E1E8031B"
         }
       }
     ]

+ 30 - 7
entry/src/main/ets/view/LocalMusic.ets

@@ -4052,7 +4052,7 @@ export struct LocalMusic {
     // .divider({ strokeWidth: 1, color: this.isDarkMode? '#333333':'#ffe9f0f0' })
     .margin({
       bottom: this.isCoverOpacity() ? (this.isShowCoverHeader() ? 25 : 80)
-        : (this.isShowCoverHeader() ? 85 : 175)
+        : (this.isShowCoverHeader() ? 85 : this.isHiCarSmall()?140:175)
     })
     .cachedCount(6)
     .borderRadius(20)
@@ -5751,16 +5751,38 @@ export struct LocalMusic {
     return false
   }
 
+  //是不是1920x720的hicar的屏幕分辨率
+  isHiCarKuanBianPing(){
+    const hiCarAspectRatios: HiCarAspectRatio[] = [
+      { ratio: 1920 / 720, name: "1920x720" },
+    ];
+    const currentRatio: number = this.windowWidth / this.windowHeight;
+    const RATIO_TOLERANCE: number = 0.18; // 宽高比容差
+    LogUtil.info('twocold currentRatio = ' + currentRatio)
+
+    for (const hiCarRatio of hiCarAspectRatios) {
+      LogUtil.info('twocold hiCarRatio= ' + hiCarRatio.ratio)
+      LogUtil.info('twocold Math.abs(currentRatio - hiCarRatio.ratio)= ' + Math.abs(currentRatio - hiCarRatio.ratio))
+      if (Math.abs(currentRatio - hiCarRatio.ratio) <= RATIO_TOLERANCE) {
+        // LogUtil.info(`HiCar detected: ${hiCarRatio.name}, actual: ${this.windowWidth}x${this.windowHeight}`);
+        return true&&this.isHiCarStatus;
+      }
+    }
+
+    return false;
+  }
+
+
   //是不是hicar的屏幕分辨率
   isHiCarSmall() {
 
     if(this.windowWidth>1800&&this.windowHeight>=1200)//大屏幕可以Grid
       return false
 
-
     const hiCarAspectRatios: HiCarAspectRatio[] = [
       { ratio: 800 / 480, name: "800x480" },
       { ratio: 1280 / 720, name: "1280x720" },
+      { ratio: 1920 / 720, name: "1920x720" },
     ];
     const currentRatio: number = this.windowWidth / this.windowHeight;
     const RATIO_TOLERANCE: number = 0.18; // 宽高比容差
@@ -5787,6 +5809,7 @@ export struct LocalMusic {
       { ratio: 968 / 1280, name: "968x1280" },
       { ratio: 1200 / 1200, name: "1200x1200" },
       { ratio: 1280 / 720, name: "1280x720" },
+      { ratio: 1920 / 720, name: "1920x720" },
       { ratio: 1920 / 1080, name: "1920x1080" }
     ];
     const currentRatio: number = this.windowWidth / this.windowHeight;
@@ -6699,7 +6722,7 @@ export struct LocalMusic {
         })
           .width("100%")
           .layoutWeight(1)
-          .margin({ left: this.currentLyricAlignMode === 0 ? 0 : 50, top: 2, bottom: this.isPhoneLan() ? 40 : 10 })
+          .margin({ left: this.currentLyricAlignMode === 0 ? 0 : 50, top: 2, bottom: this.isPhoneLan()||this.isHiCarKuanBianPing() ? 40 : 10 })
 
 
         if (this.isPhoneLan()) {
@@ -6894,7 +6917,7 @@ export struct LocalMusic {
         curve: 'ease-in-out' // 可选动画曲线
       })
       .backgroundColor(Color.Transparent)
-      .margin({ left: 10, right: 10 })
+      .margin({ left: 20, right: 10 })
       .clickEffect({ level: ClickEffectLevel.LIGHT, scale: 0.5 })
       .onClick(async () => {
         this.setLoopMode()
@@ -6969,7 +6992,7 @@ export struct LocalMusic {
         curve: 'ease-in-out' // 可选动画曲线
       })
       .backgroundColor(Color.Transparent)
-      .margin({ right: 10, left: 20 })
+      .margin({ right: 20, left: 10 })
       .clickEffect({ level: ClickEffectLevel.LIGHT, scale: 0.5 })
       .onClick(() => {
         this.isShowSheetView = !this.isShowSheetView;
@@ -6986,7 +7009,7 @@ export struct LocalMusic {
     }
     //x5的竖屏模式需要99%
     .width(this.isPhonePortrait() ? '93.4%'
-      : this.currentHeightBreakpoint == 1 && this.currentWidthBreakpoint == 2 ? '99%' : '85%')
+      : this.currentHeightBreakpoint == 1 && this.currentWidthBreakpoint == 2 ? '99%' : '82%')
     .height(this.isPhoneLan() ? 25 : 33)
     // .visibility(this.isPhoneLan()&&this.isAutoHide?Visibility.None:Visibility.Visible)
     .animation({
@@ -7083,7 +7106,7 @@ export struct LocalMusic {
             this.musicNameInfo(false)
           } else {
             Image(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover)
-              .height(this.isHiCarSmall()?220:(this.isCoverOpacity() ? 250 : this.isCoverRectangle ? 320 : 162))
+              .height(this.isHiCarSmall()?(this.isHiCarKuanBianPing()?140:220):(this.isCoverOpacity() ? 250 : this.isCoverRectangle ? 320 : 162))
               .objectFit(this.isCoverRectangle ? ImageFit.Contain : ImageFit.Auto)
               .alt(this.imageLabel)
               .margin({ right: 20, left: 20 })