Pārlūkot izejas kodu

首次进入提示 双指可以缩放

onecold 1 gadu atpakaļ
vecāks
revīzija
499cbb2a2b
1 mainītis faili ar 36 papildinājumiem un 10 dzēšanām
  1. 36 10
      entry/src/main/ets/view/LocalMusic.ets

+ 36 - 10
entry/src/main/ets/view/LocalMusic.ets

@@ -137,6 +137,7 @@ const ITEM_HEIGHT_BIG: number = 78; // 列表项大高度
 @Preview
 @Component
 export struct LocalMusic {
+  @State tipPopup:boolean = false
   @Consume mType: number;
   @StorageProp('themeColor') themeColor: string =
     PreferencesUtil.getStringSync('THEME_COLOR', CommonConstants.DEFAULT_THEME_COLOR);
@@ -448,6 +449,10 @@ export struct LocalMusic {
 
   // 组件生命周期
   aboutToAppear() {
+    if(PreferencesUtil.getBooleanSync('isFirstTiped',true)){
+      this.tipPopup = !this.tipPopup
+      PreferencesUtil.putSync('isFirstTiped',false)
+    }
     this.initSetting()
     this.UNKONWN = Utility.resourceToString(this.context, $r('app.string.unknown'));
     this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
@@ -537,7 +542,7 @@ export struct LocalMusic {
     this.themeColor = themeColor;
     this.doChangeSetting()
     this.windowClass.on('windowSizeChange', (size) => {
-      // LogUtil.info('onecold  windowSizeChange')
+      LogUtil.info('onecold  windowSizeChange')
       this.doChangeBarHeight()
       let viewWidth = px2vp(size.width);
       let viewHeight = px2vp(size.height);
@@ -562,6 +567,7 @@ export struct LocalMusic {
 
   startAutoHide() {
     if(PreferencesUtil.getBooleanSync(SettingPage.IS_AUTO_HIDE_PROGRESS,false)){
+      console.info('onecold  startAutoHide')
       this.is_auto_hide_progress = false
       setTimeout(() => {
         this.is_auto_hide_progress = true
@@ -3182,6 +3188,17 @@ export struct LocalMusic {
           })
           .fillColor(this.themeColor)
           .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.6 })
+          .bindPopup($$this.tipPopup, {
+            builder: this.popupBuilder,
+            placement: Placement.Bottom,
+            maskColor: 0x33000000,
+            enableArrow: true,
+            onStateChange: (e) => {
+              if (!e.isVisible) {
+                this.tipPopup = false;
+              }
+            }
+          })
           .onClick(() => {
             this.isGridMusic = !this.isGridMusic
           })
@@ -3200,6 +3217,21 @@ export struct LocalMusic {
 
   }
 
+  // 第二步:popup构造器定义弹框内容
+  @Builder popupBuilder() {
+    Column({ space: 2 }) {
+      Text('友情提示:双指缩放可以放大缩小列表')
+        .fontSize(12)
+        .fontWeight(FontWeight.Regular)
+        .fontColor($r('app.color.text_color'))
+    }
+    .justifyContent(FlexAlign.SpaceAround)
+    .width(220)
+    .height(55)
+    .padding(15)
+  }
+
+
   //搜索功能的实现
   @State searchText: string = ''; // 用户输入内容
   @State filteredList: Array<VideoItem> = []; // 过滤后的结果
@@ -5893,17 +5925,11 @@ export struct LocalMusic {
 
     if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
       && this.currentHeightBreakpoint == HeightBreakpoint.HEIGHT_SM
-      && this.currentWidthBreakpoint == WidthBreakpoint.WIDTH_MD) { //如果是手机横屏,返回true
+      && this.currentWidthBreakpoint == WidthBreakpoint.WIDTH_MD&&this.isLandscape) { //如果是手机横屏,返回true
 
       return true
     }
 
-    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
-      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
-      if (DisplayUtil.getFoldStatus() === 0) {
-        return true
-      }
-    }
 
     return false
   }
@@ -6308,7 +6334,7 @@ export struct LocalMusic {
       .setEmptyHint("")
       .setAnimationDuration(1000)
     this.currentLyricAlignMode = PreferencesUtil.getNumberSync('LyricAlignMode', 1)
-    this.blurDegree = PreferencesUtil.getNumberSync('setBlurDegree', 0)
+    this.blurDegree = PreferencesUtil.getNumberSync('setBlurDegree', 3)
     this.setBlurDegree(this.blurDegree, false)
     this.setLyricAlignMode(this.currentLyricAlignMode, false)
     this.setLyricTextSize(PreferencesUtil.getNumberSync('LyricTextSize', 18), false)
@@ -6541,7 +6567,7 @@ export struct LocalMusic {
       .setEmptyHint("")
       .setAnimationDuration(1000)
     this.currentLyricAlignModePip = PreferencesUtil.getNumberSync('LyricAlignModePip', 0)
-    this.blurDegreePip = PreferencesUtil.getNumberSync('setBlurDegreePip', 2)
+    this.blurDegreePip = PreferencesUtil.getNumberSync('setBlurDegreePip', 3)
     this.setBlurDegree(this.blurDegreePip, true)
     this.setLyricAlignMode(this.currentLyricAlignModePip, true)
     this.setLyricTextSize(PreferencesUtil.getNumberSync('LyricTextSizePip', 18), true)