浏览代码

优化一些UI

onecold 10 月之前
父节点
当前提交
c086057e9a

+ 2 - 2
AppScope/app.json5

@@ -2,8 +2,8 @@
   "app": {
     "bundleName": "com.xgplayer.ttmusic.hm",
     "vendor": "example",
-    "versionCode": 20251009,
-    "versionName": "1.6.4",
+    "versionCode": 20251016,
+    "versionName": "1.6.5",
     "icon": "$media:app_icon",
     "label": "$string:app_name",
     "multiAppMode": {

+ 7 - 7
build-profile.json5

@@ -5,7 +5,7 @@
         "name": "default",
         "signingConfig": "default",
         "targetSdkVersion": "5.0.5(17)",
-        "compatibleSdkVersion": "5.0.0(12)",
+        "compatibleSdkVersion": "5.0.5(17)",
         "runtimeOS": "HarmonyOS",
         "buildOption": {
           "strictMode": {
@@ -28,13 +28,13 @@
         "name": "default",
         "type": "HarmonyOS",
         "material": {
-          "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",
+          "storeFile": "D:/signapk/harmony/qimeng.p12",
+          "storePassword": "00000018259B99D7ED11C858DBF23FA5648A8A3CF72347E1089C32ABFC96EE8DA49B067F943EB2C2",
+          "keyAlias": "qimeng",
+          "keyPassword": "00000018CC7C6D1CED6673D19B405C7078FF7A97E76252C3F7CFC06AC8AF3B3C9CA870D30605BE86",
           "signAlg": "SHA256withECDSA",
-          "storeFile": "C:\\Users\\xjy08\\.ohos\\config\\default_com.xgplayer.ttmusic.hm4_li00v0NJ2KHEZXa_MEhSBo4Q7SMa2KHpzKM8lnBZT1Y=.p12",
-          "storePassword": "0000001AFC825305444178D488204AA8C04191C31A741521056131690BAFC0531CDA7D19F1D5E1E8031B"
+          "profile": "D:/signapk/harmony/qimeng/天天静听调试Debug.p7b",
+          "certpath": "D:/signapk/harmony/qimeng/onecold.cer"
         }
       }
     ]

+ 5 - 5
entry/src/main/ets/pages/NewIndex.ets

@@ -509,11 +509,11 @@ struct NewIndex {
 
     Column() {
       this.userInfoView()
-      // Column({ space: 20 }) {
-      //   SegmentButton({ options: this.tabOptions, selectedIndexes: $tabSelectedIndexes })
-      // }
-      // .padding({ bottom:10 })
-      // .width('80%')
+      Column({ space: 20 }) {
+        SegmentButton({ options: this.tabOptions, selectedIndexes: $tabSelectedIndexes })
+      }
+      .padding({ bottom:10 })
+      .width('80%')
     }
 
   }

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

@@ -239,7 +239,7 @@ export struct SettingPage {
     this.bgBrightness = PreferencesUtil.getNumberSync(SettingPage.BG_BRIGHTNESS, 0)
     this.isStartAutoPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_START_AUTO_PLAY, false)
     this.isMemoryLastPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_LAST_PLAY, false)
-    this.twoFingerType = PreferencesUtil.getNumberSync(SettingPage.TWO_FINGER_TYPE, 3)
+    this.twoFingerType = PreferencesUtil.getNumberSync(SettingPage.TWO_FINGER_TYPE, 2)
     this.isCircleBtn = PreferencesUtil.getBooleanSync(SettingPage.IS_CIRCLE_BTN, true)
     this.isCoverTop = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP, true)
     this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)

+ 42 - 20
entry/src/main/ets/view/LocalMusic.ets

@@ -140,7 +140,7 @@ interface GeneratedObjectLiteralInterface_1 {
 }
 
 const ITEM_HEIGHT_SMALL: number = 48; // 列表项小高度
