Parcourir la source

修复横屏下息屏 没有避让状态栏安全区域的bug

onecold il y a 1 an
Parent
commit
e6f969fb79

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

@@ -26,7 +26,7 @@ export class CommonConstants {
 
   static readonly ICP_URL: string = 'https://beian.miit.gov.cn/';
 
-  static readonly CONTACT_MAIL: string = 'app@meitu.live';
+  static readonly CONTACT_MAIL: string = 'setup1115@foxmail.com';
 
   static readonly NEW_DUTY: string = "http://xgplayer.com/yszc/ttmusic/duty.html";
   //huawei的隐私政策

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

@@ -20,6 +20,9 @@ import { Utility } from '../common/util/Utility';
 import { WXApi, WXEventHandler } from '../common/util/WXApiWrap';
 
 import { systemShare } from '@kit.ShareKit';
+import Logger from '../common/util/Logger';
+import statusBarManager from '@hms.pcService.statusBarManager';
+import StatusBarViewExtensionAbility from '@hms.pcService.StatusBarViewExtensionAbility';
 
 /**
  * 主Ability类,继承自UIAbility
@@ -40,7 +43,7 @@ export default class EntryAbility extends UIAbility {
      * 2. 更新AppStorage中的尺寸状态
      * 3. 记录尺寸变化日志
      */
-    private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => {
+    private onWindowSizeChange: (windowSize: window.Size) => void = async (windowSize: window.Size) => {
         // 获取宽度断点并更新全局状态
         let widthBp: WidthBreakpoint = this.uiContext!.getWindowWidthBreakpoint();
         AppStorage.setOrCreate('currentWidthBreakpoint', widthBp);
@@ -48,12 +51,24 @@ export default class EntryAbility extends UIAbility {
         // 获取高度断点并更新全局状态
         let heightBp: HeightBreakpoint = this.uiContext!.getWindowHeightBreakpoint();
         AppStorage.setOrCreate('currentHeightBreakpoint', heightBp);
-
         // 记录尺寸变化日志
         LogUtil.info('pura onWindowSizeChange currentHeightBreakpoint= '+heightBp);
         LogUtil.info( 'pura onWindowSizeChange currentWidthBreakpoint= '+widthBp);
+
     };
 
+
+
+    onAvoidAreaChange = (data: window.AvoidAreaOptions) => {
+
+       let topRectHeight =  px2vp(data.area.topRect.height);
+       AppStorage.setOrCreate('topRectHeight', topRectHeight);
+        LogUtil.info('onecold onAvoidAreaChange topRectHeight = '+topRectHeight);
+       let bottomRectHeight =  px2vp(data.area.bottomRect.height);
+       AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight);
+
+    }
+
     async onCreate(want:Want, launchParam:AbilityConstant.LaunchParam) {
         AppStorage.setOrCreate('context', this.context);
         hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
@@ -147,6 +162,11 @@ export default class EntryAbility extends UIAbility {
             }).catch((e: BusinessError) => {
                 console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(e));
             })
+            let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
+            let topRectHeight =  px2vp(avoidArea.topRect.height);
+            AppStorage.setOrCreate('topRectHeight', topRectHeight);
+            LogUtil.info('onecold  topRectHeight = '+topRectHeight);
+            windowClass.on('avoidAreaChange', this.onAvoidAreaChange)
         })
 
 

+ 16 - 1
entry/src/main/ets/entryability/ShareUIAbility.ets

@@ -3,7 +3,7 @@ import { window } from '@kit.ArkUI';
 import { systemShare } from '@kit.ShareKit';
 import { BusinessError, emitter } from '@kit.BasicServicesKit';
 import { hilog } from '@kit.PerformanceAnalysisKit';
-import { AppUtil, GlobalContext, StrUtil } from '@pura/harmony-utils';
+import { AppUtil, GlobalContext, LogUtil, StrUtil } from '@pura/harmony-utils';
 import { Utility } from '../common/util/Utility';
 import { DemoConstants } from './DemoConstants';
 import { WXApi, WXEventHandler } from '../common/util/WXApiWrap';
@@ -19,6 +19,16 @@ export default class ShareUIAbility extends UIAbility {
     AppStorage.setOrCreate('currentHeightBreakpoint', heightBp);
   };
 
+  onAvoidAreaChange = (data: window.AvoidAreaOptions) => {
+
+    let topRectHeight =  px2vp(data.area.topRect.height);
+    AppStorage.setOrCreate('topRectHeight', topRectHeight);
+    LogUtil.info('onecold onAvoidAreaChange topRectHeight = '+topRectHeight);
+    let bottomRectHeight =  px2vp(data.area.bottomRect.height);
+    AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight);
+
+  }
+
   onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
     AppStorage.setOrCreate('context', this.context);
     let timeout = 5000
