diff --git a/README.md b/README.md index 2d24e319f05af089aa8c5bec9cc86f64c0249e11..89ce6611f5c5d3708ca7c0716723f9a449263272 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Web组件预览PDF文件 +# 基于Web组件实现预览PDF文件功能 ### 介绍 diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 29c0feade15478a40b571437bc2cb2b8d0ae227f..465cfb2560b47c9bab7c2523fba963554459c0ab 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { window } from '@kit.ArkUI'; @@ -23,7 +23,7 @@ export default class EntryAbility extends UIAbility { windowClass: window.Window | undefined = undefined; isLayoutFullScreen = true; - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + onCreate(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -44,18 +44,18 @@ export default class EntryAbility extends UIAbility { } this.windowClass = data; try { - this.windowClass.setWindowLayoutFullScreen(this.isLayoutFullScreen, (err: BusinessError) => { - const errCode: number = err.code; - if (errCode) { - Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); - return; - } + let promise = this.windowClass.setWindowLayoutFullScreen(this.isLayoutFullScreen); + promise.then(() => { Logger.info('Succeeded in setting the window layout to full-screen mode.'); + }).catch((err: BusinessError) => { + Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); }); } catch (exception) { Logger.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(exception)); } - this.windowClass.setSpecificSystemBarEnabled('status', false); + if (canIUse('SystemCapability.Window.SessionManager')) { + this.windowClass.setSpecificSystemBarEnabled('status', false); + } }) windowStage.loadContent('pages/Index', (err) => {