Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhenghy
2024-05-15 17:56:42 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9a7bd8407b4d584403c11194f21edf1aecb81d56
9a7bd840
1 parent
cd4f447f
页面全屏代码
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
12 deletions
sight_harmony/commons/wdKit/src/main/ets/utils/DeviceUtil.ets
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
sight_harmony/commons/wdKit/src/main/ets/utils/DeviceUtil.ets
View file @
9a7bd84
...
...
@@ -82,4 +82,20 @@ export class DeviceUtil {
static getRandomUUIDForTraceID(): string {
return util.generateRandomUUID().toUpperCase().replace(/-/g, '')
}
/**
* 是否为phone设备(可折叠手机即便完全展开状态也返回true)
* @returns
*/
static isPhone(): boolean {
return deviceInfo.deviceType == 'phone' || deviceInfo.deviceType == 'default';
}
static isNotPhone(): boolean {
return !DeviceUtil.isPhone();
}
static isTablet(): boolean {
return deviceInfo.deviceType == 'tablet';
}
}
...
...
sight_harmony/products/phone/src/main/ets/entryability/EntryAbility.ets
View file @
9a7bd84
...
...
@@ -4,7 +4,7 @@ import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
import { EmitterEventId, EmitterUtils, WindowModel } from 'wdKit';
import {
DeviceUtil,
EmitterEventId, EmitterUtils, WindowModel } from 'wdKit';
import { ConfigurationConstant } from '@kit.AbilityKit';
import { WDPushNotificationManager } from 'wdHwAbility/Index';
import { StartupManager } from '../startupmanager/StartupManager';
...
...
@@ -52,16 +52,30 @@ export default class EntryAbility extends UIAbility {
console.info('floatWindowClass audioWidth' + audioWidth);
// let a = new WindowModel();
// 设置窗口的显示方向属性
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
hilog.error(0x0000, 'testTag',
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
// 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动
if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {
// 设置窗口的布局是否为沉浸式布局
// 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。
// 非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。
// windowClass.setWindowLayoutFullScreen(true)
// 设置窗口全屏模式时窗口内导航栏、状态栏的属性
// windowClass.setWindowSystemBarProperties({
// statusBarContentColor: "#FFFFFF"
// })
// 设置启动时窗口的显示方向属性,
// 普通phone以PORTRAIT/竖屏显示模式启动
// 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
hilog.error(0x0000, 'testTag',
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
}
//../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage
windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => {
if (err.code) {
...
...
@@ -70,7 +84,7 @@ export default class EntryAbility extends UIAbility {
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
// 1.创建悬浮窗
// 1.创建悬浮窗
// const config: window.Configuration = {
// name: "floatWindow", windowType: window.WindowType.TYPE_FLOAT, ctx: this.context
// };
...
...
Please
register
or
login
to post a comment