From 88ad7c0f64bdd56db4c4faa928b1845a2108bdfe Mon Sep 17 00:00:00 2001 From: lisa-lian Date: Sat, 12 Jul 2025 17:33:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8D=8A=E5=B1=8F=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E5=BC=8F=E6=8B=89=E8=B5=B7=E6=97=A0=E5=8A=A8=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 连漪 --- customappbar/interfaces/custom_app_bar.js | 27 ++++++++++----------- customappbar/source/custom_app_bar.ets | 29 +++++++++++------------ 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/customappbar/interfaces/custom_app_bar.js b/customappbar/interfaces/custom_app_bar.js index aff4ace..fab0151 100644 --- a/customappbar/interfaces/custom_app_bar.js +++ b/customappbar/interfaces/custom_app_bar.js @@ -706,20 +706,6 @@ export class CustomAppBar extends ViewPU { set labelName(newValue) { this.__labelName.set(newValue); } - aboutToAppear() { - if (this.isHalfScreen) { - this.contentBgColor = Color.Transparent; - this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; - this.halfScreenShowAnimation(); - } - else { - this.containerHeight = '100%'; - this.containerWidth = '100%'; - } - this.updateStringByResource(); - this.getDeviceRadiusConfig(); - this.subscribePrivacyState(); - } aboutToDisappear() { this.smListener.off('change'); this.mdListener.off('change'); @@ -1466,6 +1452,19 @@ export class CustomAppBar extends ViewPU { Stack.backgroundColor(ObservedObject.GetRawObject(this.contentBgColor)); Stack.hitTestBehavior(HitTestMode.Transparent); Stack.id('AtomicServiceContainerId'); + Stack.onAppear(() => { + if (this.isHalfScreen) { + this.contentBgColor = Color.Transparent; + this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; + this.halfScreenShowAnimation(); + } else { + this.containerHeight = '100%'; + this.containerWidth = '100%'; + } + this.updateStringByResource(); + this.getDeviceRadiusConfig(); + this.subscribePrivacyState(); + }); }, Stack); this.observeComponentCreation2((elmtId, isInitialRender) => { If.create(); diff --git a/customappbar/source/custom_app_bar.ets b/customappbar/source/custom_app_bar.ets index 01ebc72..5b62f7e 100644 --- a/customappbar/source/custom_app_bar.ets +++ b/customappbar/source/custom_app_bar.ets @@ -198,20 +198,6 @@ export struct CustomAppBar { events: ['usual.event.PRIVACY_STATE_CHANGED'] }; - aboutToAppear(): void { - if (this.isHalfScreen) { - this.contentBgColor = Color.Transparent; - this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; - this.halfScreenShowAnimation(); - } else { - this.containerHeight = '100%'; - this.containerWidth = '100%'; - } - this.updateStringByResource(); - this.getDeviceRadiusConfig(); - this.subscribePrivacyState(); - } - aboutToDisappear(): void { this.smListener.off('change'); this.mdListener.off('change'); @@ -482,12 +468,12 @@ export struct CustomAppBar { * 半屏放大至全屏动效 */ expendContainerAnimation(): void { + this.isHalfToFullScreen = true; animateTo({ duration: 150, curve: curves.interpolatingSpring(0, 1, 328, 36), onFinish: () => { this.contentBgColor = '#FFFFFF'; - this.isHalfToFullScreen = true; } }, () => { this.containerWidth = '100%'; @@ -950,6 +936,19 @@ export struct CustomAppBar { .backgroundColor(this.contentBgColor) .hitTestBehavior(HitTestMode.Transparent) .id('AtomicServiceContainerId') + .onAppear(() => { + if (this.isHalfScreen) { + this.contentBgColor = Color.Transparent; + this.titleHeight = EYELASH_HEIGHT + 2 * TITLE_MARGIN_TOP + this.statusBarHeight; + this.halfScreenShowAnimation(); + } else { + this.containerHeight = '100%'; + this.containerWidth = '100%'; + } + this.updateStringByResource(); + this.getDeviceRadiusConfig(); + this.subscribePrivacyState(); + }) } .height('100%') .width('100%') -- Gitee