From 37d2420a5e543b4c7408e7ede68f83dacb1e8f8b Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:45:33 +0000 Subject: [PATCH 01/15] add watch's bold font type Signed-off-by: zhangcan42 --- resources/rk3568/pages/confirm.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/rk3568/pages/confirm.json b/resources/rk3568/pages/confirm.json index ba57504d..4a68a808 100644 --- a/resources/rk3568/pages/confirm.json +++ b/resources/rk3568/pages/confirm.json @@ -8,7 +8,8 @@ "UILabel": { "bgColor": "#f1f3f5ff", "fontColor": "#000000e6", - "align" : "center" + "align" : "center", + "style" : "normal" }, "UIImageView": { "imgCnt" : 1, -- Gitee From 2a78b8027fbf2c2d4e61bfd3573e7e652d80a9f7 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:47:18 +0000 Subject: [PATCH 02/15] add watch's bold font type Signed-off-by: zhangcan42 --- resources/rk3568/pages/menu.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/rk3568/pages/menu.json b/resources/rk3568/pages/menu.json index c6cbe847..d2b11fba 100644 --- a/resources/rk3568/pages/menu.json +++ b/resources/rk3568/pages/menu.json @@ -22,7 +22,8 @@ "UILabel": { "bgColor": "#f1f3f5ff", "fontColor": "#000000e6", - "align" : "center" + "align" : "center", + "style" : "normal" }, "UIImageView": { "imgCnt" : 1, -- Gitee From ce10c67791b6ad6262c2d3876b1a3d7aa177e1c0 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:48:29 +0000 Subject: [PATCH 03/15] add watch's bold font type Signed-off-by: zhangcan42 --- resources/rk3568/pages/upd.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/rk3568/pages/upd.json b/resources/rk3568/pages/upd.json index 6c07bd2e..ed27e99e 100644 --- a/resources/rk3568/pages/upd.json +++ b/resources/rk3568/pages/upd.json @@ -86,7 +86,8 @@ "UILabel": { "bgColor": "#000000ff", "fontColor": "#ffffffe6", - "align" : "center" + "align" : "center", + "style" : "normal" }, "UIImageView": { "imgCnt" : 1, -- Gitee From 151e01dde04d90b2a13a8b2a32bd06a3856bcb49 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:49:51 +0000 Subject: [PATCH 04/15] add watch's bold font type Signed-off-by: zhangcan42 --- services/ui/updater_ui_traits.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/ui/updater_ui_traits.h b/services/ui/updater_ui_traits.h index 93f820e5..3a971a35 100644 --- a/services/ui/updater_ui_traits.h +++ b/services/ui/updater_ui_traits.h @@ -75,7 +75,8 @@ DEFINE_TRAIT(UxLabelInfo, TextLabelAdapter::COMPONENT_TYPE, (std::string, text), (std::string, align), (std::string, fontColor), - (std::string, bgColor) + (std::string, bgColor), + (std::string, style) ); DEFINE_TRAIT(UxImageInfo, ImgViewAdapter::COMPONENT_TYPE, -- Gitee From ad70105b5847a5112062e089024e559ddba44a18 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:52:19 +0000 Subject: [PATCH 05/15] add watch's bold font type Signed-off-by: zhangcan42 --- services/ui/view/component/text_label_adapter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/ui/view/component/text_label_adapter.cpp b/services/ui/view/component/text_label_adapter.cpp index d7dee593..88ea6068 100644 --- a/services/ui/view/component/text_label_adapter.cpp +++ b/services/ui/view/component/text_label_adapter.cpp @@ -24,7 +24,7 @@ TextLabelAdapter::TextLabelAdapter(const UxViewInfo &info) SetViewCommonInfo(info.commonInfo); this->SetAlign(GetAlign(spec.align), OHOS::TEXT_ALIGNMENT_CENTER); this->SetText(TranslateText(spec.text).c_str()); - this->SetFont(DEFAULT_FONT_FILENAME, spec.fontSize); + this->SetFont((spec.style == "bold") ? BOLD_FONT_FILENAME : DEFAULT_FONT_FILENAME, spec.fontSize); this->SetStyle(OHOS::STYLE_LINE_HEIGHT, UPDATER_UI_FONT_HEIGHT_RATIO * spec.fontSize); auto fontColor = StrToColor(spec.fontColor); this->SetStyle(OHOS::STYLE_TEXT_COLOR, fontColor.full); -- Gitee From b78419c08500129cc14e0a04a728b78b268dfd28 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:53:28 +0000 Subject: [PATCH 06/15] add watch's bold font type Signed-off-by: zhangcan42 --- services/ui/view/component/text_label_adapter.h | 1 + 1 file changed, 1 insertion(+) diff --git a/services/ui/view/component/text_label_adapter.h b/services/ui/view/component/text_label_adapter.h index a0766c49..def8fe53 100644 --- a/services/ui/view/component/text_label_adapter.h +++ b/services/ui/view/component/text_label_adapter.h @@ -26,6 +26,7 @@ struct UxLabelInfo { std::string align; std::string fontColor; std::string bgColor; + std::string style; }; struct UxViewInfo; class TextLabelAdapter : public OHOS::UILabel, public ComponentCommon { -- Gitee From afd9299c0ca07719887fa301dbb1ca833238b2d8 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:55:33 +0000 Subject: [PATCH 07/15] add watch's bold font type Signed-off-by: zhangcan42 --- test/unittest/test_data/ui/layout/all.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unittest/test_data/ui/layout/all.json b/test/unittest/test_data/ui/layout/all.json index 1c7501c9..ba9fd10c 100644 --- a/test/unittest/test_data/ui/layout/all.json +++ b/test/unittest/test_data/ui/layout/all.json @@ -14,7 +14,8 @@ "visible" : true, "fontSize" : 10, "bgColor" : "#ffffffff", - "fontColor" : "#ffffffff" + "fontColor" : "#ffffffff", + "style" : "normal" }, { "id" : "image_view", -- Gitee From 8ed87af36d45a8f3aeceffc46fb2455dc6e91dce Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:56:56 +0000 Subject: [PATCH 08/15] add watch's bold font type Signed-off-by: zhangcan42 --- test/unittest/test_data/ui/layout/commonInvalid.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unittest/test_data/ui/layout/commonInvalid.json b/test/unittest/test_data/ui/layout/commonInvalid.json index eb20ba37..18ec97e9 100644 --- a/test/unittest/test_data/ui/layout/commonInvalid.json +++ b/test/unittest/test_data/ui/layout/commonInvalid.json @@ -8,7 +8,8 @@ "UILabel" : { "bgColor" : "#000000ff", "fontColor" : "#ffffffff", - "align" : "center" + "align" : "center", + "style" : "normal" } }, "coms" : [ -- Gitee From 8f36eb467605c3b6a6f8ffb8f2cada653acb15b0 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:57:59 +0000 Subject: [PATCH 09/15] add watch's bold font type Signed-off-by: zhangcan42 --- test/unittest/test_data/ui/layout/label.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unittest/test_data/ui/layout/label.json b/test/unittest/test_data/ui/layout/label.json index d8d97de0..c202a6b6 100644 --- a/test/unittest/test_data/ui/layout/label.json +++ b/test/unittest/test_data/ui/layout/label.json @@ -15,7 +15,8 @@ "visible" : true, "fontSize" : 10, "bgColor" : "#ffffffff", - "fontColor" : "#ffffffff" + "fontColor" : "#ffffffff", + "style" : "normal" } ] } \ No newline at end of file -- Gitee From 04b422b321e626535c30dda713318a4f1bcd45d3 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 02:59:08 +0000 Subject: [PATCH 10/15] add watch's bold font type Signed-off-by: zhangcan42 --- test/unittest/test_data/ui/layout/menu.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unittest/test_data/ui/layout/menu.json b/test/unittest/test_data/ui/layout/menu.json index daac2ced..8fa63107 100644 --- a/test/unittest/test_data/ui/layout/menu.json +++ b/test/unittest/test_data/ui/layout/menu.json @@ -8,7 +8,8 @@ "UILabel" : { "bgColor" : "#000000ff", "fontColor" : "#ffffffff", - "align" : "center" + "align" : "center", + "style" : "normal" } }, "coms" : [ -- Gitee From 75901bb5108c2406b5b8cc40375afb42f74d9157 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 03:21:34 +0000 Subject: [PATCH 11/15] add watch's bold font type Signed-off-by: zhangcan42 --- test/unittest/test_data/ui/layout/typeInvalid.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unittest/test_data/ui/layout/typeInvalid.json b/test/unittest/test_data/ui/layout/typeInvalid.json index 18355c5b..0b0fe0e8 100644 --- a/test/unittest/test_data/ui/layout/typeInvalid.json +++ b/test/unittest/test_data/ui/layout/typeInvalid.json @@ -8,7 +8,8 @@ "UILabel" : { "bgColor" : "#000000ff", "fontColor" : "#ffffffff", - "align" : "center" + "align" : "center", + "style" : "normal" } }, "coms" : [ -- Gitee From d4754e7bb36886dbfc2b962e8368f58596a26648 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 03:25:29 +0000 Subject: [PATCH 12/15] add watch's bold font type Signed-off-by: zhangcan42 --- .../updater_ui_test/view/ui_component_unittest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/unittest/updater_ui_test/view/ui_component_unittest.cpp b/test/unittest/updater_ui_test/view/ui_component_unittest.cpp index 2d98a8f1..20911d03 100644 --- a/test/unittest/updater_ui_test/view/ui_component_unittest.cpp +++ b/test/unittest/updater_ui_test/view/ui_component_unittest.cpp @@ -310,9 +310,9 @@ HWTEST_F(UpdaterUiComponentUnitTest, test_label_btn_adapter_constructor, TestSiz HWTEST_F(UpdaterUiComponentUnitTest, test_label_btn_adapter_on_press, TestSize.Level0) { - LabelBtnAdapter labelBtn1 {UxViewInfo {{0, 0, 50, 50, "id", "UILabel", true}, + LabelBtnAdapter labelBtn1 {UxViewInfo {{0, 0, 50, 50, "id", "UILabelButton", true}, UxLabelBtnInfo {100, "", "#000000ff", "#ffffffff", "#ffffffff", "#000000ff", true}}}; - LabelBtnAdapter labelBtn2 {UxViewInfo {{100, 100, 50, 50, "id", "UILabel", true}, + LabelBtnAdapter labelBtn2 {UxViewInfo {{100, 100, 50, 50, "id", "UILabelButton", true}, UxLabelBtnInfo {100, "", "#000000ff", "#ffffffff", "#ffffffff", "#000000ff", true}}}; OHOS::FocusManager::GetInstance()->RequestFocus(&labelBtn2); labelBtn1.OnPressEvent(OHOS::PressEvent {OHOS::Point {}}); @@ -337,7 +337,7 @@ HWTEST_F(UpdaterUiComponentUnitTest, test_label_btn_adapter_is_valid, TestSize.L HWTEST_F(UpdaterUiComponentUnitTest, test_label_btn_adapter_set_text, TestSize.Level0) { - LabelBtnAdapter labelBtn {UxViewInfo {{0, 0, 0, 0, "id", "UILabel", false}, + LabelBtnAdapter labelBtn {UxViewInfo {{0, 0, 0, 0, "id", "UILabelButton", false}, UxLabelBtnInfo {100, "", "#000000ff", "#000000ff", "#000000ff", "#000000ff", false}}}; constexpr auto testString = "test text"; labelBtn.SetText(testString); @@ -360,7 +360,7 @@ HWTEST_F(UpdaterUiComponentUnitTest, test_text_label_adapter_is_info_valid, Test HWTEST_F(UpdaterUiComponentUnitTest, test_text_label_adapter_constructor, TestSize.Level0) { constexpr auto labelText = "hello"; - UxLabelInfo specInfo {100, "hello", "center", "#000000ff", "#000000ff"}; + UxLabelInfo specInfo {100, "hello", "center", "#000000ff", "#000000ff", "normal"}; UxViewCommonInfo commonInfo {0, 0, 0, 0, "id", "UILabel", false}; UxViewInfo info {commonInfo, specInfo}; TextLabelAdapter textLabel {info}; @@ -379,7 +379,7 @@ HWTEST_F(UpdaterUiComponentUnitTest, test_text_label_adapter_constructor, TestSi HWTEST_F(UpdaterUiComponentUnitTest, test_text_label_adapter_set_text, TestSize.Level0) { TextLabelAdapter textLabel {UxViewInfo {{0, 0, 0, 0, "id", "UILabel", false}, - UxLabelInfo {255, "", "", "#000000ff", "#000000ff"}}}; + UxLabelInfo {255, "", "", "#000000ff", "#000000ff", "normal"}}}; constexpr auto testString = "test text"; textLabel.SetText(testString); EXPECT_STREQ(textLabel.GetText(), testString); -- Gitee From 209efc69a5f15799440afae16c8caf669bd6eeab Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 03:28:03 +0000 Subject: [PATCH 13/15] add watch's bold font type Signed-off-by: zhangcan42 --- .../unittest/updater_ui_test/view/ui_layout_unittest.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp b/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp index 6ce6d92c..5f719696 100644 --- a/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp +++ b/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp @@ -107,7 +107,8 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_label_parser, TestSize.Level0) "Reboot to normal system", "center", "#ffffffff", - "#ffffffff" + "#ffffffff", + "normal" } }; EXPECT_EQ(pageInfo.viewInfos[0], expectedLabel); } @@ -149,7 +150,8 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_all, TestSize.Level1) "Reboot to normal system", "center", "#ffffffff", - "#ffffffff" + "#ffffffff", + "normal" } }; EXPECT_EQ(pageInfo.viewInfos[0], expectedLabel); @@ -177,7 +179,8 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_all_default, TestSize.Level0) "Reboot to normal system", "center", "#ffffffff", - "#000000ff" + "#000000ff", + "normal" } }; expected.commonInfo.visible = false; EXPECT_EQ(expected.commonInfo, pageInfo.viewInfos[0].commonInfo); -- Gitee From 944ca3a3fbf4738c4506a5bbcad98346b58ef1bb Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 03:31:42 +0000 Subject: [PATCH 14/15] add watch's bold font type Signed-off-by: zhangcan42 --- .../updater_ui_test/view/ui_page_manager_unittest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/unittest/updater_ui_test/view/ui_page_manager_unittest.cpp b/test/unittest/updater_ui_test/view/ui_page_manager_unittest.cpp index 2d486506..5466d498 100644 --- a/test/unittest/updater_ui_test/view/ui_page_manager_unittest.cpp +++ b/test/unittest/updater_ui_test/view/ui_page_manager_unittest.cpp @@ -74,7 +74,7 @@ const std::vector UpdaterUiPageManagerUnitTest::pageInfos_ = { UxViewCommonInfo { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { - 50, "this is page1", "center", "#ff0000ff", "#000000ff"}}, + 50, "this is page1", "center", "#ff0000ff", "#000000ff", "normal"}}, UxViewInfo { UxViewCommonInfo { 300, 700, 400, 400, "image_view", "UIImageView", false}, @@ -90,7 +90,7 @@ const std::vector UpdaterUiPageManagerUnitTest::pageInfos_ = { UxViewCommonInfo { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { - 50, "this is page2", "center", "#00ff00ff", "#000000ff"}}, + 50, "this is page2", "center", "#00ff00ff", "#000000ff", "normal"}}, UxViewInfo { UxViewCommonInfo { 300, 700, 400, 400, "image_view", "UIImageView", false}, @@ -105,7 +105,7 @@ const std::vector UpdaterUiPageManagerUnitTest::pageInfos_ = { UxViewCommonInfo { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { - 50, "this is page2", "center", "#0000ffff", "#000000ff"}}, + 50, "this is page2", "center", "#0000ffff", "#000000ff", "normal"}}, UxViewInfo { UxViewCommonInfo { 300, 700, 400, 400, "image_view", "UIImageView", false}, @@ -142,7 +142,7 @@ HWTEST_F(UpdaterUiPageManagerUnitTest, test_page_manager_init_failed, TestSize.L UxViewCommonInfo { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { - 50, "this is page1", "center", "#ff0ff", "#0"}}}, {}} + 50, "this is page1", "center", "#ff0ff", "#0", "normal"}}}, {}} }; EXPECT_FALSE(GetInstance().Init(pageInfo, "page1")); } @@ -156,7 +156,7 @@ HWTEST_F(UpdaterUiPageManagerUnitTest, test_page_manager_init_failed, TestSize.L UxViewCommonInfo { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { - 50, "this is page1", "center", "#000000ff", "#000000ff"}}}, + 50, "this is page1", "center", "#000000ff", "#000000ff", "normal"}}}, {{UxSubPageInfo {"", "#000000ff", {"label_id_0"}}}}}}; EXPECT_FALSE(GetInstance().Init(pageInfo, "page1")); -- Gitee From 0f7406ad4fd216fedbfb0ec8d247ef2bbaf88cd7 Mon Sep 17 00:00:00 2001 From: zhangcan42 Date: Fri, 20 Dec 2024 03:37:32 +0000 Subject: [PATCH 15/15] add watch's bold font type Signed-off-by: zhangcan42 --- services/ui/include/updater_ui_const.h | 1 + 1 file changed, 1 insertion(+) diff --git a/services/ui/include/updater_ui_const.h b/services/ui/include/updater_ui_const.h index 96a964d3..570890de 100644 --- a/services/ui/include/updater_ui_const.h +++ b/services/ui/include/updater_ui_const.h @@ -18,6 +18,7 @@ namespace Updater { constexpr const char *DEFAULT_FONT_FILENAME = "HarmonyOS_Sans_SC_Regular_Small.ttf"; +constexpr const char *BOLD_FONT_FILENAME = "HarmonyOS_Sans_SC_Bold_Small.ttf"; constexpr const char *FB_DEV_PATH = "/dev/graphics/fb0"; constexpr const char *DRM_DEV_PATH = "/dev/dri/card0"; -- Gitee