diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 595a7437cb5ce47ffe4883bfdded99d79abbfd3a..5fffbf14bd8b19dcf78610ed537f2aa481412c27 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -73,21 +73,14 @@ export default class EntryAbility extends UIAbility { let bottomRectHeight: number = avoidArea.bottomRect.height; AppStorage.setOrCreate('bottomRectHeight', bottomRectHeight); this.updateBreakpoint(windowObj.getWindowProperties().windowRect.width); + windowObj.on('windowSizeChange', (windowSize) => { this.updateBreakpoint(windowSize.width); }); - windowStage.loadContent('pages/Index', (error: BusinessError) => { - if (error.code) { - hilog.error(0x0000, TAG, '%{public}s', - `Failed to load the content. code: ${error.code}, message: ${error.message}`); - return; - } - hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in loading the content.'); - }); - let windowClass: window.Window = windowStage.getMainWindowSync(); - windowClass.setWindowLayoutFullScreen(true); + + windowObj.setWindowLayoutFullScreen(true); let sysBarProps: window.SystemBarProperties = { statusBarContentColor: '#FFFFFF' }; - windowClass.setWindowSystemBarProperties(sysBarProps); + windowObj.setWindowSystemBarProperties(sysBarProps); } catch (error) { hilog.error(0x0000, TAG, '%{public}s', `onWindowStageCreate failed. Cause code: ${error.code}, message: ${error.message}`); @@ -95,6 +88,15 @@ export default class EntryAbility extends UIAbility { }).catch((err: BusinessError) => { hilog.error(0x0000, TAG, `Failed to get main window. Cause:`, err.message); }); + + windowStage.loadContent('pages/Index', (error: BusinessError) => { + if (error.code) { + hilog.error(0x0000, TAG, '%{public}s', + `Failed to load the content. code: ${error.code}, message: ${error.message}`); + return; + } + hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in loading the content.'); + }); } onWindowStageDestroy(): void {