Browse Source

优化一些界面效果

onecold 7 months ago
parent
commit
8c7d7102b0

+ 2 - 2
AppScope/app.json5

@@ -2,8 +2,8 @@
   "app": {
     "bundleName": "com.xgplayer.ttmusic.hm",
     "vendor": "example",
-    "versionCode": 20251205,
-    "versionName": "1.7.6",
+    "versionCode": 20251224,
+    "versionName": "1.8.0",
     "icon": "$media:app_icon",
     "label": "$string:app_name",
     "multiAppMode": {

+ 0 - 2
entry/src/main/ets/entryability/EntryAbility.ets

@@ -24,7 +24,6 @@ import { systemShare } from '@kit.ShareKit';
 import Logger from '../common/util/Logger';
 import statusBarManager from '@hms.pcService.statusBarManager';
 import StatusBarViewExtensionAbility from '@hms.pcService.StatusBarViewExtensionAbility';
-import { SpiderMan } from '@simplepeng/spider-man';
 import { smartMobilityCommon } from '@kit.CarKit';
 import { url } from '@kit.ArkTS';
 import { display } from '@kit.ArkUI';
@@ -238,7 +237,6 @@ export default class EntryAbility extends UIAbility {
     onWindowStageCreate(windowStage: window.WindowStage) {
         // Main window is created, set main page for this ability
         hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
-        SpiderMan.init();
         AppUtil.init(this.context);
         //1.获取应用主窗口。
         let windowClass: window.Window | null = null;

+ 3 - 35
entry/src/main/ets/view/LocalMusic.ets

@@ -6618,8 +6618,6 @@ export struct LocalMusic {
               || item.type === CommonConstants.TYPE_IS_ARTIST || item.type === CommonConstants.TYPE_IS_ALBUM) {
               this.DirItem(item, index)
 
-            } else if (item.type === CommonConstants.TYPE_IS_CSJAD) { //如果是穿山甲广告
-
             } else {
               this.MusicItem(item, index)
 
@@ -6641,7 +6639,6 @@ export struct LocalMusic {
           .animation({ curve: Curve.Sharp, duration: 300 })
 
         }
-        // .transition(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }))
         .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 0.9, y: 0.9 })
           .animation({ duration: 500 }),
           TransitionEffect.scale({ x: 0, y: 0 })))
@@ -6717,23 +6714,7 @@ export struct LocalMusic {
                     this.itemMove(indexA, indexA - 1);
                   });
                 }
-                let curListOffset = this.listScroller.currentOffset()
-                // 获取手指信息
-                let fingerInfo = event.fingerList[0]
-                let clickPercentY =
-                  (fingerInfo.globalY - Number(this.listArea.globalPosition.y)) / Number(this.listArea.height)
-                if (clickPercentY > 0.8 && !this.listScroller.isAtEnd()) {
-                  let scrollVelocity = clickPercentY > 0.9 ? 4 : 2
-                  if (this.listMaxScrollOffsetY - curListOffset.yOffset > scrollVelocity + 5) {
-                    this.listScroller.scrollTo({ xOffset: 0, yOffset: curListOffset.yOffset += scrollVelocity })
 
-                  }
-                } else if (clickPercentY < 0.2 && curListOffset.yOffset >= 0) {
-                  let scrollVelocity = clickPercentY < 0.1 ? 4 : 2
-                  if (curListOffset.yOffset > scrollVelocity + 5) {
-                    this.listScroller.scrollTo({ xOffset: 0, yOffset: curListOffset.yOffset -= scrollVelocity })
-                  }
-                }
 
               })
               .onActionEnd((event: GestureEvent) => {
@@ -6848,19 +6829,6 @@ export struct LocalMusic {
       }
 
 
-      if (this.currentWidthBreakpoint !== WidthBreakpoint.WIDTH_SM ||
-        (this.currentHeightBreakpoint !== HeightBreakpoint.HEIGHT_MD &&
-          this.currentHeightBreakpoint !== HeightBreakpoint.HEIGHT_SM)) {
-        if (this.isScrollHide) {
-          this.setBarHeightHide2(offset)
-
-        } else {
-          this.setBarHeightNormal()
-        }
-
-      } else {
-        this.setBarHeightHide(offset)
-      }
 
       return { offsetRemain: offset };
     })
