From 15481c091c4e596e4e895d1f4ba37dde855ea9bf Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 9 Jan 2026 17:59:36 +0800 Subject: [PATCH] =?utf8?q?=E4=BA=A7=E6=B5=8B=E6=8C=89=E9=94=AE=E7=95=8C?= =?utf8?q?=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../zhihui/UI/producttest/include/testPresenter.h | 1 + code/sdk/zhihui/UI/producttest/include/testbutton.h | 1 + .../sdk/zhihui/UI/producttest/src/testPresenter.cpp | 10 +++++++++- code/sdk/zhihui/UI/producttest/src/testbutton.cpp | 13 +++++++------ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/code/sdk/zhihui/UI/producttest/include/testPresenter.h b/code/sdk/zhihui/UI/producttest/include/testPresenter.h index ab9aa8a8c..6ec2b31f9 100644 --- a/code/sdk/zhihui/UI/producttest/include/testPresenter.h +++ b/code/sdk/zhihui/UI/producttest/include/testPresenter.h @@ -106,6 +106,7 @@ namespace OHOS virtual ~testPresenter(); void OnStart() override; + void OnResume() override; static testPresenter *GetInstance(); diff --git a/code/sdk/zhihui/UI/producttest/include/testbutton.h b/code/sdk/zhihui/UI/producttest/include/testbutton.h index 284e5f77a..280856882 100644 --- a/code/sdk/zhihui/UI/producttest/include/testbutton.h +++ b/code/sdk/zhihui/UI/producttest/include/testbutton.h @@ -45,6 +45,7 @@ namespace OHOS UIScrollView *testBUTTONInitIView(uint8_t); + UIScrollView *GetTestBUTTONScrollView(void){return testBUTTONScrollView;} void ClearAll(void); private: UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); diff --git a/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp b/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp index dca3ba78a..9915c0570 100644 --- a/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testPresenter.cpp @@ -99,6 +99,14 @@ namespace OHOS void testPresenter::OnStart() { } + void testPresenter::OnResume() + { + if(view_->GetSystemScrollView(BUTTON) != nullptr) + { + RootView::GetInstance()->SetOnKeyActListener(this); + testbuttonView::GetInstance()->GetTestBUTTONScrollView()->RequestFocus(); + } + } bool testPresenter::OnPress(UIView &view, const PressEvent &event) { @@ -453,7 +461,7 @@ namespace OHOS bool testPresenter::OnKeyAct(UIView &view, const KeyEvent &event) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnKeyAct"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testPresenter::OnKeyAct"); uint8_t keyID = event.GetKeyId(); uint8_t keystate=event.GetState(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ":xxxxxxx:%d",keyID); diff --git a/code/sdk/zhihui/UI/producttest/src/testbutton.cpp b/code/sdk/zhihui/UI/producttest/src/testbutton.cpp index 22574cba2..602ff22d1 100644 --- a/code/sdk/zhihui/UI/producttest/src/testbutton.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testbutton.cpp @@ -137,7 +137,7 @@ namespace OHOS button[0]->SetText("POWER_KEY::\nraise"); } - + button[0]->Invalidate(); } if(i==1) { @@ -152,6 +152,7 @@ namespace OHOS button[1]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); button[1]->SetText("FUNC_KEY::\nraise"); } + button[1]->Invalidate(); } #ifdef BOARD_U8 @@ -170,7 +171,7 @@ namespace OHOS } #endif - RootView::GetInstance()->Invalidate(); + // RootView::GetInstance()->Invalidate(); } @@ -196,8 +197,8 @@ namespace OHOS button[index]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); button[index]->SetText("crown::raise"); } - RootView::GetInstance()->Invalidate(); - + // RootView::GetInstance()->Invalidate(); + button[index]->Invalidate(); } void testbuttonView::Changbutton(int16_t falg) @@ -207,8 +208,8 @@ namespace OHOS label_crown->SetText(buf); - RootView::GetInstance()->Invalidate(); - + // RootView::GetInstance()->Invalidate(); + label_crown->Invalidate(); } -- 2.17.1