-const ITEM_HEIGHT: number = 58; // 列表项中高度
+const ITEM_HEIGHT: number = 65; // 列表项中高度
 const ITEM_HEIGHT_BIG: number = 78; // 列表项大高度
 
 //功能强大的音乐播放器
@@ -719,7 +719,7 @@ export struct LocalMusic {
     this.isMemoryLastPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_LAST_PLAY, false)
     this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
     this.isShowAllBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_ALLBAR, true)
-    this.twoFingerType = PreferencesUtil.getNumberSync(SettingPage.TWO_FINGER_TYPE, 3)
+    this.twoFingerType = PreferencesUtil.getNumberSync(SettingPage.TWO_FINGER_TYPE, 2)
     this.isCoverTop = PreferencesUtil.getBooleanSync(SettingPage.IS_COVER_TOP, true)
     this.isCircleBtn = PreferencesUtil.getBooleanSync(SettingPage.IS_CIRCLE_BTN, true)
     this.isShowPlayPageBack = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_PLAYPAGE_BACK, true)
@@ -2699,8 +2699,8 @@ export struct LocalMusic {
       Row() {
         Image(this.modeType !== 0 && StrUtil.isNotEmpty(item.pixelMapPath) ? item.pixelMapPath :
         $r('app.media.music_group'))
-          .height(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 35 : 30)
-          .width(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 35 : 30)
+          .height(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 50 : 40)
+          .width(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 50 : 40)
           .fillColor(this.themeColor)// .fontSize(33)
           .alt($r('app.media.music_group'))
           .borderRadius('100%')
@@ -2792,8 +2792,8 @@ export struct LocalMusic {
 
           Image(StrUtil.isEmpty(item.pixelMapPath) ? $r('app.media.music_red') : item.pixelMapPath)
             .fillColor(this.themeColor)
-            .height(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 35 : 30)
-            .width(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 35 : 30)
+            .height(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 50 : 40)
+            .width(this.twoFingerType == 3 ? 55 : this.twoFingerType == 2 ? 50 : 40)
             .alt($r('app.media.music_red'))
             .borderRadius('100%')
             .clip(true)
@@ -2891,14 +2891,14 @@ export struct LocalMusic {
               .padding({ top: 8 })
               Text(StrUtil.isEmpty(item.artist) ? item.duration
                 :this.twoFingerType==2? item.artist +'  ' + item.duration
-                : item.artist + '  ' + item?.album)
+                : item.artist + '  ' + item?.duration)
                 .fontSize(this.twoFingerType == 1 ? 11 : this.twoFingerType == 2 ? 12 : 14)
                 .padding({ top: 8 ,right:25})
                 .visibility(this.isShowFileName?Visibility.None:Visibility.Visible)
                 .maxLines(1)
                 .textOverflow({ overflow: this.isLongNameRoLL?TextOverflow.MARQUEE:TextOverflow.Ellipsis })//超长滚动
                 .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
-                $r('app.color.text_color'))
+                Color.Gray)
                 .margin({ left: this.twoFingerType == 3 ? 6 : 8 })
               Blank()
               Text(this.isShowFileName?item.duration:item.size)
@@ -2908,10 +2908,9 @@ export struct LocalMusic {
                 .visibility(this.isShowFileName?Visibility.Visible:StrUtil.isEmpty(item.artist)
                   ? Visibility.Visible : Visibility.None)
                 .fontColor(this.currentSong?.filePath === item.filePath ? this.themeColor :
-                $r('app.color.text_color'))
+                Color.Gray)
                 .margin({ left: 10 })
             }
