From 17fcbdd29acac6a4c7706f0419fd0493b52e578e Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Wed, 6 Aug 2025 16:31:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=95=8C=E9=9D=A2=E6=B2=89?= =?UTF-8?q?=E6=B5=B8=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzezhong --- .../main/ets/entryability/EntryAbility.ets | 61 ++++++++++--------- .../src/main/ets/view/IntentContent.ets | 2 +- .../src/main/ets/view/IntentDetailPage.ets | 1 - 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/services/dialog_ui/ams_system_dialog/feature/src/main/ets/entryability/EntryAbility.ets b/services/dialog_ui/ams_system_dialog/feature/src/main/ets/entryability/EntryAbility.ets index 31edff9edb6..8c7611bab20 100644 --- a/services/dialog_ui/ams_system_dialog/feature/src/main/ets/entryability/EntryAbility.ets +++ b/services/dialog_ui/ams_system_dialog/feature/src/main/ets/entryability/EntryAbility.ets @@ -18,68 +18,69 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'; import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; import UIAbility from '@ohos.app.ability.UIAbility'; import hilog from '@ohos.hilog'; +import { BusinessError } from '@kit.BasicServicesKit'; import window from '@ohos.window'; const DOMAIN = 0x1323; +const TAG = 'InsightIntents'; export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); AppStorage.setAndLink('context', this.context); - hilog.info(DOMAIN, 'InsightIntents', '%{public}s', 'Ability onCreate'); + hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onCreate'); const callerBundleName: string | undefined = want.parameters?.['ohos.aafwk.param.callerBundleName']?.toString(); if (callerBundleName === undefined || callerBundleName !== 'com.huawei.hmos.aidataservice') { try { this.context.terminateSelf(); } catch (err) { - hilog.error(DOMAIN, 'InsightIntents', 'Failed to context.terminateSelf. Cause: %{public}s', JSON.stringify(err)); + hilog.error(DOMAIN, TAG, 'Failed to context.terminateSelf. Cause: %{public}s', JSON.stringify(err)); } } } onDestroy(): void { - hilog.info(DOMAIN, 'InsightIntents', '%{public}s', 'Ability onDestroy'); + hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onDestroy'); } onWindowStageCreate(windowStage: window.WindowStage): void { - - let windowClass: window.Window; - windowStage.getMainWindow((err, data) => { - windowClass = data; - windowClass.setWindowLayoutFullScreen(true).then(() => { - hilog.info(DOMAIN, 'InsightIntents', 'Set Window Layout Full Screen.'); - }) - + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(DOMAIN, TAG, 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); + return; + } + hilog.info(DOMAIN, TAG, 'Succeeded in loading the content.'); try { - const top = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect - let navigationHeight = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height - PersistentStorage.PersistProps([{ - key: 'navigationHeight', defaultValue: navigationHeight - }]) - } catch (err){ - hilog.error(DOMAIN, 'InsightIntents', 'Failed to getWindowAvoidArea.', JSON.stringify(err)); + windowStage.getMainWindow((err, data) => { + data.setWindowLayoutFullScreen(true).then(() => { + hilog.info(DOMAIN, TAG, 'Succeeded in setting the window layout to full-screen mode.'); + }).catch((err:BusinessError) => { + hilog.error(DOMAIN, TAG, 'Failed to set the window layout to full-screen mode. Cause: %{public}s', JSON.stringify(err)); + }) + data.setWindowSystemBarProperties({ + navigationBarColor: '#F1F3F5', + statusBarColor: '#F1F3F5' + }).then(() => { + hilog.info(DOMAIN, TAG, 'Succeeded in setting the system bar properties.'); + }).catch((err: BusinessError) => { + hilog.error(DOMAIN, TAG, 'Failed to set the system bar properties. Cause: %{public}s', JSON.stringify(err)); + }) + }); + } catch (err) { + hilog.error(DOMAIN, TAG, 'Failed to getMainWindow. Cause: %{public}s', JSON.stringify(err)); } - - - windowStage.loadContent('pages/Index', (err) => { - if (err.code) { - hilog.error(DOMAIN, 'InsightIntents', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); - return; - } - hilog.info(DOMAIN, 'InsightIntents', 'Succeeded in loading the content.'); - }); }); } onWindowStageDestroy(): void { - hilog.info(DOMAIN, 'InsightIntents', '%{public}s', 'Ability onWindowStageDestroy'); + hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onWindowStageDestroy'); } onForeground(): void { - hilog.info(DOMAIN, 'InsightIntents', '%{public}s', 'Ability onForeground'); + hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onForeground'); } onBackground(): void { - hilog.info(DOMAIN, 'InsightIntents', '%{public}s', 'Ability onBackground'); + hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onBackground'); } } \ No newline at end of file diff --git a/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentContent.ets b/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentContent.ets index abf106ec744..c66857d4488 100644 --- a/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentContent.ets +++ b/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentContent.ets @@ -302,7 +302,7 @@ export struct IntentContent { } .width('100%') .height('100%') - .padding({top:36}) + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) .backgroundColor($r('app.color.background_cont')) } } diff --git a/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentDetailPage.ets b/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentDetailPage.ets index 99eeac76b62..06e019817e6 100644 --- a/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentDetailPage.ets +++ b/services/dialog_ui/ams_system_dialog/feature/src/main/ets/view/IntentDetailPage.ets @@ -848,7 +848,6 @@ export struct IntentDetailPage { .hideTitleBar(true) .width('100%') .height('100%') - .padding({ top: 36, bottom: 36 }) .backgroundColor($r('app.color.background_cont')) .clip(true) } -- Gitee