From 8e4c7ed4b0dac0c07cd399a846e475f0479747c2 Mon Sep 17 00:00:00 2001 From: sfchu Date: Wed, 26 Mar 2025 09:27:25 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=AE=9E=E7=8E=B0=E7=94=BB=E4=B8=AD?= =?UTF-8?q?=E7=94=BB=E6=95=88=E6=9E=9C=E3=80=91HMOS=E4=B8=96=E7=95=8C?= =?UTF-8?q?=E9=9B=86=E6=88=90sample=E6=95=B4=E6=94=B9=20CodeCheck+CodeLint?= =?UTF-8?q?er=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 | 32 --------- .../main/resources/base/element/float.json | 8 --- .../main/resources/base/element/integer.json | 68 ------------------- .../main/resources/base/element/string.json | 12 ---- .../main/resources/en_US/element/string.json | 12 ---- .../main/resources/zh_CN/element/string.json | 12 ---- 8 files changed, 17 insertions(+), 157 deletions(-) delete mode 100644 entry/src/main/resources/base/element/float.json diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 45a6302..9cd4f5e 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -25,18 +25,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/module.json5 b/entry/src/main/module.json5 index de78b5c..b2b33b8 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 c211691..0741552 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -4,38 +4,6 @@ "name": "start_window_background", "value": "#FFFFFF" }, - { - "name": "Play_backgroundColor", - "value": "#F9F9F9" - }, - { - "name": "Toggle_fontColor", - "value": "#182431" - }, - { - "name": "Toggle_selectedColor", - "value": "#317aff" - }, - { - "name": "Callback_message_backgroundColor", - "value": "#FFFFFF" - }, - { - "name": "XComponent_backgroundColor", - "value": "#000000" - }, - { - "name": "Text_color", - "value": "#686868" - }, - { - "name": "Message_color", - "value": "#737373" - }, - { - "name": "XComponent_text_color", - "value": "#686868" - }, { "name": "video_background_dark", "value": "#1a1a1a" diff --git a/entry/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json deleted file mode 100644 index e72ba25..0000000 --- a/entry/src/main/resources/base/element/float.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "float": [ - { - "name": "toggle_padding", - "value": "10.75" - } - ] -} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/integer.json b/entry/src/main/resources/base/element/integer.json index dbbc121..a07a641 100644 --- a/entry/src/main/resources/base/element/integer.json +++ b/entry/src/main/resources/base/element/integer.json @@ -1,53 +1,9 @@ { "integer": [ - { - "name": "Navigation_padding", - "value": 5 - }, - { - "name": "x_component_marg_bottom", - "value": 30 - }, - { - "name": "other_padding", - "value": 14 - }, { "name": "auto_pip_height", "value": 56 }, - { - "name": "auto_text_width", - "value": 160 - }, - { - "name": "video1_button_height", - "value": 200 - }, - { - "name": "video1_text_padding", - "value": 310 - }, - { - "name": "video_text_padding", - "value": 120 - }, - { - "name": "control_height", - "value": 79 - }, - { - "name": "callback_text_padding", - "value": 273 - }, - { - "name": "text_height", - "value": 60 - }, - { - "name": "control_button_width", - "value": 149 - }, { "name": "auto_button_height", "value": 20 @@ -55,30 +11,6 @@ { "name": "auto_button_width", "value": 36 - }, - { - "name": "video_button_height", - "value": 150 - }, - { - "name": "video_button_board_radius", - "value": 10 - }, - { - "name": "auto_button_board_radius", - "value": 15 - }, - { - "name": "x_component_marg_top", - "value": 15 - }, - { - "name": "text_size", - "value": 15 - }, - { - "name": "scroll_height", - "value": 30 } ] } \ 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 7cb600d..272977c 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -76,14 +76,6 @@ "name": "pip_effect", "value": "PiP Effect" }, - { - "name": "start", - "value": "Start" - }, - { - "name": "stop", - "value": "Stop" - }, { "name": "auto", "value": "Automatically Start PiP" @@ -104,10 +96,6 @@ "name": "callback_message", "value": "Callback Message" }, - { - "name": "current_video_pip_play", - "value": "Current Video Pip Play" - }, { "name": "current_error_hint", "value": "Without" diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 7cb600d..272977c 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -76,14 +76,6 @@ "name": "pip_effect", "value": "PiP Effect" }, - { - "name": "start", - "value": "Start" - }, - { - "name": "stop", - "value": "Stop" - }, { "name": "auto", "value": "Automatically Start PiP" @@ -104,10 +96,6 @@ "name": "callback_message", "value": "Callback Message" }, - { - "name": "current_video_pip_play", - "value": "Current Video Pip Play" - }, { "name": "current_error_hint", "value": "Without" diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index cf0a634..a06655a 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -76,14 +76,6 @@ "name": "pip_effect", "value": "实现画中画效果" }, - { - "name": "start", - "value": "开启" - }, - { - "name": "stop", - "value": "关闭" - }, { "name": "auto", "value": "自动启动画中画" @@ -104,10 +96,6 @@ "name": "callback_message", "value": "回调信息" }, - { - "name": "current_video_pip_play", - "value": "当前视频正在画中画播放" - }, { "name": "current_error_hint", "value": "无" -- Gitee