From 9ba5c866ff0c3948017aebbd0b0ab7e0de771911 Mon Sep 17 00:00:00 2001 From: cheng Date: Fri, 23 Aug 2024 12:28:50 +0800 Subject: [PATCH] schedule list --- .../schedule/include/ScheduleListItem.h | 1 - .../nativeui/schedule/include/ScheduleModel.h | 2 +- .../schedule/include/SchedulePresenter.h | 2 +- .../nativeui/schedule/src/ScheduleModel.cpp | 25 ++++--- .../schedule/src/SchedulePresenter.cpp | 11 +-- .../nativeui/schedule/src/ScheduleView.cpp | 70 ++++++++++++++++++- 6 files changed, 92 insertions(+), 19 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h index 09f5bef05..222fcba4d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleListItem.h @@ -57,7 +57,6 @@ namespace OHOS #define EVEN_ITEM_TIME_COLOR (0Xffffc28b) #define IMAGE_ITEM_ARROW "/user/res/Schedule/IMAGE_ITEM_ARROW.bin" - // #define IMAGE_ITEM_ARROW "/user/res/settings/SETTINGS_DISPLAY_MODE.bin" }; } #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleModel.h b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleModel.h index 9811d711b..14ab8869b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/ScheduleModel.h @@ -31,7 +31,7 @@ namespace OHOS ScheduleModel &operator=(const ScheduleModel &) = delete; void ScheduleDataItemCountSet(uint8_t count); - void ScheduleDataToInfo(void); + void ScheduleDataToInfo(uint8_t DataCount); ScheduleRevData ScheduleRevData_[SCHEDULE_DATA_COUNT_MAX] = {nullptr, nullptr, nullptr, nullptr}; ScheduleListItemInfo ScheduleDataInfo_[SCHEDULE_DATA_COUNT_MAX*2] = {nullptr, nullptr, nullptr, nullptr, 0, false, 0, 0}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/SchedulePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/SchedulePresenter.h index 64dce3826..a4e9ed1e7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/include/SchedulePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/include/SchedulePresenter.h @@ -13,7 +13,7 @@ namespace OHOS { class ScheduleView; class ScheduleModel; - class SchedulePresenter : public Presenter, + class SchedulePresenter : public Presenter, public UIView::OnClickListener, public UIView::OnDragListener, public RootView::OnKeyActListener diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleModel.cpp index 145b4a63b..1ed145c5e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleModel.cpp @@ -74,22 +74,20 @@ namespace OHOS if(true == is_finish) { - ScheduleDataToInfo(); + uint8_t DataCount = index + 1; + ScheduleDataToInfo(DataCount); } } - void ScheduleModel::ScheduleDataToInfo(void) + void ScheduleModel::ScheduleDataToInfo(uint8_t DataCount) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScheduleModel::ScheduleDataToInfo"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScheduleModel::ScheduleDataToInfo,%d", DataCount); uint8_t i = 0; uint8_t j = 0; - uint8_t count = 0; memset(ScheduleDataInfo_, 0x0, sizeof(ScheduleListItemInfo) * SCHEDULE_DATA_COUNT_MAX*2); - count = 1; - - for(i = 0, j = 0; i < count; i++) + for(i = 0, j = 0; i < DataCount; i++) { if(0 == i) { @@ -121,6 +119,7 @@ namespace OHOS } else { + j++; ScheduleDataInfo_[j].DateStr.assign(ScheduleRevData_[i].date); ScheduleDataInfo_[j].index = j; ScheduleDataInfo_[j].is_date_item = true; @@ -135,18 +134,19 @@ namespace OHOS ScheduleDataInfo_[j].child_index = 0; } } - + if((SCHEDULE_DATA_COUNT_MAX * 2) <= j) { break; } } - ScheduleDataItemCountSet(j + 1); + uint8_t ItemCount = j + 1; + ScheduleDataItemCountSet(ItemCount); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScheduleModel::ScheduleDataToInfo,%d,%s", j, ScheduleDataInfo_[0].DateStr.c_str()); } - + // c func void C_ScheduleSetByApp(ScheduleRevData * data, uint8_t index, bool is_finish) { ScheduleModel::GetInstance().ScheduleSetByApp(data, index, is_finish); @@ -154,11 +154,16 @@ namespace OHOS int C_ScheduleDataReadFromFile() { + + return 0; } int C_ScheduleDataWriteToFile() { + + return 0; } + } diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/SchedulePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/SchedulePresenter.cpp index a9040959e..82370ed95 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/SchedulePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/SchedulePresenter.cpp @@ -38,14 +38,14 @@ namespace OHOS void SchedulePresenter::OnStart() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SchedulePresenter::OnStart"); - Presenter::OnStart(); + Presenter::OnStart(); } // 页面已经展示后的调用逻辑 void SchedulePresenter::OnResume(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SchedulePresenter::OnResume"); - Presenter::OnResume(); + Presenter::OnResume(); if (nullptr == view_) { return; @@ -62,21 +62,21 @@ namespace OHOS void SchedulePresenter::OnPause(void) { // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SchedulePresenter::OnPause"); - Presenter::OnPause(); + Presenter::OnPause(); } // 页面完全置于后台时的逻辑。 void SchedulePresenter::OnStop(void) { // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SchedulePresenter::OnStop"); - Presenter::OnStop(); + Presenter::OnStop(); } bool SchedulePresenter::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SchedulePresenter::OnClick"); - +#if 0 if (nullptr == &view) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:OnClick", __LINE__); @@ -88,6 +88,7 @@ namespace OHOS ScheduleListItem * item = static_cast(&view); view_->DisplayContentScreen(item->GetViewIndex()); } +#endif return true; } 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 aa22e2c50..d3672cbf1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp @@ -113,6 +113,44 @@ namespace OHOS delete DataGroup_; DataGroup_ = nullptr; } + if(nullptr != ContentGroup_) + { + ContentGroup_->RemoveAll(); + if(nullptr != ContentLabelExt0_) + { + delete ContentLabelExt0_; + ContentLabelExt0_ = nullptr; + } + if(nullptr != ContentLabelExt1_) + { + delete ContentLabelExt1_; + ContentLabelExt1_ = nullptr; + } + if(nullptr != ContentLabelExt2_) + { + delete ContentLabelExt2_; + ContentLabelExt2_ = nullptr; + } + if(nullptr != ContentLabelExt3_) + { + delete ContentLabelExt3_; + ContentLabelExt3_ = nullptr; + } + if(nullptr != ContentButton0_) + { + delete ContentButton0_; + ContentButton0_ = nullptr; + } + if(nullptr != ContentButton1_) + { + delete ContentButton1_; + ContentButton1_ = nullptr; + } + + delete ContentGroup_; + ContentGroup_ = nullptr; + } + delete container_; container_ = nullptr; } @@ -140,6 +178,34 @@ namespace OHOS } } +#if 0 + void ScheduleView::_DisplayMainScreen(uint8_t ScreenIndex) + { + if(ENUM_SCHEDULE_MAX_SCREEN =< ScreenIndex) + { + return; + } + + uint8_t i = 0; + for(i = 0; i < ENUM_SCHEDULE_MAX_SCREEN; i++) + { + if(i == ScreenIndex) + { + GroupArray_[i]->SetVisible(true); + } + else + { + GroupArray_[i]->SetVisible(false); + } + } + + if(ENUM_SCHEDULE_LIST_SCREEN == ScreenIndex) + { + GroupArray_[ENUM_SCHEDULE_LIST_SCREEN]->RefreshList(); + } + } +#endif + void ScheduleView::DisplayContentScreen(uint8_t index) { NoDataGroup_->SetVisible(false); @@ -273,7 +339,6 @@ namespace OHOS } } ScheduleList_->SetPosition(LIST_LEFT, LIST_TOP, LIST_WIDTH, LIST_HEIGHT); - // ScheduleList_->SetScrollBlankSize(30); // ScheduleList_->SetSelectPosition(VERTICAL_RESOLUTION / 2); ScheduleList_->SetDraggable(true); ScheduleList_->SetThrowDrag(true); @@ -285,6 +350,9 @@ namespace OHOS ScheduleList_->SetDragACCLevel(5); // 5: drag acceleration ScheduleList_->SetYScrollBarVisible(false); + ScheduleList_->SetScrollBlankSize(40); + ScheduleList_->SetReboundSize(30); + ScheduleList_->SetRotateFactor(2); // 增加表冠控制 ScheduleList_->RequestFocus(); -- 2.17.1