From 2626ec81fb47a3c85b61607e2a03a1a1df1e7b33 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 26 Mar 2025 09:35:38 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=95=B0=E6=8D=AE=E5=BA=93=E7=9A=84?= =?UTF-8?q?=E5=A4=87=E4=BB=BD=E4=B8=8E=E6=81=A2=E5=A4=8D=E3=80=91HMOS?= =?UTF-8?q?=E4=B8=96=E7=95=8C=E9=9B=86=E6=88=90sample=E6=95=B4=E6=94=B9=20?= =?UTF-8?q?CodeCheck+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/ets/pages/Index.ets | 1 - entry/src/main/module.json5 | 2 +- .../main/resources/base/element/color.json | 7 -- .../main/resources/base/element/dimen.json | 108 ------------------ .../main/resources/base/element/string.json | 8 -- .../main/resources/en_US/element/string.json | 8 -- .../main/resources/zh_CN/element/string.json | 8 -- 8 files changed, 17 insertions(+), 153 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 11c1583..e5093a0 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -24,18 +24,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.error(0x0000, 'EntryAbility', 'updateBreakpoint catch err:', JSON.stringify(error) ?? ''); } } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 5ad975d..fdbaeba 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -19,7 +19,6 @@ import dbUtils from '../common/utils/DBUtils'; import { User } from '../viewmodel/UserInfo'; import { ProgressDialog } from '../view/ProgressDialog'; - @Entry @Component struct Index { diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 6c07d9d..4ce1318 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 7feb0bc..9a6927a 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -4,10 +4,6 @@ "name": "start_window_background", "value": "#F1F3F5" }, - { - "name": "input_background", - "value": "#FFFFFF" - }, { "name": "rollback_background", "value": "#0D000000" @@ -16,8 +12,5 @@ "name": "font_color", "value": "#0A59F7" } - - - ] } \ No newline at end of file diff --git a/entry/src/main/resources/base/element/dimen.json b/entry/src/main/resources/base/element/dimen.json index 1475a58..4cdd627 100644 --- a/entry/src/main/resources/base/element/dimen.json +++ b/entry/src/main/resources/base/element/dimen.json @@ -1,21 +1,9 @@ { "float": [ - { - "name": "default_22", - "value": "22vp" - }, { "name": "default_24", "value": "24vp" }, - { - "name": "default_294", - "value": "294vp" - }, - { - "name": "default_312", - "value": "312vp" - }, { "name": "default_40", "value": "40vp" @@ -24,98 +12,18 @@ "name": "default_16", "value": "16vp" }, - { - "name": "default_13", - "value": "13vp" - }, { "name": "default_336", "value": "336vp" }, - { - "name": "default_8", - "value": "8vp" - }, - { - "name": "default_139", - "value": "139vp" - }, - { - "name": "default_20", - "value": "20vp" - }, - { - "name": "default_100", - "value": "100vp" - }, - { - "name": "default_48", - "value": "48vp" - }, - { - "name": "default_147", - "value": "147vp" - }, - { - "name": "default_10", - "value": "10vp" - }, - { - "name": "default_223", - "value": "223vp" - }, - { - "name": "default_302", - "value": "302vp" - }, - { - "name": "default_213", - "value": "213vp" - }, - { - "name": "default_120", - "value": "120vp" - }, - { - "name": "default_251", - "value": "251vp" - }, - { - "name": "default_41", - "value": "41vp" - }, - { - "name": "default_30", - "value": "30vp" - }, - { - "name": "default_7", - "value": "7vp" - }, - { - "name": "default_360", - "value": "360vp" - }, { "name": "default_56", "value": "56vp" }, - { - "name": "default_680", - "value": "680vp" - }, - { - "name": "default_200", - "value": "200vp" - }, { "name": "default_12", "value": "12vp" }, - { - "name": "default_32", - "value": "32vp" - }, { "name": "default_150", "value": "120vp" @@ -124,18 +32,10 @@ "name": "default_176", "value": "176vp" }, - { - "name": "default_288", - "value": "288vp" - }, { "name": "default_14", "value": "14vp" }, - { - "name": "default_256", - "value": "230vp" - }, { "name": "default_29", "value": "29vp" @@ -167,14 +67,6 @@ { "name": "default_font_14", "value": "14fp" - }, - { - "name": "default_font_24", - "value": "24fp" - }, - { - "name": "default_font_20", - "value": "20fp" } ] } \ 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 0390cab..abead86 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -12,14 +12,6 @@ "name": "EntryAbility_label", "value": "DataBaseUpgrade" }, - { - "name": "Update_failed", - "value": "Update failed." - }, - { - "name": "Sequence_diagram", - "value": "sequence diagram" - }, { "name": "input_field", "value": "Field Name" diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 0390cab..abead86 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -12,14 +12,6 @@ "name": "EntryAbility_label", "value": "DataBaseUpgrade" }, - { - "name": "Update_failed", - "value": "Update failed." - }, - { - "name": "Sequence_diagram", - "value": "sequence diagram" - }, { "name": "input_field", "value": "Field Name" diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index 753b21e..92cace5 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -12,14 +12,6 @@ "name": "EntryAbility_label", "value": "数据库升级" }, - { - "name": "Update_failed", - "value": "更新失败" - }, - { - "name": "Sequence_diagram", - "value": "顺序图" - }, { "name": "input_field", "value": "字段名" -- Gitee