From 1ab4572469c06e88f0104478c7f7b12b8630fe09 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 06:51:36 +0000 Subject: [PATCH 01/22] update resources/rk3568/pages/confirm.json. Signed-off-by: bluesky_wang --- resources/rk3568/pages/confirm.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/rk3568/pages/confirm.json b/resources/rk3568/pages/confirm.json index 71b69b9f..9cfc8183 100644 --- a/resources/rk3568/pages/confirm.json +++ b/resources/rk3568/pages/confirm.json @@ -10,9 +10,12 @@ "fontColor": "#000000e6", "align" : "center", "style" : "normal", - "focusedBgColor": "#f1f3f5ff", - "focusedFontColor": "#000000e6", - "focusable" : false, + "focusInfo": { + "focusedBgColor": "#f1f3f5ff", + "focusedFontColor": "#000000e6", + "focusable" : false + }, + "touchable" : false, "lineBreakMode" : "ellipsis" }, "UIImageView": { -- Gitee From 659cd2dfe90cc1fcf99dddf1daaa7a3db742694e Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 06:52:48 +0000 Subject: [PATCH 02/22] update resources/rk3568/pages/menu.json. Signed-off-by: bluesky_wang --- resources/rk3568/pages/menu.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/rk3568/pages/menu.json b/resources/rk3568/pages/menu.json index 078c2747..df0f9beb 100644 --- a/resources/rk3568/pages/menu.json +++ b/resources/rk3568/pages/menu.json @@ -24,9 +24,12 @@ "fontColor": "#000000e6", "align" : "center", "style": "normal", - "focusedBgColor": "#f1f3f5ff", - "focusedFontColor": "#000000e6", - "focusable": false, + "focusInfo": { + "focusedBgColor": "#f1f3f5ff", + "focusedFontColor": "#000000e6", + "focusable": false + }, + "touchable": false, "lineBreakMode" : "ellipsis" }, "UIImageView": { -- Gitee From 9a4ac9f43d4e24d9b5b15691f1d2a677705175c6 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 06:54:25 +0000 Subject: [PATCH 03/22] update resources/rk3568/pages/upd.json. Signed-off-by: bluesky_wang --- resources/rk3568/pages/upd.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/rk3568/pages/upd.json b/resources/rk3568/pages/upd.json index ba88fe0f..0d14f831 100644 --- a/resources/rk3568/pages/upd.json +++ b/resources/rk3568/pages/upd.json @@ -88,9 +88,12 @@ "fontColor": "#ffffffe6", "align" : "center", "style" : "normal", - "focusedBgColor": "#000000ff", - "focusedFontColor": "#ffffffe6", - "focusable": false, + "focusInfo": { + "focusedBgColor": "#000000ff", + "focusedFontColor": "#ffffffe6", + "focusable": false + }, + "touchable": false, "lineBreakMode" : "ellipsis" }, "UIImageView": { -- Gitee From 8e224136842529f6e2bb80a23bb97a11db2a62d4 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 06:58:46 +0000 Subject: [PATCH 04/22] update services/ui/control/event_listener.cpp. Signed-off-by: bluesky_wang --- services/ui/control/event_listener.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/services/ui/control/event_listener.cpp b/services/ui/control/event_listener.cpp index 0f7ce6b8..674f3a9d 100644 --- a/services/ui/control/event_listener.cpp +++ b/services/ui/control/event_listener.cpp @@ -80,31 +80,13 @@ void CallBackDecorator::CallbackWithGuard(Callback cb, OHOS::UIView &view) } } -bool LabelOnEventListener::OnClick(OHOS::UIView &view, [[maybe_unused]] const OHOS::ClickEvent &event) +bool LabelOnTouchListener::OnRelease(OHOS::UIView &view, [[maybe_unused]] const OHOS::ReleaseEvent &event) { + // wrap cb_ with CallBackDecorator, then call operator()() CallBackDecorator{cb_}(view, cb_.isAsync); return isConsumed_; } -bool LabelOnEventListener::OnPress(OHOS::UIView &view, [[maybe_unused]] const OHOS::PressEvent &event) -{ - KeyListener::SetButtonPressed(true); - return true; -} - -bool LabelOnEventListener::OnRelease(OHOS::UIView &view, [[maybe_unused]] const OHOS::ReleaseEvent &event) -{ - KeyListener::SetButtonPressed(false); - CallBackDecorator{cb_}(view, cb_.isAsync); - return isConsumed_; -} - -bool LabelOnEventListener::OnCancel(OHOS::UIView &view, [[maybe_unused]] const OHOS::CancelEvent &event) -{ - KeyListener::SetButtonPressed(false); - return true; -} - bool BtnOnEventListener::OnClick(OHOS::UIView &view, [[maybe_unused]] const OHOS::ClickEvent &event) { CallBackDecorator{cb_}(view, cb_.isAsync); @@ -188,7 +170,9 @@ bool KeyListener::ProcessPowerKey(OHOS::UIView &view, const OHOS::KeyEvent &even if (event.GetState() == OHOS::InputDevice::STATE_PRESS) { LOG(DEBUG) << "OnPress"; pView->OnClickEvent(OHOS::Point { centerX, centerY }); - } + } else if (event.GetState() == OHOS::InputDevice::STATE_RELEASE) { + LOG(DEBUG) << "OnRelease"; + pView->OnReleaseEvent(OHOS::Point { centerX, centerY }); #endif return true; } -- Gitee From a0b45a99e80e2b61f983f5bed32f6e299006176e Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:02:23 +0000 Subject: [PATCH 05/22] update services/ui/control/event_listener.h. Signed-off-by: bluesky_wang --- services/ui/control/event_listener.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/services/ui/control/event_listener.h b/services/ui/control/event_listener.h index 969dee84..1fb01d96 100644 --- a/services/ui/control/event_listener.h +++ b/services/ui/control/event_listener.h @@ -45,15 +45,12 @@ private: static std::mutex mtx_; }; -class LabelOnEventListener final : public OHOS::UIView::OnClickListener, public OHOS::UIView::OnTouchListener { +class LabelOnTouchListener final : public OHOS::UIView::OnTouchListener { public: - LabelOnEventListener(Callback cb, bool isConsumed) + LabelOnTouchListener(Callback cb, bool isConsumed) : cb_(cb), isConsumed_(isConsumed) {} - ~LabelOnEventListener() = default; - bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override; - bool OnPress(OHOS::UIView &view, const OHOS::PressEvent &event) override; + ~LabelOnTouchListener() = default; bool OnRelease(OHOS::UIView &view, const OHOS::ReleaseEvent &event) override; - bool OnCancel(OHOS::UIView &view, const OHOS::CancelEvent &event) override; private: Callback cb_; -- Gitee From 060c77c3cbfd1eb1dd46de33d099c04cacb66ef2 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:04:48 +0000 Subject: [PATCH 06/22] update services/ui/control/event_manager.cpp. Signed-off-by: bluesky_wang --- services/ui/control/event_manager.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/services/ui/control/event_manager.cpp b/services/ui/control/event_manager.cpp index 43839c19..fccf3662 100644 --- a/services/ui/control/event_manager.cpp +++ b/services/ui/control/event_manager.cpp @@ -38,21 +38,15 @@ EventManager &EventManager::GetInstance() return instance; } -void EventManager::Add(const ComInfo &viewId, std::unique_ptr listener) +void EventManager::Add(const ComInfo &viewId, std::unique_ptr listener) { if (!pgMgr_.IsValidCom(viewId)) { LOG(ERROR) << "not an valid view " << viewId; return; } auto com = pgMgr_[viewId.pageId][viewId.comId].As(); - // both click and touch listener - LabelOnEventListener *labelListener = listener.get(); - // save this listener - labelOnClickListener_.push_back(std::move(listener)); - com->SetOnClickListener(labelListener); - // this touch listener used to disable volume key when pressing button - com->SetTouchable(true); - com->SetOnTouchListener(labelListener); + labelOnTouchListener_.push_back(std::move(listener)); + com->SetOnTouchListener(labelOnTouchListener_.back().get()); } void EventManager::Add(const ComInfo &viewId, std::unique_ptr listener) @@ -94,10 +88,9 @@ void EventManager::Add(const ComInfo &viewId, EventType evt, Callback cb) switch (evt) { case EventType::CLICKEVENT: Add(viewId, std::make_unique(cb, true)); - Add(viewId, std::make_unique(cb, true)); break; case EventType::TOUCHEVENT: - Add(viewId, std::make_unique(cb, true)); + Add(viewId, std::make_unique(cb, true)); break; case EventType::DRAGEVENT: Add(viewId, std::make_unique(cb, true)); -- Gitee From a7fbf733614d13669e59e6bacfdbaa9f6d798a0b Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:05:43 +0000 Subject: [PATCH 07/22] update services/ui/control/event_manager.h. Signed-off-by: bluesky_wang --- services/ui/control/event_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/ui/control/event_manager.h b/services/ui/control/event_manager.h index 4a13f3e2..9165b961 100644 --- a/services/ui/control/event_manager.h +++ b/services/ui/control/event_manager.h @@ -32,7 +32,7 @@ public: EventManager(); ~EventManager() = default; static EventManager &GetInstance(); - void Add(const ComInfo &viewId, std::unique_ptr listener); + void Add(const ComInfo &viewId, std::unique_ptr listener); void Add(const ComInfo &viewId, std::unique_ptr listener); void Add(const ComInfo &viewId, std::unique_ptr listener); void Add(const ComInfo &viewId, EventType evt, Callback cb); @@ -40,7 +40,7 @@ public: private: PageManager &pgMgr_; std::unique_ptr helper_ {}; - std::vector> labelOnClickListener_; + std::vector> labelOnTouchListener_; std::vector> btnOnClickListener_; std::vector> btnOnDragListener; }; -- Gitee From dc78419354a6ee4dde8217022ae443fdaa12786a Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:07:23 +0000 Subject: [PATCH 08/22] update services/ui/updater_ui_traits.h. Signed-off-by: bluesky_wang --- services/ui/updater_ui_traits.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/ui/updater_ui_traits.h b/services/ui/updater_ui_traits.h index 474b3285..74de8dd4 100644 --- a/services/ui/updater_ui_traits.h +++ b/services/ui/updater_ui_traits.h @@ -77,9 +77,8 @@ DEFINE_TRAIT(UxLabelInfo, TextLabelAdapter::COMPONENT_TYPE, (std::string, fontColor), (std::string, bgColor), (std::string, style), - (std::string, focusedFontColor), - (std::string, focusedBgColor), - (bool, focusable), + (LabelFocusInfo, focusInfo), + (bool, touchable), (std::string, lineBreakMode) ); -- Gitee From 9bbf292a204795f650e2b3fa023147115b94282c Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:09:23 +0000 Subject: [PATCH 09/22] update services/ui/view/component/text_label_adapter.cpp. Signed-off-by: bluesky_wang --- services/ui/view/component/text_label_adapter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/ui/view/component/text_label_adapter.cpp b/services/ui/view/component/text_label_adapter.cpp index 5c94d9ee..4f21ccad 100644 --- a/services/ui/view/component/text_label_adapter.cpp +++ b/services/ui/view/component/text_label_adapter.cpp @@ -83,13 +83,14 @@ TextLabelAdapter::TextLabelAdapter(const UxViewInfo &info) auto bgColor = StrToColor(spec.bgColor); this->SetStyle(OHOS::STYLE_BACKGROUND_COLOR, bgColor.full); this->SetStyle(OHOS::STYLE_BACKGROUND_OPA, bgColor.alpha); - if (spec.focusable) { + this->SetTouchable(spec.touchable); + if (spec.focusInfo.focusable) { LOG(DEBUG) << "init focus listener for " << viewId_; - InitFocus(fontColor, bgColor, StrToColor(spec.focusedFontColor), - StrToColor(spec.focusedBgColor)); + InitFocus(fontColor, bgColor, StrToColor(spec.focusInfo.focusedFontColor), + StrToColor(spec.focusInfo.focusedBgColor)); + this->SetTouchable(true); } else { this->SetFocusable(false); - this->SetTouchable(false); } if (spec.lineBreakMode == "marquee") { -- Gitee From a46ab6a2f741457ff4cb445b109dd1efbebdc895 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:11:48 +0000 Subject: [PATCH 10/22] update services/ui/view/component/text_label_adapter.h. Signed-off-by: bluesky_wang --- services/ui/view/component/text_label_adapter.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/services/ui/view/component/text_label_adapter.h b/services/ui/view/component/text_label_adapter.h index caabeb31..5c5ec983 100644 --- a/services/ui/view/component/text_label_adapter.h +++ b/services/ui/view/component/text_label_adapter.h @@ -17,9 +17,16 @@ #include "component_common.h" #include "components/ui_label.h" +#include "json_visitor.h" #include "macros_updater.h" namespace Updater { +DEFINE_STRUCT_TRAIT(LabelFocusInfo, "", + (std::string, focusedFontColor), + (std::string, focusedBgColor), + (bool, focusable) +); + struct UxLabelInfo { uint8_t fontSize; std::string text; @@ -27,9 +34,8 @@ struct UxLabelInfo { std::string fontColor; std::string bgColor; std::string style; - std::string focusedFontColor; - std::string focusedBgColor; - bool focusable; + LabelFocusInfo focusInfo; + bool touchable; std::string lineBreakMode; }; struct UxViewInfo; -- Gitee From 17eeb05ac9f913b2aa419d6caed8886d2b0ea1fd Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:14:09 +0000 Subject: [PATCH 11/22] update test/unittest/test_data/ui/layout/all.json. Signed-off-by: bluesky_wang --- test/unittest/test_data/ui/layout/all.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unittest/test_data/ui/layout/all.json b/test/unittest/test_data/ui/layout/all.json index 36f327d4..58dc3182 100644 --- a/test/unittest/test_data/ui/layout/all.json +++ b/test/unittest/test_data/ui/layout/all.json @@ -16,9 +16,12 @@ "bgColor" : "#ffffffff", "fontColor" : "#ffffffff", "style" : "normal", - "focusedBgColor" : "#ffffffff", - "focusedFontColor" : "#ffffffff", - "focusable" : false, + "focusInfo" : { + "focusedBgColor" : "#ffffffff", + "focusedFontColor" : "#ffffffff", + "focusable" : false + }, + "touchable" : false, "lineBreakMode" : "ellipsis" }, { -- Gitee From c8176041040b8cd7785d6cb152a3199f61cc49ae Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:15:23 +0000 Subject: [PATCH 12/22] update test/unittest/test_data/ui/layout/commonInvalid.json. Signed-off-by: bluesky_wang --- test/unittest/test_data/ui/layout/commonInvalid.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unittest/test_data/ui/layout/commonInvalid.json b/test/unittest/test_data/ui/layout/commonInvalid.json index 883862c0..722bf9f4 100644 --- a/test/unittest/test_data/ui/layout/commonInvalid.json +++ b/test/unittest/test_data/ui/layout/commonInvalid.json @@ -10,9 +10,12 @@ "fontColor" : "#ffffffff", "align" : "center", "style" : "normal", - "focusedBgColor" : "#000000ff", - "focusedFontColor" : "#ffffffff", - "focusable" : false, + "focusInfo" : { + "focusedBgColor" : "#000000ff", + "focusedFontColor" : "#ffffffff", + "focusable" : false + }, + "touchable" : false, "lineBreakMode" : "ellipsis" } }, -- Gitee From 3c3b1b7bbe736c180b7e020b23c7769aceea1d87 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:16:29 +0000 Subject: [PATCH 13/22] update test/unittest/test_data/ui/layout/label.json. Signed-off-by: bluesky_wang --- test/unittest/test_data/ui/layout/label.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unittest/test_data/ui/layout/label.json b/test/unittest/test_data/ui/layout/label.json index 0e586368..787d9c9a 100644 --- a/test/unittest/test_data/ui/layout/label.json +++ b/test/unittest/test_data/ui/layout/label.json @@ -17,9 +17,12 @@ "bgColor" : "#ffffffff", "fontColor" : "#ffffffff", "style" : "normal", - "focusedBgColor" : "#ffffffff", - "focusedFontColor" : "#ffffffff", - "focusable" : false, + "focusInfo" : { + "focusedBgColor" : "#ffffffff", + "focusedFontColor" : "#ffffffff", + "focusable" : false + }, + "touchable" : false, "lineBreakMode" : "ellipsis" } ] -- Gitee From 9d3779dbb2ad46bf0dc5cae9089c33f02138f3f8 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:17:45 +0000 Subject: [PATCH 14/22] update test/unittest/test_data/ui/layout/menu.json. Signed-off-by: bluesky_wang --- test/unittest/test_data/ui/layout/menu.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unittest/test_data/ui/layout/menu.json b/test/unittest/test_data/ui/layout/menu.json index c202d46c..83cb40c4 100644 --- a/test/unittest/test_data/ui/layout/menu.json +++ b/test/unittest/test_data/ui/layout/menu.json @@ -10,9 +10,12 @@ "fontColor" : "#ffffffff", "align" : "center", "style" : "normal", - "focusedBgColor" : "#000000ff", - "focusedFontColor" : "#ffffffff", - "focusable" : false, + "focusInfo" : { + "focusedBgColor" : "#000000ff", + "focusedFontColor" : "#ffffffff", + "focusable" : false + }, + "touchable" : false, "lineBreakMode" : "ellipsis" } }, -- Gitee From 89846ab345152a5fc40b59a0ea5529e73f885231 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:21:49 +0000 Subject: [PATCH 15/22] update test/unittest/test_data/ui/layout/typeInvalid.json. Signed-off-by: bluesky_wang --- test/unittest/test_data/ui/layout/typeInvalid.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/unittest/test_data/ui/layout/typeInvalid.json b/test/unittest/test_data/ui/layout/typeInvalid.json index 1e5dfdaa..637732e8 100644 --- a/test/unittest/test_data/ui/layout/typeInvalid.json +++ b/test/unittest/test_data/ui/layout/typeInvalid.json @@ -10,9 +10,12 @@ "fontColor" : "#ffffffff", "align" : "center", "style" : "normal", - "focusedBgColor" : "#000000ff", - "focusedFontColor" : "#ffffffff", - "focusable" : false, + "focusInfo" : { + "focusedBgColor" : "#000000ff", + "focusedFontColor" : "#ffffffff", + "focusable" : false + }, + "touchable" : false, "lineBreakMode" : "ellipsis" } }, -- Gitee From 4d8ff7e19ac06a0f00beb34324fc6f6d334ca973 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:24:46 +0000 Subject: [PATCH 16/22] update test/unittest/updater_ui_test/view/ui_component_unittest.cpp. Signed-off-by: bluesky_wang --- test/unittest/updater_ui_test/view/ui_component_unittest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 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 69de97b8..0b85ae39 100644 --- a/test/unittest/updater_ui_test/view/ui_component_unittest.cpp +++ b/test/unittest/updater_ui_test/view/ui_component_unittest.cpp @@ -361,7 +361,7 @@ HWTEST_F(UpdaterUiComponentUnitTest, test_text_label_adapter_constructor, TestSi { constexpr auto labelText = "hello"; UxLabelInfo specInfo {100, "hello", "center", "#000000ff", "#000000ff", "normal", - "#000000ff", "#000000ff", false, "ellipsis"}; + {"#000000ff", "#000000ff", false}, false, "ellipsis"}; UxViewCommonInfo commonInfo {0, 0, 0, 0, "id", "UILabel", false}; UxViewInfo info {commonInfo, specInfo}; TextLabelAdapter textLabel {info}; @@ -381,7 +381,7 @@ HWTEST_F(UpdaterUiComponentUnitTest, test_text_label_adapter_set_text, TestSize. { TextLabelAdapter textLabel {UxViewInfo {{0, 0, 0, 0, "id", "UILabel", false}, UxLabelInfo {255, "", "", "#000000ff", "#000000ff", "normal", - "#000000ff", "#000000ff", false, "ellipsis"}}}; + {"#000000ff", "#000000ff", false}, false, "ellipsis"}}}; constexpr auto testString = "test text"; textLabel.SetText(testString); EXPECT_STREQ(textLabel.GetText(), testString); -- Gitee From c4a12f9c31858ddc2c6fcddba1a6148d40df17da Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:27:00 +0000 Subject: [PATCH 17/22] update test/unittest/updater_ui_test/view/ui_layout_unittest.cpp. Signed-off-by: bluesky_wang --- test/unittest/updater_ui_test/view/ui_layout_unittest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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 8717fe4a..e46bbfb4 100644 --- a/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp +++ b/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp @@ -109,7 +109,9 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_label_parser, TestSize.Level0) "#ffffffff", "#ffffffff", "normal", + {"#ffffffff", "#ffffffff", + false}, "#ffffffff", false, "ellipsis" @@ -155,7 +157,9 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_all, TestSize.Level1) "center", "#ffffffff", "#ffffffff", + {"#ffffffff", "normal", + false}, "#ffffffff", "#ffffffff", false, @@ -187,7 +191,9 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_all_default, TestSize.Level0) "Reboot to normal system", "center", "#ffffffff", + {"#ffffffff", "#000000ff", + false}, "normal", "#ffffffff", "#000000ff", -- Gitee From e209ad1d1d19c04fdfec5b97cea906d2628b5320 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:29:00 +0000 Subject: [PATCH 18/22] update test/unittest/updater_ui_test/view/ui_page_manager_unittest.cpp. Signed-off-by: bluesky_wang --- .../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 e2c6c4c0..5d1eca4d 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 @@ -75,7 +75,7 @@ const std::vector UpdaterUiPageManagerUnitTest::pageInfos_ = { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { 50, "this is page1", "center", "#ff0000ff", "#000000ff", "normal", - "#ff0000ff", "#000000ff", false, "ellipsis"}}, + {"#ff0000ff", "#000000ff", false}, false, "ellipsis"}}, UxViewInfo { UxViewCommonInfo { 300, 700, 400, 400, "image_view", "UIImageView", false}, @@ -92,7 +92,7 @@ const std::vector UpdaterUiPageManagerUnitTest::pageInfos_ = { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { 50, "this is page2", "center", "#00ff00ff", "#000000ff", "normal", - "#00ff00ff", "#000000ff", false, "ellipsis"}}, + {"#00ff00ff", "#000000ff", false}, false, "ellipsis"}}, UxViewInfo { UxViewCommonInfo { 300, 700, 400, 400, "image_view", "UIImageView", false}, @@ -108,7 +108,7 @@ const std::vector UpdaterUiPageManagerUnitTest::pageInfos_ = { 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { 50, "this is page2", "center", "#0000ffff", "#000000ff", "normal", - "#0000ffff", "#000000ff", false, "ellipsis"}}, + {"#0000ffff", "#000000ff", false}, false, "ellipsis"}}, UxViewInfo { UxViewCommonInfo { 300, 700, 400, 400, "image_view", "UIImageView", false}, @@ -146,7 +146,7 @@ HWTEST_F(UpdaterUiPageManagerUnitTest, test_page_manager_init_failed, TestSize.L 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { 50, "this is page1", "center", "#ff0ff", "#0", "normal", - "#ff0ff", "#0", false, "ellipsis"}}}, {}} + {"#ff0ff", "#0", false}, false, "ellipsis"}}}, {}} }; EXPECT_FALSE(GetInstance().Init(pageInfo, "page1")); } @@ -161,7 +161,7 @@ HWTEST_F(UpdaterUiPageManagerUnitTest, test_page_manager_init_failed, TestSize.L 300, 400, 600, 200, "label_id_0", "UILabel", true}, UxLabelInfo { 50, "this is page1", "center", "#000000ff", "#000000ff", "normal", - "#000000ff", "#000000ff", false, "ellipsis"}}}, + {"#000000ff", "#000000ff", false}, false, "ellipsis"}}}, {{UxSubPageInfo {"", "#000000ff", {"label_id_0"}}}}}}; EXPECT_FALSE(GetInstance().Init(pageInfo, "page1")); -- Gitee From 73bba58cec745efc7a88ab2a235cd291a51cbc03 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:34:42 +0000 Subject: [PATCH 19/22] update services/ui/view/component/img_view_adapter.cpp. Signed-off-by: bluesky_wang --- services/ui/view/component/img_view_adapter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/ui/view/component/img_view_adapter.cpp b/services/ui/view/component/img_view_adapter.cpp index ea9c47da..8b1b61e0 100644 --- a/services/ui/view/component/img_view_adapter.cpp +++ b/services/ui/view/component/img_view_adapter.cpp @@ -85,6 +85,7 @@ ImgViewAdapter::ImgViewAdapter(const UxViewInfo &info) currId_ = 0; valid_ = true; this->SetAutoEnable(false); + this->SetTouchable(true); SetViewCommonInfo(info.commonInfo); LOG(DEBUG) << "dir:" << dir_ << ", imgCnt:" << imgCnt_ << ", interval:" << interval_; if (interval_ == 0) { -- Gitee From 4c1123ed1fb06af17c44695c38b5b47e05c5a546 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 07:41:28 +0000 Subject: [PATCH 20/22] update test/unittest/updater_ui_test/view/ui_layout_unittest.cpp. Signed-off-by: bluesky_wang --- .../updater_ui_test/view/ui_layout_unittest.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 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 e46bbfb4..d37982a0 100644 --- a/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp +++ b/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp @@ -157,11 +157,10 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_all, TestSize.Level1) "center", "#ffffffff", "#ffffffff", - {"#ffffffff", "normal", - false}, - "#ffffffff", + {"#ffffffff", "#ffffffff", + false}, false, "ellipsis" } }; @@ -191,12 +190,11 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_all_default, TestSize.Level0) "Reboot to normal system", "center", "#ffffffff", - {"#ffffffff", "#000000ff", - false}, "normal", - "#ffffffff", + {"#ffffffff", "#000000ff", + false}, false, "ellipsis" } }; -- Gitee From aa54ad53c1e9aff8b65468a57ae5a559d73d1490 Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Fri, 11 Apr 2025 09:22:14 +0000 Subject: [PATCH 21/22] update services/ui/control/event_listener.cpp. Signed-off-by: bluesky_wang --- services/ui/control/event_listener.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/ui/control/event_listener.cpp b/services/ui/control/event_listener.cpp index 674f3a9d..fe148c9d 100644 --- a/services/ui/control/event_listener.cpp +++ b/services/ui/control/event_listener.cpp @@ -173,6 +173,7 @@ bool KeyListener::ProcessPowerKey(OHOS::UIView &view, const OHOS::KeyEvent &even } else if (event.GetState() == OHOS::InputDevice::STATE_RELEASE) { LOG(DEBUG) << "OnRelease"; pView->OnReleaseEvent(OHOS::Point { centerX, centerY }); + } #endif return true; } -- Gitee From 2e97c874fe6db88dfaa1b74aa4a1d0fcc699745a Mon Sep 17 00:00:00 2001 From: bluesky_wang Date: Mon, 14 Apr 2025 01:53:53 +0000 Subject: [PATCH 22/22] update test/unittest/updater_ui_test/view/ui_layout_unittest.cpp. Signed-off-by: bluesky_wang --- test/unittest/updater_ui_test/view/ui_layout_unittest.cpp | 1 - 1 file changed, 1 deletion(-) 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 d37982a0..ec4ee4e5 100644 --- a/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp +++ b/test/unittest/updater_ui_test/view/ui_layout_unittest.cpp @@ -112,7 +112,6 @@ HWTEST_F(UpdaterUiLayoutParserUnitTest, test_label_parser, TestSize.Level0) {"#ffffffff", "#ffffffff", false}, - "#ffffffff", false, "ellipsis" } }; -- Gitee