From 2b49f798ac7b8e883eb3bb112c7a86279d8fd526 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 28 May 2024 19:49:39 +0800 Subject: [PATCH] =?utf8?q?uisample=E6=96=87=E4=BB=B6=E5=A4=B9=E6=9B=B4?= =?utf8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/uisample/include/UISampleModel.h | 3 --- .../uisample/include/UISamplePresenter.h | 11 ++++---- .../nativeui/uisample/include/UISampleView.h | 15 +++++------ .../uisample/src/UISamplePresenter.cpp | 26 +++++-------------- .../nativeui/uisample/src/UISampleView.cpp | 2 +- .../include/test_case_list_adapter.h | 1 - .../uitest/framework/include/ui_test.h | 1 - .../uitest/framework/src/ui_test_group.cpp | 14 +++++++++- 8 files changed, 32 insertions(+), 41 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleModel.h b/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleModel.h index 556d8fced..45028caf6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleModel.h @@ -11,8 +11,6 @@ #include #include #include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" #include "UiConfig.h" #include "UISamplePresenter.h" @@ -26,7 +24,6 @@ namespace OHOS { UISampleModel(const UISampleModel &); UISampleModel &operator=(const UISampleModel &); virtual ~UISampleModel(); - }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISamplePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISamplePresenter.h index 2272d09f5..821544b28 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISamplePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISamplePresenter.h @@ -19,18 +19,17 @@ class UISamplePresenter : public Presenter, public UIView::OnDragListener { public: UISamplePresenter(); - virtual ~UISamplePresenter(); + ~UISamplePresenter() override; - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnStop() override; + void OnStart() override; + void OnResume() override; + void OnStop() override; bool OnClick(UIView &view, const ClickEvent &event) override; - virtual bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override; private: UISampleModel *uisampleModel; - }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleView.h b/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleView.h index ff130de95..6009abbaa 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/include/UISampleView.h @@ -13,7 +13,6 @@ #include "components/ui_view_group.h" #include "components/ui_scroll_view.h" #include "components/ui_label.h" -#include "components/ui_label_ext.h" #include "components/ui_list.h" #include "window/window.h" #include "BaseView.h" @@ -27,9 +26,9 @@ class UISamplePresenter; class UISampleOnDragListener : public UIView::OnDragListener { public: UISampleOnDragListener() {} - virtual ~UISampleOnDragListener() {} + ~UISampleOnDragListener() override {} - bool OnDrag(UIView& view, const DragEvent& event) + bool OnDrag(UIView& view, const DragEvent& event) override { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UISampleOnDragListener::OnDrag"); UNUSED(view); @@ -45,7 +44,7 @@ public: class UISampleView : public View { public: UISampleView(); - virtual ~UISampleView(); + ~UISampleView(); static UISampleView *GetInstance() { @@ -53,10 +52,10 @@ public: return &instance; } - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void InitView(); private: diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISamplePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISamplePresenter.cpp index 4d57d3f4a..7037c35fc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISamplePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISamplePresenter.cpp @@ -8,9 +8,7 @@ #include "UISampleView.h" #include "UISampleModel.h" #include "UISamplePresenter.h" -#if defined(SUPPORT_POWER_MANAGER) -#include "power_display_service.h" -#endif +#include "ui_service.h" namespace OHOS { UISamplePresenter::UISamplePresenter() @@ -23,29 +21,17 @@ namespace OHOS { void UISamplePresenter::OnStart() { -#if defined(SUPPORT_POWER_MANAGER) - const power_display_svr_api_t *display_api = power_display_svr_get_api(); - if (display_api->get_screen_state() != SCREEN_ON) { - display_api->turn_on_screen(); - } - display_api->set_screen_set_keepon_timeout(-1); -#endif Presenter::OnStart(); + SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, nullptr, 0); } void UISamplePresenter::OnResume(void) { - if (view_ == nullptr) { - return; - } } void UISamplePresenter::OnStop(void) { -#if defined(SUPPORT_POWER_MANAGER) - const power_display_svr_api_t *display_api = power_display_svr_get_api(); - display_api->set_screen_set_keepon_timeout(0); -#endif + SendMsgToUIService(UI_RM_SLEEP_VETO, 0, nullptr, 0); return; } @@ -53,7 +39,7 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UISamplePresenter::OnDrag"); UNUSED(view); - UNUSED(event); + UNUSED(event); return false; } @@ -61,7 +47,7 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UISamplePresenter::OnDrag"); UNUSED(view); - UNUSED(event); - return true; + UNUSED(event); + return true; } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISampleView.cpp b/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISampleView.cpp index afff38344..40fbc7f0c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISampleView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/src/UISampleView.cpp @@ -30,6 +30,7 @@ void UISampleView::InitView() mainList_->SetThrowDrag(true); mainList_->SetReboundSize(100); // 100: rebound size mainList_->SetElastic(true); + mainList_->SetYScrollBarVisible(true); adapter_ = new TestCaseListAdapter(); UITestGroup::GetInstance()->SetUpTestCase(); mainList_->SetAdapter(adapter_); @@ -95,5 +96,4 @@ void UISampleView::OnStop() View::OnStop(); return; } - } diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/test_case_list_adapter.h b/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/test_case_list_adapter.h index f9060cf69..eeaddcb05 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/test_case_list_adapter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/test_case_list_adapter.h @@ -19,7 +19,6 @@ #include "components/abstract_adapter.h" #include "components/root_view.h" #include "components/ui_label.h" -#include "components/ui_label_ext.h" #include "components/ui_label_button.h" namespace OHOS { diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/ui_test.h b/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/ui_test.h index dfc1da0f7..b434ba965 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/ui_test.h +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/include/ui_test.h @@ -17,7 +17,6 @@ #define UI_TEST_H #include "components/ui_label.h" -#include "components/ui_label_ext.h" #include "components/ui_view_group.h" #include "common/screen.h" #include "gfx_utils/style.h" diff --git a/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/src/ui_test_group.cpp b/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/src/ui_test_group.cpp index 786e39265..3e4da3ccf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/src/ui_test_group.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/uisample/uitest/framework/src/ui_test_group.cpp @@ -24,8 +24,14 @@ #include "ui_test_countdown/ui_test_countdown.h" #include "ui_test_running_ball/ui_test_running_ball.h" #endif +#if ENABLE_SOFT_KEYBOARD +#include "ui_test_keyboard/ui_test_keyboard.h" +#endif #include "ui_test_tiger/ui_test_tiger.h" +#include "ui_test_hexagons_list/ui_test_hexagons_list.h" #include "ui_test_video_play/ui_test_video_play.h" +#include "ui_test_coverflow/ui_test_coverflow.h" +#include "ui_test_kaleidoscope/ui_test_kaleidoscope.h" namespace OHOS { void UITestGroup::AddTestCase(TestCaseInfo testCaseInfo) @@ -44,17 +50,23 @@ void UITestGroup::SetUpTestCase() } testCaseList_->Clear(); testCaseList_->PushBack(TestCaseInfo{"老虎头", new UITestTiger()}); + testCaseList_->PushBack(TestCaseInfo{"蜂窝表盘", new UITestHexagonsList()}); testCaseList_->PushBack(TestCaseInfo{"滑动列表", new UITestListFPS()}); testCaseList_->PushBack(TestCaseInfo{"卡片切换", new UITestCardSwitch()}); testCaseList_->PushBack(TestCaseInfo{"立方体旋转", new UITestCubeRotate()}); testCaseList_->PushBack(TestCaseInfo{"消息", new UITestMessage()}); testCaseList_->PushBack(TestCaseInfo{"呼吸效果", new UITestBreath()}); + testCaseList_->PushBack(TestCaseInfo{"覆盖流", new UITestCoverflow()}); + testCaseList_->PushBack(TestCaseInfo{"万花筒", new UITestKaleidoscope()}); #if ENABLE_VGU_ENGINE && CAPABILITY_HWDRAW_PATH testCaseList_->PushBack(TestCaseInfo{"倒计时", new UITestCountdown()}); testCaseList_->PushBack(TestCaseInfo{"动画曲线", new UITestRunningBall()}); #endif - //testCaseList_->PushBack(TestCaseInfo{"视频播放", new UITestVideoPlay()}); +#if ENABLE_SOFT_KEYBOARD + testCaseList_->PushBack(TestCaseInfo{"软键盘", new UITestKeyboard()}); +#endif + testCaseList_->PushBack(TestCaseInfo{"视频播放", new UITestVideoPlay()}); } List& UITestGroup::GetTestCase() -- 2.17.1