From 76cdd52c09e56eca401baafa4addf3fde9b39215 Mon Sep 17 00:00:00 2001 From: 26thE <962961353@qq.com> Date: Tue, 25 Mar 2025 19:31:36 +0800 Subject: [PATCH 1/4] =?UTF-8?q?HMOS=E4=B8=96=E7=95=8C=E6=95=B4=E6=94=B9Sam?= =?UTF-8?q?ple=EF=BC=8C=E6=B5=81=E7=95=85=E5=88=B7=E6=96=87=E7=AB=A0?= =?UTF-8?q?=EF=BC=8C=E5=AE=89=E5=85=A8=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/Utils.ets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entry/src/main/ets/common/Utils.ets b/entry/src/main/ets/common/Utils.ets index facd5c0..cb4ab5e 100644 --- a/entry/src/main/ets/common/Utils.ets +++ b/entry/src/main/ets/common/Utils.ets @@ -16,9 +16,9 @@ import { Constants } from './Constants'; export class BreakpointType { - sm: T; - md: T; - lg: T; + private sm: T; + private md: T; + private lg: T; constructor(sm: T, md: T, lg: T) { this.sm = sm; -- Gitee From 7569380291363d5adb2c328ce2e175ea90408fa5 Mon Sep 17 00:00:00 2001 From: 26thE <962961353@qq.com> Date: Tue, 25 Mar 2025 19:46:19 +0800 Subject: [PATCH 2/4] =?UTF-8?q?HMOS=E4=B8=96=E7=95=8C=E6=95=B4=E6=94=B9Sam?= =?UTF-8?q?ple=EF=BC=8C=E6=B5=81=E7=95=85=E5=88=B7=E6=96=87=E7=AB=A0?= =?UTF-8?q?=EF=BC=8C=E5=AE=89=E5=85=A8=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/entryability/EntryAbility.ets | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index fd73a08..612213e 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -27,18 +27,23 @@ export default class EntryAbility extends UIAbility { private curBp: string = ''; private updateBreakpoint(windowWidth: number): void { - let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; - let newBp: string = ''; - if (windowWidthVp < 600) { - newBp = Constants.BREAK_POINT_SM; - } else if (windowWidthVp < 840) { - newBp = Constants.BREAK_POINT_MD; - } else { - newBp = Constants.BREAK_POINT_LG; - } - if (this.curBp !== newBp) { - this.curBp = newBp; - AppStorage.setOrCreate('currentBreakpoint', this.curBp); + try { + let windowWidthVp: number = windowWidth / display.getDefaultDisplaySync().densityPixels; + let newBp: string = ''; + if (windowWidthVp < 600) { + newBp = Constants.BREAK_POINT_SM; + } else if (windowWidthVp < 840) { + newBp = Constants.BREAK_POINT_MD; + } else { + newBp = Constants.BREAK_POINT_LG; + } + if (this.curBp !== newBp) { + this.curBp = newBp; + AppStorage.setOrCreate('currentBreakpoint', this.curBp); + } + } catch (error) { + hilog.error(0x0000, TAG, 'updateBreakpoint catch err:', JSON.stringify(error) ?? ''); + return; } } @@ -93,7 +98,8 @@ export default class EntryAbility extends UIAbility { windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => { hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in setting the window layout to full-screen mode'); }).catch((err: BusinessError) => { - hilog.error(0x0000, TAG, 'Failed to set the window layout to full-screen mode. Cause:', JSON.stringify(err) ?? ''); + hilog.error(0x0000, TAG, 'Failed to set the window layout to full-screen mode. Cause:', + JSON.stringify(err) ?? ''); }); }); } -- Gitee From 11275fb3f7df486e5dfce4b627a9074270fe909e Mon Sep 17 00:00:00 2001 From: 26thE <962961353@qq.com> Date: Tue, 25 Mar 2025 20:01:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?HMOS=E4=B8=96=E7=95=8C=E6=95=B4=E6=94=B9Sam?= =?UTF-8?q?ple=EF=BC=8C=E6=B5=81=E7=95=85=E5=88=B7=E6=96=87=E7=AB=A0?= =?UTF-8?q?=EF=BC=8C=E5=AE=89=E5=85=A8=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/entryability/EntryAbility.ets | 1 - 1 file changed, 1 deletion(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 612213e..493caf5 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -43,7 +43,6 @@ export default class EntryAbility extends UIAbility { } } catch (error) { hilog.error(0x0000, TAG, 'updateBreakpoint catch err:', JSON.stringify(error) ?? ''); - return; } } -- Gitee From b5ac3c468ab17627c5f4f82c283972461fc14401 Mon Sep 17 00:00:00 2001 From: 26thE <962961353@qq.com> Date: Wed, 26 Mar 2025 11:53:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?HMOS=E4=B8=96=E7=95=8C=E6=95=B4=E6=94=B9Sam?= =?UTF-8?q?ple=EF=BC=8C=E6=B5=81=E7=95=85=E5=88=B7=E6=96=87=E7=AB=A0?= =?UTF-8?q?=EF=BC=8CICSL=E6=8E=92=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/entryability/EntryAbility.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 493caf5..0c9ff5b 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -88,7 +88,7 @@ export default class EntryAbility extends UIAbility { AppStorage.setOrCreate('resourceManager', resourceManager); windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { - hilog.error(0x0000, TAG, 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + hilog.error(0x0000, TAG, 'Failed to load the content. Cause:', JSON.stringify(err) ?? ''); return; } hilog.info(0x0000, TAG, 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); -- Gitee