From f40697f7e87b41ed860025c53dec29d731b5580a Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 26 Mar 2025 09:21:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E5=9F=BA=E4=BA=8E=E9=A2=84?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E6=8A=80=E6=9C=AF=E5=AE=9E=E7=8E=B0Web?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9E=AC=E5=BC=80=E6=95=88=E6=9E=9C=E3=80=91?= =?UTF-8?q?HMOS=E4=B8=96=E7=95=8C=E9=9B=86=E6=88=90sample=E6=95=B4?= =?UTF-8?q?=E6=94=B9=20CodeCheck+CodeLinter=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 | 28 ++++++++------- entry/src/main/module.json5 | 2 +- .../main/resources/base/element/color.json | 8 ----- .../main/resources/base/element/string.json | 36 ++----------------- .../main/resources/en_US/element/string.json | 32 ----------------- .../main/resources/zh_CN/element/string.json | 32 ----------------- 6 files changed, 19 insertions(+), 119 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 242952c..2217507 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -26,18 +26,22 @@ 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 = 'sm'; - } else if (windowWidthVp < 840) { - newBp = 'md'; - } else { - newBp = 'lg'; - } - if (this.curBp !== newBp) { - this.curBp = newBp; - AppStorage.setOrCreate('currentBreakpoint', this.curBp); + try { + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let newBp: string = ''; + if (windowWidthVp < 600) { + newBp = 'sm'; + } else if (windowWidthVp < 840) { + newBp = 'md'; + } else { + newBp = 'lg'; + } + if (this.curBp !== newBp) { + this.curBp = newBp; + AppStorage.setOrCreate('currentBreakpoint', this.curBp); + } + } catch (error) { + hilog.info(0x0000, 'updateBreakpoint', '%{public}s', `updateBreakpoint fail, err: ${JSON.stringify(error)}`); } } diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 12c7cc2..428fff8 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -21,7 +21,7 @@ "label": "$string:EntryAbility_label", "startWindowIcon": "$media:startIcon", "startWindowBackground": "$color:start_window_background", - "exported": true, + "exported": false, "skills": [ { "entities": [ diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json index 6e031c4..3c71296 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -3,14 +3,6 @@ { "name": "start_window_background", "value": "#FFFFFF" - }, - { - "name": "title_color", - "value": "#E6000000" - }, - { - "name": "back_color", - "value": "#F1F3F5" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index d756158..4fa1acd 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -24,45 +24,13 @@ "name": "full_height_width", "value": "100%" }, - { - "name": "width_percentage_ninety", - "value": "91%" - }, - { - "name": "height_large", - "value": "110%" - }, - { - "name": "title_size", - "value": "30fp" - }, - { - "name": "text_size", - "value": "16fp" - }, - { - "name": "title_padding_top_bot", - "value": "8vp" - }, - { - "name": "title_padding_left_right", - "value": "12vp" - }, - { - "name": "row_padding", - "value": "15vp" - }, { "name": "index_tab", - "value": "56vp" - }, - { - "name": "row_top", - "value": "18vp" + "value": "72vp" }, { "name": "reason_internet", - "value": "Used for instant page loading effects in web scenarios" + "value": "用于Web页面的瞬开效果场景" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 1e40065..37f8903 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -24,42 +24,10 @@ "name": "full_height_width", "value": "100%" }, - { - "name": "width_percentage_ninety", - "value": "91%" - }, - { - "name": "height_large", - "value": "110%" - }, - { - "name": "title_size", - "value": "30fp" - }, - { - "name": "text_size", - "value": "16fp" - }, - { - "name": "title_padding_top_bot", - "value": "8vp" - }, - { - "name": "title_padding_left_right", - "value": "12vp" - }, - { - "name": "row_padding", - "value": "12vp" - }, { "name": "index_tab", "value": "56vp" }, - { - "name": "row_top", - "value": "18vp" - }, { "name": "reason_internet", "value": "Used for instant page loading effects in web scenarios" diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index ff4f1bd..4fa1acd 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -24,42 +24,10 @@ "name": "full_height_width", "value": "100%" }, - { - "name": "width_percentage_ninety", - "value": "91%" - }, - { - "name": "height_large", - "value": "110%" - }, - { - "name": "title_size", - "value": "30fp" - }, - { - "name": "text_size", - "value": "16fp" - }, - { - "name": "title_padding_top_bot", - "value": "8vp" - }, - { - "name": "title_padding_left_right", - "value": "12vp" - }, - { - "name": "row_padding", - "value": "15vp" - }, { "name": "index_tab", "value": "72vp" }, - { - "name": "row_top", - "value": "18vp" - }, { "name": "reason_internet", "value": "用于Web页面的瞬开效果场景" -- Gitee From 60bca52e9f762adf6f6d248248e69abc241ac5e6 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 26 Mar 2025 10:18:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E5=9F=BA=E4=BA=8E=E9=A2=84?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E6=8A=80=E6=9C=AF=E5=AE=9E=E7=8E=B0Web?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9E=AC=E5=BC=80=E6=95=88=E6=9E=9C=E3=80=91?= =?UTF-8?q?HMOS=E4=B8=96=E7=95=8C=E9=9B=86=E6=88=90sample=E6=95=B4?= =?UTF-8?q?=E6=94=B9=20CodeCheck+CodeLinter=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/resources/base/element/string.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 4fa1acd..af7e1aa 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -26,11 +26,11 @@ }, { "name": "index_tab", - "value": "72vp" + "value": "56vp" }, { "name": "reason_internet", - "value": "用于Web页面的瞬开效果场景" + "value": "Used for instant page loading effects in web scenarios" } ] } \ No newline at end of file -- Gitee