Browse Source

设置页面可以设置默认瀑布流 网格 列表等模式

onecold 11 months ago
parent
commit
af8571ffc3

+ 1 - 0
entry/src/main/ets/common/constants/CommonConstants.ets

@@ -102,6 +102,7 @@ export class CommonConstants {
   static readonly PIP_LYRIC_BG = ["音乐封面", "自定义"]
 
   static readonly TWO_FINGER_TYPE = ["小", "中", "大"]
+  static readonly DEFAULT_LAYOUT = [ "瀑布流模式","列表模式","网格模式"]
 
 
   //德本的接口调用微信支付下单接口返回的支付交易会话ID,该值有效期为2小时。

+ 30 - 12
entry/src/main/ets/pages/SettingPage.ets

@@ -700,33 +700,51 @@ export struct SettingPage {
             // Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
             //   .visibility(Visibility.None)
             // 网格布局
+            // 网格布局
             Row() {
-              SymbolGlyph($r('sys.symbol.square_grid_2x2'))
+              SymbolGlyph($r('sys.symbol.more'))
                 .fontSize(20)
                 .fontColor([this.themeColor])
                 .alignSelf(ItemAlign.Center)
                 .margin({ left: 15 })
-              Text('卡片模式')
+              Text('布局模式')
                 .margin({ left: 8 })
                 .fontSize(15)
                 .fontColor(Color.Gray)
                 .fontWeight(480)
                 .layoutWeight(1)
-              Toggle({ type: ToggleType.Switch, isOn: this.isGridMusic })
-                .selectedColor(this.themeColor)
-                .switchPointColor(Color.White)
+              Select([
+                { value: CommonConstants.DEFAULT_LAYOUT[0] },
+                { value: CommonConstants.DEFAULT_LAYOUT[1] },
+                { value: CommonConstants.DEFAULT_LAYOUT[2] }])
+                .font({ size: 15, weight: FontWeight.Medium })
+                .fontColor(Color.Gray)
                 .margin({ right: 18 })
-                .clickEffect({level:ClickEffectLevel.LIGHT, scale: 0.5})
-                .onChange((checked: boolean) => {
-                  this.isGridMusic = checked;
-                  PreferencesUtil.put(SettingPage.IS_GRID_MUSIC, this.isGridMusic)
+                .selected(this.twoFingerType==4?0:
+                  this.isGridMusic?2:1)
+                .value(CommonConstants.DEFAULT_LAYOUT[this.twoFingerType==4?0:
+                  this.isGridMusic?2:1])
+                .onSelect(async (_index: number, text?: string | undefined) => {
+                  if(_index == 0){
+                    PreferencesUtil.put(SettingPage.TWO_FINGER_TYPE,4)
+                  }else{
+                    if(this.twoFingerType!=4){
+                      PreferencesUtil.put(SettingPage.TWO_FINGER_TYPE,this.twoFingerType)
+                    }else{
+                      PreferencesUtil.put(SettingPage.TWO_FINGER_TYPE,3)
+                    }
+                    if(_index == 1){
+                      PreferencesUtil.put(SettingPage.IS_GRID_MUSIC,false)
+                    }else{
+                      PreferencesUtil.put(SettingPage.IS_GRID_MUSIC,true)
+                    }
+                  }
                   this.sendChangeEvent()
                 })
-                .width(50)
-                .height(30);
+
             }
             .height(55)
-            .clickEffect({ level: ClickEffectLevel.HEAVY })
+            .clickEffect({level:ClickEffectLevel.HEAVY})
             Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
             // 封面方形
             Row() {

+ 1 - 1
entry/src/main/ets/view/LocalMusic.ets

@@ -3486,7 +3486,7 @@ export struct LocalMusic {
                 }
                 this.waterFlowSnapshot = pixmap;
 
-                if ((this.oldColumn === 1 ) || (this.oldColumn === 4 && event.scale < 1)) {
+                if ((this.oldColumn === 1 )  && event.scale > 1|| (this.oldColumn === 4 && event.scale < 1)) {
                   console.info("onecold onActionStart oldColumn:" + this.oldColumn)
                   if (this.oldColumn ===4) {
                     this.twoFingerType =3