From: luozheng <1732036298@qq.com> Date: Thu, 7 Nov 2024 03:02:31 +0000 (+0800) Subject: 解决日程列表List不起作用bug X-Git-Tag: fd230_release_V1.3.102~29^2~44 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d74c2aad82760d64a816b8c629295e8349ffd0f4;p=mirrors%2FFD230.git 解决日程列表List不起作用bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleView.h b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleView.h index 537f42026..f154f4189 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleView.h @@ -55,6 +55,8 @@ namespace OHOS void DisplayContentScreen(void); void DisplayDeleteScreen(void); + void SetViewFocus(bool val); + private: void ResetScheduleList(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp index e170c9042..7cb2cdfc5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp @@ -129,6 +129,7 @@ namespace OHOS DisplaySelectScreen(ENUM_SCHEDULE_SCREEN_LIST); ResetScheduleList(); + SetViewFocus(true);//列表获取聚焦 ScheduleList_->RefreshList(); } } @@ -136,6 +137,7 @@ namespace OHOS void ScheduleView::DisplayContentScreen(void) { DisplaySelectScreen(ENUM_SCHEDULE_SCREEN_CONTENT); + SetViewFocus(false);//数据显示视图获取聚焦 uint8_t index = ContentScreenItemIndexGet(); ContentDateLabelExt_->SetText(ScheduleModel::GetInstance().ScheduleItemDataDateStrGet(index).c_str()); @@ -437,7 +439,7 @@ namespace OHOS ContentGroup_->SetDirection(1); ContentGroup_->SetMaxScrollDistance(1000); ContentGroup_->SetThrowDrag(true); - ContentGroup_->RequestFocus(); + // ContentGroup_->RequestFocus(); ContentGroup_->SetRotateFactor(2); if(nullptr == ContentDateLabelExt_) @@ -811,4 +813,20 @@ namespace OHOS ScheduleList_->SetReboundSize(0); } } + + void ScheduleView::SetViewFocus(bool val) + { + if(!ContentGroup_ || !ScheduleList_) + { + return; + } + if(val) + { + ScheduleList_->RequestFocus(); + } + else + { + ContentGroup_->RequestFocus(); + } + } } \ No newline at end of file