Przeglądaj źródła

调整播放页的收藏按钮

onecold 11 miesięcy temu
rodzic
commit
ff4140732a
1 zmienionych plików z 48 dodań i 34 usunięć
  1. 48 34
      entry/src/main/ets/view/LocalMusic.ets

+ 48 - 34
entry/src/main/ets/view/LocalMusic.ets

@@ -7543,22 +7543,31 @@ export struct LocalMusic {
         .margin({ right: 5 })
         .width(33)
 
-        Button({type:ButtonType.Circle,stateEffect:true}){
-          //添加或取消收藏
-          Image(Utility.getIsFav(this.favList,this.currentSong)?
-          $r('app.media.add_fac_light'):$r('app.media.add_fac'))
-            .width(24)
-            .clickEffect({level:ClickEffectLevel.MIDDLE})
-            .aspectRatio(CommonConstants.ASPECT_RATIO)
-            .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
-            .onClick(async () => {
-              if(this.currentSong){
-                this.doFav(this.currentSong)
-              }
-            })
+
+        if(this.isPhoneLan()){
+          this.fullButton()
+        }else{
+          Button({type:ButtonType.Circle,stateEffect:true}){
+            //添加或取消收藏
+            SymbolGlyph(Utility.getIsFav(this.favList,this.currentSong)?
+            $r('sys.symbol.heart_fill'):$r('sys.symbol.heart'))
+              .fontSize(23)
+              .fontColor([Color.White])
+              .alignSelf(ItemAlign.Center)
+              // .width(24)
+              .clickEffect({level:ClickEffectLevel.MIDDLE})
+              .aspectRatio(CommonConstants.ASPECT_RATIO)
+              .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
+              .onClick(async () => {
+                if(this.currentSong){
+                  this.doFav(this.currentSong)
+                }
+              })
+          }
+          .backgroundColor(Color.Transparent)
+          .width(24)
         }
-        .backgroundColor(Color.Transparent)
-        .width(24)
+
 
       }
       // .margin({ left: 5 })
@@ -7670,25 +7679,7 @@ export struct LocalMusic {
       })
 
 
-      Button({type:ButtonType.Circle,stateEffect:true}){
-        Column() {
-          Image($r('app.media.full_4'))
-            .width(25)
-            .aspectRatio(CommonConstants.ASPECT_RATIO)
-        }
-      }
-      .layoutWeight(1)
-      .backgroundColor(Color.Transparent)
-
-      .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
-      .onClick(async () => {
-        if (this.isLandscape) {
-          this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT);
-        } else {
-          this.setOrientation(window.Orientation.USER_ROTATION_LANDSCAPE);
-        }
-
-      })
+      this.fullButton()
 
 
       Button({type:ButtonType.Circle,stateEffect:true}){
@@ -7751,6 +7742,29 @@ export struct LocalMusic {
     })
   }
 
+  @Builder
+  fullButton(){
+    Button({type:ButtonType.Circle,stateEffect:true}){
+      Column() {
+        Image($r('app.media.full_4'))
+          .width(25)
+          .aspectRatio(CommonConstants.ASPECT_RATIO)
+      }
+    }
+    .layoutWeight(1)
+    .backgroundColor(Color.Transparent)
+
+    .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
+    .onClick(async () => {
+      if (this.isLandscape) {
+        this.setOrientation(window.Orientation.USER_ROTATION_PORTRAIT);
+      } else {
+        this.setOrientation(window.Orientation.USER_ROTATION_LANDSCAPE);
+      }
+
+    })
+  }
+
   //旧版本播放进度条
   @Builder
   playProgressView() {