-            .visibility(this.twoFingerType==1?Visibility.None:Visibility.Visible)
             .gesture(LongPressGesture()
               .onAction(async () => {
                 //如果是专辑和艺术家的首页,不能长按
@@ -2934,6 +2933,7 @@ export struct LocalMusic {
           }
           .height('100%')
           .width('100%')
+          .margin({ right: 10 })
           .justifyContent(FlexAlign.Center)
           .alignItems(HorizontalAlign.Start)
 
@@ -4768,7 +4768,8 @@ export struct LocalMusic {
           .swipeAction((
             (this.isSwipe&&this.modeType == 0 || this.modeType == 1 || ((this.modeType == 3 || this.modeType == 2) && this.isCanBack))
               && item.type !== CommonConstants.TYPE_IS_CSJAD &&
-              !this.isHistory) ? { end: this.DeleteButton(item, index, item.filePath) } : {}) //左滑
+              !this.isHistory) ? { end: this.DeleteButton(item, index, item.filePath),
+            start:null,edgeEffect: SwipeEdgeEffect.None } : {}) //左滑
           .onClick(() => {
             if (this.isMultiSelect && item.type !== CommonConstants.TYPE_IS_DIR) {
               const isChecked = this.selectedFiles.some(x => x.filePath == item.filePath);
@@ -4885,6 +4886,7 @@ export struct LocalMusic {
         }, (item: VideoItem) => item.filePath)
       }
     }
+    .scrollBar(BarState.Off)
     .scale({ x: this.scaleValue, y: this.scaleValue, z: 1 })
     .gesture(PinchGesture({ fingers: 2 })
       .onActionEnd((event: GestureEvent) => {
@@ -4901,7 +4903,7 @@ export struct LocalMusic {
       this.isHiCar()&&(this.windowWidth>1800&&this.windowHeight>=1200)?{bottom:this.bottomBarHeight+98}:
       {
       bottom: this.isCoverOpacity() ? (this.isShowCoverHeader() ? this.topBarHeight+25 : this.topBarHeight+80)
-        : (this.isShowCoverHeader() ? this.topBarHeight+35 : this.isHiCarSmall()?this.topBarHeight+90:this.topBarHeight+125)
+        : (this.isShowCoverHeader() ? this.topBarHeight+35 : this.isHiCarSmall()?this.topBarHeight+90:this.topBarHeight+165)
     })
     .cachedCount(6)
     .reuseId('list_item')
@@ -5212,6 +5214,8 @@ export struct LocalMusic {
         }else{
           if (this.isGridMusic) {
             this.scroller.scrollEdge(Edge.Top)
+          }else{
+            this.listScroller.scrollEdge(Edge.Top)
           }
         }
 
@@ -5267,6 +5271,8 @@ export struct LocalMusic {
         }else{
           if (this.isGridMusic) {
             this.scroller.scrollEdge(Edge.Top)
+          }else{
+            this.listScroller.scrollEdge(Edge.Top)
           }
         }
         break;
@@ -5622,6 +5628,7 @@ export struct LocalMusic {
       setTimeout(() => {
         this.getUIContext()?.animateTo({ duration: 555 }, () => {
           this.playListScroller.scrollToIndex(this.curIndex,true, ScrollAlign.CENTER)
+          // this.playListScroller.scrollToIndex(1000,true, ScrollAlign.CENTER)
         })
       }, 123)
     }catch (error) {
@@ -7295,8 +7302,7 @@ export struct LocalMusic {
               }
               .padding({ top: 8 })
               Text(StrUtil.isEmpty(item.artist) ? item.duration :
-                this.sonTwoFingerType<=2?"  "+item?.duration:
-                item.artist + '  ' + item?.album)
+                item.artist + '  ' + item?.duration)
                 .fontSize(this.sonTwoFingerType == 1 ? 11 : this.sonTwoFingerType == 2 ? 12 : 14)
                 .padding({ top: 8 })
                 .maxLines(1)
@@ -8396,12 +8402,17 @@ export struct LocalMusic {
       Stack() {
 
         Image(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover)
-          .height(55)
-          .width(55)
+          .height(62)
+          .width(62)
           .alt(this.imageLabel)
           .borderRadius(8)
           .clickEffect({ level: ClickEffectLevel.HEAVY })
           .margin({ left: this.currentLyricAlignMode === 0 ? 28 : -15 })
+          .shadow({
+            radius: 22,
+            type: ShadowType.BLUR,
+            color: 'on_primary'
+          })
 
       }
       .width('18%')
@@ -9077,8 +9088,9 @@ export struct LocalMusic {
             curve: Curve.Linear
           })
           .shadow({
-            radius: 30,
-            color: this.randomColor
+            radius: 22,
+            type: ShadowType.BLUR,
+            color: 'on_primary'
           })
 
         Column() {
@@ -9103,6 +9115,11 @@ export struct LocalMusic {
                 z: 1,
                 angle: this.rotateAngle
               })
+              .shadow({
+                radius: 22,
+                type: ShadowType.BLUR,
+                color: 'on_primary'
+              })
               .onClick(() => {
                 this.getImageColor()
               })
@@ -9123,6 +9140,11 @@ export struct LocalMusic {
               .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.8 })
               .align(Alignment.Center)//
               .clip(true)
+              .shadow({
+                radius: 22,
+                type: ShadowType.BLUR,
+                color: 'on_primary'
+              })
               .rotate({
                 x: 0,
                 y: 0,
@@ -13036,7 +13058,7 @@ function customPopupBuilder(dataBu: BubbleBean) {
       })
     })
   }
-
+  .scrollBar(BarState.Off)
   .width(120)
   .divider({
     strokeWidth: 1,
@@ -13117,7 +13139,7 @@ function cutPopupBuilder(dataBu: BubbleBean) {
         })
       })
     }