@@ -10323,14 +10291,14 @@ export struct LocalMusic {
             .fontSize(16)
             .maxLines(1)
             .fontWeight(FontWeight.Bolder)
-            .fontColor(this.currentLyricColor)
+            .fontColor(Color.White)
             .margin({ left: this.currentLyricAlignMode === 0 ? 24 : 0 })
           Row() {
             Text(this.currentSong?.artist !== undefined ? this.currentSong?.artist : '')
               .fontSize(13)
-              .fontWeight(FontWeight.Bold)
+              .fontWeight(FontWeight.Bolder)
               .padding({ top: 8 })
-              .fontColor(this.currentLyricColor)
+              .fontColor(Color.White)
               .margin({ left: this.currentLyricAlignMode === 0 ? 24 : 0 })
             Blank()
 

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

@@ -170,16 +170,7 @@ export struct LyricView2 {
     }
 
     @State blurDegree: number = 3
-    private calculateBlurFactor(index: number, currentIndex: number): number {
-        const distance = Math.abs(index - currentIndex);
-        return Math.min(this.blurDegree, distance * 1.5);// Adjust the blur factor based on distance
-    }
 
-    private calculateOpacityFactor(index: number, currentIndex: number): number {
-        const distance = Math.abs(index - currentIndex);
-        let maxOp =  Math.max(0.3,1-this.blurDegree*0.2)
-        return Math.max(maxOp, 1 - distance * 0.08); // 透明度随着距离增加而减小
-    }
 
 
     // 优化建议代码示例:增加滚动节流
@@ -215,9 +206,7 @@ export struct LyricView2 {
                 .padding(8)
                 .transition(TransitionEffect.asymmetric(TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }),
                     TransitionEffect.scale({ x: 0, y: 0 })  ))
-                // .transition(TransitionEffect.asymmetric(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 500,curve: Curve.Ease, delay: 100*index  }),
-                //     TransitionEffect.scale({ x: 0, y: 0 })  ))
-                .border({ radius: 4 })
+                .border({ radius: 12 })
                 .backgroundColor(this.seekUIStyle == 'listItem' && index == this.seekIndex && item.text.length > 0
                     && this.enableSeek && this.isUserTouching ? '#80a9a9a9' : '#00000000')
                 .onClick(() => {
@@ -235,8 +224,8 @@ export struct LyricView2 {
         .width('100%')
         .height('100%')
         .scrollBar(BarState.Off)
+        .fadingEdge(true,{fadingEdgeLength:LengthMetrics.percent(20)})
         .cachedCount(this.cacheSize)
-        .fadingEdge(true,{fadingEdgeLength:LengthMetrics.percent(40)})
         .transition(TransitionEffect.asymmetric(
              this.isSingleLine? TransitionEffect.scale({ x: 1.2, y: 1.2 }).animation({ duration: 500 }):
              TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 500 }),
@@ -286,8 +275,6 @@ export struct LyricView2 {
         Column(){
             Text(item.text)
                 .fontSize(this.textSize)
-                .opacity(this.calculateOpacityFactor(index, this.currentIndex))
-                .blur(this.calculateBlurFactor(index, this.currentIndex))
                 .textAlign(this.alignMode == 'center' ? TextAlign.Center : TextAlign.Start)
                 .scale({
                     x: index == this.currentIndex ? this.controller.getHighlightScale() : 1,
@@ -311,8 +298,6 @@ export struct LyricView2 {
                             index == this.currentIndex ? this.textHighlightColor : this.textColor : this.textColor)
                         .fontWeight(index == this.currentIndex && this.isHighlightBold ? FontWeight.Bold : this.textWeight)
                         .margin({ top: 4 })
-                        .opacity(this.calculateOpacityFactor(index, this.currentIndex))
-                        .blur(this.calculateBlurFactor(index, this.currentIndex))
                 }
                 .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
                 .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '85%')
@@ -335,8 +320,6 @@ export struct LyricView2 {
                         .fontWeight(this.currentMediaPosition >= word.startTime && this.isHighlightBold ?
                             index == this.currentIndex? FontWeight.Bold : this.textWeight: this.textWeight)
                         .margin(isEnglish(word.word) ?{ right:4 }:{})
-                        .opacity(this.calculateOpacityFactor(index, this.currentIndex))
-                        .blur(this.calculateBlurFactor(index, this.currentIndex))
                         .visibility(this.isSingleLine?
                             (index == this.currentIndex ?Visibility.Visible:Visibility.None)
                             :Visibility.Visible)
@@ -362,8 +345,6 @@ export struct LyricView2 {
                             index == this.currentIndex ? this.textHighlightColor : this.textColor : this.textColor)
                         .fontWeight(index == this.currentIndex && this.isHighlightBold ? FontWeight.Bold : this.textWeight)
                         .margin({ top: 4 })
-                        .opacity(this.calculateOpacityFactor(index, this.currentIndex))
-                        .blur(this.calculateBlurFactor(index, this.currentIndex))
                 }
                 .justifyContent(this.alignMode === 'center' ? FlexAlign.Center : FlexAlign.Start)
                 .width(this.alignMode == 'center' ? '100%' :index == this.currentIndex ?'95%': '85%')