From 175111c72326dcf9ee8ed2bd3e923d59c9162713 Mon Sep 17 00:00:00 2001 From: sfchu Date: Thu, 11 Sep 2025 16:19:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/LoginPage.ets | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/entry/src/main/ets/pages/LoginPage.ets b/entry/src/main/ets/pages/LoginPage.ets index 6c6433b..bd97a6e 100644 --- a/entry/src/main/ets/pages/LoginPage.ets +++ b/entry/src/main/ets/pages/LoginPage.ets @@ -13,7 +13,8 @@ * limitations under the License. */ -import { promptAction, router } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; import CommonConstants from '../common/constants/CommonConstants'; @Extend(TextInput) @@ -75,9 +76,15 @@ struct LoginPage { login(): void { if (this.account === '' || this.password === '') { - this.getUIContext().getPromptAction().showToast({ - message: $r('app.string.input_empty_tips') - }) + try { + this.getUIContext().getPromptAction().showToast({ + message: $r('app.string.input_empty_tips') + }) + } catch (error) { + let message = (error as BusinessError).message; + let code = (error as BusinessError).code; + hilog.error(0x0000, 'LoginPage', `showToast args error code is ${code}, message is ${message}`); + } } else { this.isShowProgress = true; if (this.timeOutId === -1) { -- Gitee From a50bd52ea3d5a4630df88b8933ce324f4bb353ec Mon Sep 17 00:00:00 2001 From: sfchu Date: Sat, 20 Sep 2025 16:39:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9F=BA=E4=BA=8EArkUI=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=B8=B8=E7=94=A8=E7=BB=84=E4=BB=B6=E4=B8=8E=E5=B8=83=E5=B1=80?= =?UTF-8?q?=20=E5=B7=A5=E7=A8=8B=20=E6=B2=89=E6=B5=B8=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/entryability/EntryAbility.ets | 28 ++++++++++++++++++- entry/src/main/ets/pages/MainPage.ets | 6 +++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 42c22f1..a05711d 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -14,8 +14,9 @@ */ import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; -import { window } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; /** * Lift cycle management of Ability. @@ -44,6 +45,8 @@ export default class entryAbility extends UIAbility { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } + // Immersive Adaptation + this.immersionFuc(windowStage); hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); @@ -66,4 +69,27 @@ export default class entryAbility extends UIAbility { hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } + + /** + * Page immersion. + */ + immersionFuc(windowStage: window.WindowStage): void { + try { + let windowClass: window.Window = windowStage.getMainWindowSync(); + windowClass.setWindowLayoutFullScreen(true).catch((err: BusinessError) => { + hilog.error(0x0000, 'testTag', '%{public}s', + `SetWindowLayoutFullScreen failed. Cause code: ${err.code}, message: ${err.message}`); + }); + let navigationBarArea: window.AvoidArea = + windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); + let area: window.AvoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + AppStorage.setOrCreate('naviIndicatorHeight', + windowClass.getUIContext().px2vp(navigationBarArea.bottomRect.height)); + AppStorage.setOrCreate('statusBarHeight', windowClass.getUIContext().px2vp(area.topRect.height)); + AppStorage.setOrCreate('windowClass', windowClass); + } catch (err) { + hilog.error(0x0000, 'testTag', '%{public}s', + `immersionFuc failed, error code=${err.code}, message=${err.message}`); + } + } } diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index 744230b..9d9418d 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -67,11 +67,15 @@ struct MainPage { $r('app.media.mine_selected'), $r('app.media.mine_normal'))) } .width(CommonConstants.FULL_PARENT) - .backgroundColor(Color.White) + .backgroundColor($r('app.color.background')) .barHeight($r('app.float.mainPage_barHeight')) .barMode(BarMode.Fixed) .onChange((index: number) => { this.currentIndex = index; }) + .padding({ + top: AppStorage.get('statusBarHeight'), + bottom: AppStorage.get('naviIndicatorHeight') as number + }) } } \ No newline at end of file -- Gitee