-
+    .scrollBar(BarState.Off)
     .width(150)
     .divider({
       strokeWidth: 1,

+ 7 - 2
entry/src/main/ets/view/RotatingCover.ets

@@ -52,11 +52,16 @@ export struct RotatingCover {
   build() {
     Column() {
       Image(this.songLabel === undefined ||StrUtil.isEmpty(this.songLabel)? $r('app.media.music_red') : this.songLabel)
-        .height(38)
-        .width(38)
+        .height(48)
+        .width(48)
         .alt( $r('app.media.music_red'))
         .fillColor(this.themeColor)
         .borderRadius('100%')
+        .shadow({
+          radius: 10,
+          type: ShadowType.BLUR,
+          color: 'on_primary'
+        })
         .clip(true)
         .margin({ right: 12 })
         .rotate({

+ 19 - 1
lib/src/main/ets/view/LyricView2.ets

@@ -312,7 +312,7 @@ export struct LyricView2 {
                             index == this.currentIndex ? this.textHighlightColor : this.textColor : this.textColor)
                         .fontWeight(this.currentMediaPosition >= word.startTime && this.isHighlightBold ?
                             index == this.currentIndex? FontWeight.Bold : this.textWeight: this.textWeight)
-                        .margin({ right: 4 })
+                        .margin(isEnglish(word.word) ?{ right:4 }:{})
                         .opacity(this.calculateOpacityFactor(index, this.currentIndex))
                         .blur(this.calculateBlurFactor(index, this.currentIndex))
                         .visibility(this.isSingleLine?
@@ -510,4 +510,22 @@ export struct LyricView2 {
             this.animateToIndex(index)
         }
     }
+}
+
+function  isEnglish(text: string, mode: string = 'strict', threshold: number = 0.9): boolean {
+    if (!text || typeof text !== 'string') return false;
+
+    switch (mode) {
+        case 'basic':
+            return /^[a-zA-Z\s.,!?'"-]+$/.test(text);
+        case 'percentage':
+            return checkByPercentage(text,  threshold);
+        default: // strict
+            return /^[\u0000-\u007F]+$/.test(text.trim());
+    }
+}
+
+function checkByPercentage(text: string, threshold: number): boolean {
+    const validChars = text.match(/[a-zA-Z\s.,!?'"-]/g)  || [];
+    return (validChars.length  / text.length)  >= threshold;
 }