Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card10Component.ets
Showing
3 changed files
with
34 additions
and
4 deletions
| @@ -82,4 +82,20 @@ export class DeviceUtil { | @@ -82,4 +82,20 @@ export class DeviceUtil { | ||
| 82 | static getRandomUUIDForTraceID(): string { | 82 | static getRandomUUIDForTraceID(): string { |
| 83 | return util.generateRandomUUID().toUpperCase().replace(/-/g, '') | 83 | return util.generateRandomUUID().toUpperCase().replace(/-/g, '') |
| 84 | } | 84 | } |
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * 是否为phone设备(可折叠手机即便完全展开状态也返回true) | ||
| 88 | + * @returns | ||
| 89 | + */ | ||
| 90 | + static isPhone(): boolean { | ||
| 91 | + return deviceInfo.deviceType == 'phone' || deviceInfo.deviceType == 'default'; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + static isNotPhone(): boolean { | ||
| 95 | + return !DeviceUtil.isPhone(); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + static isTablet(): boolean { | ||
| 99 | + return deviceInfo.deviceType == 'tablet'; | ||
| 100 | + } | ||
| 85 | } | 101 | } |
| 1 | -import { ContentDTO, slideShows, VideoInfoDTO, CompDTO } from 'wdBean'; | 1 | +import { ContentDTO, slideShows, VideoInfoDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| @@ -5,7 +5,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; | @@ -5,7 +5,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; | ||
| 5 | import Want from '@ohos.app.ability.Want'; | 5 | import Want from '@ohos.app.ability.Want'; |
| 6 | import window from '@ohos.window'; | 6 | import window from '@ohos.window'; |
| 7 | import { BusinessError } from '@ohos.base'; | 7 | import { BusinessError } from '@ohos.base'; |
| 8 | -import { EmitterEventId, EmitterUtils, WindowModel } from 'wdKit'; | 8 | +import { DeviceUtil, EmitterEventId, EmitterUtils, WindowModel } from 'wdKit'; |
| 9 | import { ConfigurationConstant } from '@kit.AbilityKit'; | 9 | import { ConfigurationConstant } from '@kit.AbilityKit'; |
| 10 | import { WDPushNotificationManager } from 'wdHwAbility/Index'; | 10 | import { WDPushNotificationManager } from 'wdHwAbility/Index'; |
| 11 | import { StartupManager } from '../startupmanager/StartupManager'; | 11 | import { StartupManager } from '../startupmanager/StartupManager'; |
| @@ -58,8 +58,20 @@ export default class EntryAbility extends UIAbility { | @@ -58,8 +58,20 @@ export default class EntryAbility extends UIAbility { | ||
| 58 | console.info('floatWindowClass audioWidth' + audioWidth); | 58 | console.info('floatWindowClass audioWidth' + audioWidth); |
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | - // let a = new WindowModel(); | ||
| 62 | - // 设置窗口的显示方向属性 | 61 | + // 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动 |
| 62 | + if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) { | ||
| 63 | + // 设置窗口的布局是否为沉浸式布局 | ||
| 64 | + // 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。 | ||
| 65 | + // 非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。 | ||
| 66 | + // windowClass.setWindowLayoutFullScreen(true) | ||
| 67 | + // 设置窗口全屏模式时窗口内导航栏、状态栏的属性 | ||
| 68 | + // windowClass.setWindowSystemBarProperties({ | ||
| 69 | + // statusBarContentColor: "#FFFFFF" | ||
| 70 | + // }) | ||
| 71 | + | ||
| 72 | + // 设置启动时窗口的显示方向属性, | ||
| 73 | + // 普通phone以PORTRAIT/竖屏显示模式启动 | ||
| 74 | + // 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动 | ||
| 63 | WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT) | 75 | WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT) |
| 64 | .then(() => { | 76 | .then(() => { |
| 65 | hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded'); | 77 | hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded'); |
| @@ -68,6 +80,8 @@ export default class EntryAbility extends UIAbility { | @@ -68,6 +80,8 @@ export default class EntryAbility extends UIAbility { | ||
| 68 | hilog.error(0x0000, 'testTag', | 80 | hilog.error(0x0000, 'testTag', |
| 69 | `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`); | 81 | `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`); |
| 70 | }) | 82 | }) |
| 83 | + } | ||
| 84 | + | ||
| 71 | //../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage | 85 | //../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage |
| 72 | windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => { | 86 | windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => { |
| 73 | if (err.code) { | 87 | if (err.code) { |
-
Please register or login to post a comment