@@ -91,6 +101,11 @@ export default class ShareUIAbility extends UIAbility {
       windowClass = data;
 
       globalThis.windowClass = data // 赋值给全局变量windowClass
+      let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
+      let topRectHeight =  px2vp(avoidArea.topRect.height);
+      AppStorage.setOrCreate('topRectHeight', topRectHeight);
+      LogUtil.info('onecold  topRectHeight = '+topRectHeight);
+      windowClass.on('avoidAreaChange', this.onAvoidAreaChange)
     })
     AppStorage.setOrCreate('windowStage',windowStage);
 

+ 3 - 12
entry/src/main/ets/pages/AboutPage.ets

@@ -29,10 +29,12 @@ export struct AboutPage{
 
   @State verName:string = ''
   @State appName:string = ''
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
 
   // 组件生命周期
   aboutToAppear() {
     // Utility.disableFullScreen()
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     this.verName =  AppUtil.getVersionName()
     Utility.getAppName(getContext(this)).then((appName:string)=>{
       this.appName = appName
@@ -49,17 +51,6 @@ export struct AboutPage{
     console.info('LifeCycleComponent aboutToDisappear');
   }
 
-  //是不是手机横屏
-  isPhoneLan() {
-    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
-      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
-      if (DisplayUtil.getFoldStatus() === 0 ) {
-        return true
-      }
-    }
-
-    return false
-  }
 
   // 工具函数:hex转hsl、hsl转hex、生成渐变色
    hexToHsl(hex: string): [number, number, number] {
@@ -111,7 +102,7 @@ export struct AboutPage{
       Column() {
         // 顶部安全区
         Blank()
-          .height(this.isPhoneLan() ? 0 : px2vp(AppUtil.getStatusBarHeight()))
+          .height(this.topRectHeight)
           .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
           .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         // 自定义标题栏(Stack实现绝对居中)

+ 3 - 2
entry/src/main/ets/pages/MainIndex.ets

@@ -4,7 +4,7 @@ import { StreamContent } from '../view/StreamContent'
 import { window } from '@kit.ArkUI'
 import { common } from '@kit.AbilityKit'
 import { AvSessionController } from '../controller/AvSessionController'
-import { PreferencesUtil, ToastUtil } from '@pura/harmony-utils'
+import { AppUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils'
 import { Utility } from '../common/util/Utility'
 import { IjkMediaPlayer } from '@ohos/ijkplayer'
 import { hilog } from '@kit.PerformanceAnalysisKit'
@@ -20,6 +20,7 @@ struct  MainIndex{
   @State rootPath:string = getContext(this).filesDir
 
   @StorageProp('themeColor') themeColor: string = '#FF4081';
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
 
   @Builder TabBarBuilder(index:number,selIcon:ResourceStr,normalIcon:ResourceStr,text:string){
     Column(){
@@ -51,7 +52,7 @@ struct  MainIndex{
   async aboutToAppear() {
     ScreenUtil.setScreenSize();
     Utility.setStatusBarLight()
-
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     IjkMediaPlayer.getInstance().stop();
     IjkMediaPlayer.getInstance().release();
     let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', '#FF4081');

+ 3 - 1
entry/src/main/ets/pages/NewIndex.ets

@@ -162,7 +162,8 @@ struct NewIndex{
    */
 
   async aboutToAppear() {
-    Utility.enableFullScreen()
+    // Utility.enableFullScreen()
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     Utility.getAppName(getContext(this)).then((appName:string)=>{
       this.appName = appName
     })
@@ -600,6 +601,7 @@ struct NewIndex{
   @StorageProp('currentHeightBreakpoint') currentHeightBreakpoint: HeightBreakpoint | undefined =
     HeightBreakpoint.HEIGHT_LG;
   @StorageProp('currentWidthBreakpoint') currentWidthBreakpoint: WidthBreakpoint | undefined = WidthBreakpoint.WIDTH_SM;
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
 
   //是否是Pura X外屏,或者小屏幕
   isPuraWP() {

+ 4 - 21
entry/src/main/ets/pages/ScanFilePage.ets

@@ -42,6 +42,7 @@ export struct ScanFilePage{
   @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
     ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
   private windowClass: window.Window = globalThis.windowClass
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
   initLottie(lpath:string,isLoop:boolean){
     lottie.destroy(); //加载动画前先销毁之前加载的动画
     this.animateItem = lottie.loadAnimation({
@@ -68,6 +69,7 @@ export struct ScanFilePage{
   }
   // 组件生命周期
   async aboutToAppear() {
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     Utility.getAppName(getContext(this)).then((appName:string)=>{
       this.appName = appName
     })
@@ -157,19 +159,6 @@ export struct ScanFilePage{
 
   }
 
-  //是不是手机横屏
-  isPhoneLan() {
-    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
-      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
-      if (DisplayUtil.getFoldStatus() === 0 ) {
-        return true
-      }
-    }
-
-    return false
-  }
-
-
 
   build() {
     Column() {
@@ -177,7 +166,7 @@ export struct ScanFilePage{
       Column() {
         // 顶部安全区
         Blank()
-          .height(this.isPhoneLan() ? 0 : px2vp(AppUtil.getStatusBarHeight()))
+          .height(this.topRectHeight)
           .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
           .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         // 自定义标题栏(Stack实现绝对居中)
@@ -207,13 +196,7 @@ export struct ScanFilePage{
         .width('100%')
         .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
       }
-      // Column(){
-      //   Line().width('100%').height('100%')
-      // }
-      // .height(this.isPhoneLan()?0:px2vp(AppUtil.getStatusBarHeight()))
-      // .backgroundColor(this.themeColor)
-      // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
-      // TitleBar({ model: $titleBarModel })
+
       Scroll(){
         Column() {
 

+ 3 - 13
entry/src/main/ets/pages/SettingPage.ets

@@ -109,6 +109,7 @@ export struct SettingPage {
   @State isThemeSheet: boolean = false // 主题设置弹窗显示状态
   @State colorRows: Array<Array<ThemeColorItem>> = chunkArray(SettingPage.THEME_COLOR_LIST, 2);
   @State colorGroup: string = "group"
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
   apiDialogController: CustomDialogController = new CustomDialogController({
     builder: CustomContentDialog({
       primaryTitle: this.apiDialogType === 'lyric' ? '修改歌词API地址' : '修改封面API地址',
@@ -171,6 +172,7 @@ export struct SettingPage {
 
   // 组件生命周期
   aboutToAppear() {
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     this.isBgPlayOpen = PreferencesUtil.getBooleanSync(SettingPage.IS_BGPLAY_OPEN, true)
     this.isAutoRatate = PreferencesUtil.getBooleanSync(SettingPage.IS_AUTO_RATATE, true)
     this.isMemoryPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_PLAY, true)
@@ -226,18 +228,6 @@ export struct SettingPage {
     context.getApplicationContext().setColorMode(colorMode)
   }
 
-  //是不是手机横屏
-  isPhoneLan() {
-    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
-      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
-      if (DisplayUtil.getFoldStatus() === 0) {
-        return true
-      }
-    }
-
-    return false
-  }
-
   @Builder
   pickerBuilder() {
     Column({ space: 20 }) {
@@ -474,7 +464,7 @@ export struct SettingPage {
       Column() {
         Line().width('100%').height('100%')
       }
-      .height(this.isPhoneLan() ? 0 : px2vp(AppUtil.getStatusBarHeight()))
+      .height(this.topRectHeight)
       .backgroundColor(this.isDarkMode ? $r('app.color.title_bar_bg') : this.themeColor)
       .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
 

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

@@ -13,7 +13,7 @@ import { CSJUtil } from '../common/util/CSJUtil'
 import { UIUtil } from '../common/util/UIUtil'
 import { PrintBiddingTokenUtils } from '../common/util/PrintBiddintTokenUtils'
 import { DemoConstants } from '../entryability/DemoConstants'
-import { Base64Util, FileUtil, LogUtil, StrUtil, ToastUtil } from '@pura/harmony-utils'
+import { AppUtil, Base64Util, FileUtil, LogUtil, StrUtil, ToastUtil } from '@pura/harmony-utils'
 import { Utility } from '../common/util/Utility'
 import { VideoItem } from '../viewmodel/VideoItem'
 import { LocalMusic } from '../view/LocalMusic'

+ 3 - 12
entry/src/main/ets/pages/UserCenter.ets

@@ -131,6 +131,7 @@ export struct UserCenter {
   @StorageProp('themeColor') themeColor: string = '#FF4081';
   @State isDarkMode: boolean = false
   @State webUrl: string = CommonConstants.NEW_DUTY
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
   @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number =
     ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
   onColorModeChange() {
@@ -189,6 +190,7 @@ export struct UserCenter {
   }
 
   aboutToAppear(): void {
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     let themeColor = PreferencesUtil.getStringSync('THEME_COLOR', '#FF4081');
     this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
     AppStorage.setOrCreate('themeColor', themeColor);
@@ -222,7 +224,7 @@ export struct UserCenter {
       Column() {
         // 顶部安全区
         Blank()
-          .height(this.isPhoneLan() ? 0 : px2vp(AppUtil.getStatusBarHeight()))
+          .height(this.topRectHeight)
           .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
           .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         // 自定义标题栏(Stack实现绝对居中)
@@ -842,17 +844,6 @@ export struct UserCenter {
     }
   }
 
-  isPhoneLan() {
-    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
-      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
-      if (DisplayUtil.getFoldStatus() === 0 || DisplayUtil.getFoldStatus() === 2) {
-        return true
-      }
-    }
-
-    return false
-  }
-
   // 菜单项构建
   @Builder
   menuItem(icon: Resource, text: string, onClick: () => void): void {

+ 2 - 0
entry/src/main/ets/pages/VerifyPage.ets

@@ -32,8 +32,10 @@ export struct VerifyPage{
 
     })
   @State verName:string = ''
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
   // 组件生命周期
   aboutToAppear() {
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     this.verName = AppUtil.getVersionName()
     // AppUtil.getVersionName().then((name)=>{
     //   this.verName = name

+ 3 - 12
entry/src/main/ets/pages/VipPage.ets

@@ -78,6 +78,7 @@ export  struct  VipPage{
   @State resultText: string = ''
   /** 当前断点类型(如大屏/小屏) */
   @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointTypeEnum.MD;
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
 
   static readonly WX_NOTIFY_URL: string = 'https://webhook.ss5.xyz/wechat_notify.php'
 
@@ -90,6 +91,7 @@ export  struct  VipPage{
   }
   // 组件生命周期
   async aboutToAppear() {
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     this.isAgree = PreferencesUtil.getBooleanSync(VipPage.IS_AGREE,false)
     Utility.getAppName(getContext(this)).then((appName:string)=>{
       this.appName = appName
@@ -130,17 +132,6 @@ export  struct  VipPage{
   }
 
 
-  //是不是手机横屏
-  isPhoneLan() {
-    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
-      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
-      if (DisplayUtil.getFoldStatus() === 0 ) {
-        return true
-      }
-    }
-
-    return false
-  }
 
   build() {
 
@@ -150,7 +141,7 @@ export  struct  VipPage{
       Column() {
         // 顶部安全区
         Blank()
-          .height(this.isPhoneLan() ? 0 : px2vp(AppUtil.getStatusBarHeight()))
+          .height(this.topRectHeight)
           .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
           .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         // 自定义标题栏(Stack实现绝对居中)

+ 3 - 13
entry/src/main/ets/pages/WebIndex.ets

@@ -29,7 +29,7 @@ struct  WebIndex{
   /** 当前断点类型(如大屏/小屏) */
   @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointTypeEnum.MD;
   @StorageProp('themeColor') themeColor: string = '#FF4081';
-
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
   onColorModeChange() {
     this.isDarkMode = this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK
   }
@@ -39,6 +39,7 @@ struct  WebIndex{
 
   // 组件生命周期
   aboutToAppear() {
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     // Utility.disableFullScreen()
     if(!NetworkUtil.hasDefaultNetSync()){
       ToastUtil.showToast('没有网络,请检查网络连接!')
@@ -50,17 +51,6 @@ struct  WebIndex{
     this.onColorModeChange()
   }
 
-  //是不是手机横屏
-  isPhoneLan() {
-    if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
-      && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
-      if (DisplayUtil.getFoldStatus() === 0 ) {
-        return true
-      }
-    }
-
-    return false
-  }
 
   build() {
     Column(){
@@ -68,7 +58,7 @@ struct  WebIndex{
       Column() {
         // 顶部安全区
         Blank()
-          .height(this.isPhoneLan() ? 0 : px2vp(AppUtil.getStatusBarHeight()))
+          .height(this.topRectHeight)
           .backgroundColor(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor)
           .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         // 自定义标题栏(Stack实现绝对居中)

+ 0 - 43
entry/src/main/ets/pages/index.ets

@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2024 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import router from '@ohos.router'
-import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
-
-@Entry
-@Component
-struct indexPage {
-  @StorageProp('currentColorMode') currentMode: number = ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT;
-
-  build() {
-    Column() {
-      Button($r('app.string.video_demo'))
-        .margin({ bottom: 20 })
-        .width(200)
-        .onClick(() => {
-          router.pushUrl({ url: 'pages/SampleVideoListPage' })
-        })
-      Button($r('app.string.audio_demo'))
-        .width(200)
-        .onClick(() => {
-          router.pushUrl({ url: 'pages/SampleAudioListPage' })
-        })
-    }
-    .width('100%')
-    .height('100%')
-    .backgroundColor(this.currentMode === ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT ? Color.Gray : '#121212')
-    .justifyContent(FlexAlign.Center)
-  }
-}

+ 16 - 15
entry/src/main/ets/view/LocalMusic.ets

@@ -188,6 +188,8 @@ export struct LocalMusic {
   @State bgBrightness: number = 0 //背景亮度
   private listScroller: ListScroller = new ListScroller()
   private playListScroller: Scroller = new Scroller()
+  @StorageProp('isLandscape') isLandscape: boolean = false;
+  @StorageProp('topRectHeight') topRectHeight: number = px2vp(AppUtil.getStatusBarHeight());
   private listArea: Area = {
     width: 0,
     height: 0,
@@ -399,7 +401,7 @@ export struct LocalMusic {
   // 组件生命周期
   aboutToAppear() {
     this.initSetting()
-
+    this.topRectHeight = px2vp(AppUtil.getStatusBarHeight());
     Utility.getAppName(getContext(this)).then((appName: string) => {
       this.appName = appName
     })
@@ -453,10 +455,6 @@ export struct LocalMusic {
 
     this.makeWorker()
 
-    this.windowClass.on('windowSizeChange', (size) => {
-      this.doChangeBarHeight()
-
-    });
 
     //折叠屏的屏幕显示模式变化
     display.on('foldDisplayModeChange', (data) => {
@@ -478,13 +476,18 @@ export struct LocalMusic {
     this.themeColor = themeColor;
     this.doChangeSetting()
     this.windowClass.on('windowSizeChange', (size) => {
-      LogUtil.info('onecold  windowSizeChange')
-      if(!this.isPhoneLan()){
-        LogUtil.info('onecold  windowSizeChange11')
+      // LogUtil.info('onecold  windowSizeChange')
+      this.doChangeBarHeight()
+      let viewWidth = px2vp(size.width);
+      let viewHeight = px2vp(size.height);
+      if (viewWidth > viewHeight) {
+        // this.isLandscape = true;
         this.startAutoHide()
+        // Logger.info('onecold 横屏 windowSizeChange isLandscape = ' + this.isLandscape)
       }else{
-        LogUtil.info('onecold  windowSizeChange13')
+        // this.isLandscape = false;
         this.isAutoHide = false
+        // Logger.info('onecold 竖屏 windowSizeChange isLandscape = ' + this.isLandscape)
       }
 
     });
@@ -1833,7 +1836,7 @@ export struct LocalMusic {
         Column(){
           Line().width('100%').height('100%')
         }
-        .height(this.isPhoneLan()?0:px2vp(AppUtil.getStatusBarHeight()))
+        .height(this.topRectHeight)
         .backgroundColor(this.isCustomizeBg?Color.Transparent:(this.isDarkMode?$r('app.color.title_bar_bg'):this.themeColor))
         .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
         TitleBar({ model: $titleBarModel })
@@ -4924,20 +4927,19 @@ export struct LocalMusic {
   }
 
   //是不是手机横屏
+
   isPhoneLan() {
-    LogUtil.info(' isPhoneLan this.currentBreakpoint = '+ this.currentBreakpoint )
-    LogUtil.info(' isPhoneLan DisplayUtil.getFoldStatus() = '+ DisplayUtil.getFoldStatus() )
     if (DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
       && this.currentBreakpoint !== BreakpointTypeEnum.SM) {
       if (DisplayUtil.getFoldStatus() === 0 ) {
-        LogUtil.info(' isPhoneLan 是横屏' )
         return true
       }
     }
-    LogUtil.info(' isPhoneLan 不是横屏' )
+
     return false
   }
 
+
   @Builder
   IjkMusicPlayerView() {
 
@@ -5079,7 +5081,6 @@ export struct LocalMusic {
   @State name: string = '';
   // @State loop: boolean = false;
   @State playType: number = 0; //0:连续播放  1:单片重复播放 2:正常播放 3:随机播放
-  @State isLandscape: boolean = false;
   @State multiple: string = '1.0X';
   xcomponentController: XComponentController = new XComponentController()
   private panOptionBright: PanGestureOptions =

+ 0 - 1
entry/src/main/resources/base/profile/main_pages.json

@@ -1,6 +1,5 @@
 {
   "src": [
-    "pages/index",
     "pages/SplashIndex",
     "pages/MainIndex",
     "pages/WebIndex",