From d8038c1c841a4f3a50cdc6f73e4162985e81b85f Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 9 Jan 2026 10:48:47 +0800 Subject: [PATCH] =?utf8?q?=E7=A6=85=E9=81=931628,=E8=A7=A3=E5=86=B3?= =?utf8?q?=E8=A1=A8=E5=86=A0=E5=8A=9F=E8=83=BD--=E7=94=9F=E7=90=86?= =?utf8?q?=E6=9C=9F=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E8=BD=AC=E8=A1=A8?= =?utf8?q?=E5=86=A0=E6=B2=A1=E6=9C=89=E5=8A=9F=E8=83=BD=EF=BC=8C=E9=9C=80?= =?utf8?q?=E8=A6=81=E4=BC=98=E5=8C=96bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../womenhealth/include/WomenHealthSettingPage.h | 3 ++- .../womenhealth/src/WomenHealthPresenter.cpp | 8 +++++++- .../womenhealth/src/WomenHealthSettingPage.cpp | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/include/WomenHealthSettingPage.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/include/WomenHealthSettingPage.h index 2dc450805..483e84e59 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/include/WomenHealthSettingPage.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/include/WomenHealthSettingPage.h @@ -27,11 +27,12 @@ class WomenHealthSettingPage : public SlicePage, public: WomenHealthSettingPage(); ~WomenHealthSettingPage() override; + static WomenHealthSettingPage* GetInstance(); void OnStart(void* data) override; bool OnDrag(UIView& view, const DragEvent& event) override; bool OnClick(UIView& view, const ClickEvent& event) override; - + UIList* GetDateList(); private: void InitView(); // 初始化视图 void InitTitleLabel(); // 初始化标题 diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthPresenter.cpp index 44d425b73..e44e32139 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthPresenter.cpp @@ -11,6 +11,7 @@ #include "gfx_utils/mem_check.h" #include "common/key_code.h" #include "womenhealth/include/WomenHealthPresenter.h" + #include "womenhealth/include/WomenHealthSettingPage.h" #include "custom_utils.h" #include "NativeRegisterManager.h" @@ -49,7 +50,12 @@ void WomenHealthPresenter::OnResume() { - RootView::GetInstance()->SetOnKeyActListener(this); + RootView::GetInstance()->SetOnKeyActListener(this); + if(WomenHealthSettingPage::GetInstance() != nullptr && + WomenHealthSettingPage::GetInstance()->GetDateList() != nullptr) + { + WomenHealthSettingPage::GetInstance()->GetDateList()->RequestFocus(); + } } bool WomenHealthPresenter::OnClick(UIView &view, const ClickEvent &event) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthSettingPage.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthSettingPage.cpp index 64e64e52b..5ac674385 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthSettingPage.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/womenhealth/src/WomenHealthSettingPage.cpp @@ -32,9 +32,11 @@ static constexpr uint16_t LIST_POS_Y = 100; static constexpr uint16_t LIST_WIDTH = 394; static constexpr uint16_t LIST_HEIGHT = 354; +static WomenHealthSettingPage* g_pWomenHealthSettingPage = nullptr; WomenHealthSettingPage::WomenHealthSettingPage() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WomenHealthSettingPage::WomenHealthSettingPage"); + g_pWomenHealthSettingPage = this; } WomenHealthSettingPage::~WomenHealthSettingPage() @@ -61,6 +63,14 @@ WomenHealthSettingPage::~WomenHealthSettingPage() delete adapter_; adapter_ = nullptr; } + + g_pWomenHealthSettingPage = nullptr; +} + + +WomenHealthSettingPage* WomenHealthSettingPage::GetInstance() +{ + return g_pWomenHealthSettingPage; } void WomenHealthSettingPage::OnStart(void* data) @@ -112,6 +122,11 @@ void WomenHealthSettingPage::InitTitleLabel() group_->Add(titleLabel_); } +UIList* WomenHealthSettingPage::GetDateList() +{ + return dateList_; +} + void WomenHealthSettingPage::InitDateList() { // 创建列表 @@ -141,6 +156,7 @@ void WomenHealthSettingPage::InitDateList() // 设置适配器并刷新列表 dateList_->SetAdapter(adapter_); dateList_->RefreshList(); + dateList_->RequestFocus(); // 添加到容器 group_->Add(dateList_); -- 2.17.1