From: Caisking <3449750381@qq.com> Date: Fri, 22 Mar 2024 08:22:36 +0000 (+0800) Subject: 增加主界面训练卡片进入训练Slice接口,优化训练交互 X-Git-Tag: release_V1.2.70_20241020_135402~1276 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=148a8ed940f0ff85a28f42ab5ce0cbc1aee874ee;p=mirrors%2FFD230.git 增加主界面训练卡片进入训练Slice接口,优化训练交互 --- diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 080e0ed58..2eab1065d 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -441,6 +441,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/traing_card/Traing_CardView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/traing_card/Traing_CardPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traingrecord/src/TraingRecordView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traingrecord/src/TraingRecordPresenter.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp index 2b53a3634..5b0af19dd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -25,6 +25,7 @@ #include "DialModelTime.h" #include "DialModelPower.h" #include "gfx_utils/mem_check.h" +#include "traing/traing_card/Traing_CardView.h" #if USE_OFFLINE_DIAL #include "DialViewGroup.h" #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp index 224ebcd44..44ec554c9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp @@ -171,7 +171,6 @@ namespace OHOS return; } } - HorizontalViewInit(); HorViewLoad(); VerticalViewInit(); @@ -438,6 +437,7 @@ namespace OHOS } void MainViewSample::SetPage(int16_t page) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetPage is %d", page); if (mainSwipeGroup != nullptr) { mainSwipeGroup->SetHorCurrentPage(page); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingCardPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingCardPresenter.h index d011868a8..127d8b40a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingCardPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingCardPresenter.h @@ -1,3 +1,4 @@ + #ifndef _TraingCard_PRESENTER_H #define _TraingCard_PRESENTER_H @@ -26,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlPresenter.h index c1ebbfd72..5815522d2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlPresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataPresenter.h index 256325ee3..0de0fabbc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataPresenter.h @@ -26,6 +26,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailPresenter.h index 351c7e398..5f0683b04 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailPresenter.h @@ -26,6 +26,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataPresenter.h index c7877fb81..26167a1a4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataPresenter.h @@ -1,3 +1,12 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:18 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:32:34 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataPresenter.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ + #ifndef _TraingEnddata_PRESENTER_H #define _TraingEnddata_PRESENTER_H @@ -26,6 +35,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h index 4b4ef7bff..90f9561cf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:18 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:31:56 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #ifndef _TraingEndnote2_PRESENTER_H #define _TraingEndnote2_PRESENTER_H @@ -26,6 +34,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + // bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnotePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnotePresenter.h index 428b3d038..219e3972d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnotePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnotePresenter.h @@ -1,3 +1,4 @@ + #ifndef _TraingEndnote_PRESENTER_H #define _TraingEndnote_PRESENTER_H @@ -26,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSPresenter.h index aa6055eec..c2a9cf00f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSPresenter.h @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:18 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:16:06 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSPresenter.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #ifndef _TraingGPS_PRESENTER_H #define _TraingGPS_PRESENTER_H @@ -27,6 +35,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSbackPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSbackPresenter.h index 306df225a..980e07088 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSbackPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSbackPresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlackPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlackPresenter.h index 21713d7ac..a5d66d382 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlackPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlackPresenter.h @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:18 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:34:08 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlackPresenter.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE/ + */ #ifndef _TraingGPSlack_PRESENTER_H #define _TraingGPSlack_PRESENTER_H @@ -27,6 +35,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlostPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlostPresenter.h index c757e23cb..72042cc2c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlostPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSlostPresenter.h @@ -1,3 +1,4 @@ + #ifndef _TraingGPSlost_PRESENTER_H #define _TraingGPSlost_PRESENTER_H @@ -9,8 +10,8 @@ namespace OHOS class TraingGPSlostView; class TraingGPSlostPresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener + public UIView::OnClickListener, + public UIView::OnDragListener { public: TraingGPSlostPresenter(); @@ -27,6 +28,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView &view, const DragEvent &event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSnotePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSnotePresenter.h index cbaf8eafa..c37597f60 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSnotePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSnotePresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSsetPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSsetPresenter.h index 99e9c48e1..e090dd777 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSsetPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingGPSsetPresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingLimitPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingLimitPresenter.h index 6a2099113..ef58d0e23 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingLimitPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingLimitPresenter.h @@ -1,3 +1,4 @@ + #ifndef _TraingLimit_PRESENTER_H #define _TraingLimit_PRESENTER_H @@ -27,6 +28,8 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; + }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMorePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMorePresenter.h index 8685e839e..e0a2cb810 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMorePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMorePresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingNomalPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingNomalPresenter.h index 9d3d9bb7b..8033849f1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingNomalPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingNomalPresenter.h @@ -1,3 +1,4 @@ + #ifndef _TraingNomal_PRESENTER_H #define _TraingNomal_PRESENTER_H @@ -27,6 +28,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingPresenter.h index 6759a3bc8..012eeffb2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingPresenter.h @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 18:18:30 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:24:40 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingPresenter.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #ifndef _Traing_PRESENTER_H #define _Traing_PRESENTER_H @@ -27,6 +35,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView &view, const DragEvent &event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetCaluliPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetCaluliPresenter.h index 5706845a7..1c94e823d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetCaluliPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetCaluliPresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetDistPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetDistPresenter.h index 23af5de59..6a8ff2f23 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetDistPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetDistPresenter.h @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:18 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:16:44 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetDistPresenter.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #ifndef _TraingSetDist_PRESENTER_H #define _TraingSetDist_PRESENTER_H @@ -27,6 +35,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetPresenter.h index 7e650aa3c..f1e647a4b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetPresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetSeptPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetSeptPresenter.h index 74034c068..f2be67582 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetSeptPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetSeptPresenter.h @@ -1,3 +1,4 @@ + #ifndef _TraingSetSept_PRESENTER_H #define _TraingSetSept_PRESENTER_H @@ -27,6 +28,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetTimePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetTimePresenter.h index cacd63a8c..fd852ad5f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetTimePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetTimePresenter.h @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:18 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:30:44 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetTimePresenter.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE/ + */ #ifndef _TraingSetTime_PRESENTER_H #define _TraingSetTime_PRESENTER_H @@ -27,6 +35,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongPresenter.h index b69a7c6cb..d3122e39c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongPresenter.h @@ -1,3 +1,4 @@ + #ifndef _TraingStrong_PRESENTER_H #define _TraingStrong_PRESENTER_H @@ -27,6 +28,8 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; + }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinPresenter.h index a034c77fa..ed8b1e19a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinPresenter.h @@ -27,6 +27,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + //bool OnDragEnd(UIView& view, const DragEvent& event) override; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingCardPresenter.cpp index cac32c0ac..99c7ad302 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingCardPresenter.cpp @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:19 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 14:55:18 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingCardPresenter.cpp + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #include "AppViewIDs.h" #include "NativeAbility.h" diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlPresenter.cpp index a499f437d..12df75ea6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlPresenter.cpp @@ -54,8 +54,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingControlPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingControlPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT) diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataPresenter.cpp index d55dc6c31..5004cffe6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataPresenter.cpp @@ -47,8 +47,11 @@ namespace OHOS { Presenter::OnStop(); } - bool TraingDataPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingDataPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp index f473ff119..6feb59d4e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp @@ -1,3 +1,12 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:19 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:23:15 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ + #include "AppViewIDs.h" #include "NativeAbility.h" @@ -54,8 +63,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingDetailPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingDetailPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM) diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSPresenter.cpp index 8bb2633bc..8265666a3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSPresenter.cpp @@ -1,3 +1,4 @@ + #include "AppViewIDs.h" #include "NativeAbility.h" @@ -54,8 +55,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingGPSPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingGPSPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSlackPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSlackPresenter.cpp index 8887c5338..8e39d3bd7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSlackPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSlackPresenter.cpp @@ -2,7 +2,7 @@ * @Author: Caisking 3449750381@qq.com * @Date: 2023-12-12 16:55:28 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-01-16 15:44:47 + * @LastEditTime: 2024-03-22 15:40:56 * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackPresenter.cpp * @Description: * @ @@ -64,8 +64,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingGPSlackPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingGPSlackPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSnotePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSnotePresenter.cpp index dc9666373..b9c2babbc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSnotePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSnotePresenter.cpp @@ -54,8 +54,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingGPSnotePresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingGPSnotePresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSsetPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSsetPresenter.cpp index 706a1243b..66f8f029c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSsetPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingGPSsetPresenter.cpp @@ -54,8 +54,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingGPSsetPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingGPSsetPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingLimitPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingLimitPresenter.cpp index 745fc09ae..e2cd6a6a3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingLimitPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingLimitPresenter.cpp @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:19 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:20:33 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingLimitPresenter.cpp + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #include "AppViewIDs.h" #include "NativeAbility.h" @@ -54,8 +62,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingLimitPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingLimitPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMorePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMorePresenter.cpp index 5b6f363ac..9a533312b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMorePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMorePresenter.cpp @@ -5,6 +5,8 @@ #include #include #include "traing/include/TraingMorePresenter.h" +#include "MainViewSample.h" +#include "ScreenModels.h" // #include "TraingMoreView.h" namespace OHOS @@ -54,14 +56,24 @@ namespace OHOS Presenter::OnStop(); } - bool TraingMorePresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingMorePresenter::OnDragEnd(UIView &view, const DragEvent &event) { - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && - (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING); + uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Id:[%d]", preSlice); + if (preSlice == VIEW_MAIN) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + // MainViewSample::GetInstance()->SetPage(CardId::TRAINING); + return true; + } + NativeAbility::GetInstance().ChangeSlice(preSlice); } UNUSED(view); return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp index 49c769326..2ec62105f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp @@ -54,15 +54,22 @@ namespace OHOS Presenter::OnStop(); } - bool TraingNomalPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingNomalPresenter::OnDragEnd(UIView &view, const DragEvent &event) { - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && - (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) + uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Id:[%d]", preSlice); + if (preSlice == VIEW_MAIN) { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + // MainViewSample::GetInstance()->SetPage(CardId::TRAINING); + return true; } + NativeAbility::GetInstance().ChangeSlice(preSlice); UNUSED(view); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingPresenter.cpp index e7306fa54..352b9883d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingPresenter.cpp @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 18:18:50 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:22:11 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingPresenter.cpp + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #include "AppViewIDs.h" #include "NativeAbility.h" @@ -48,8 +56,11 @@ namespace OHOS { Presenter::OnStop(); } - bool TraingPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingPresenter::OnDragEnd(UIView &view, const DragEvent &event) { UNUSED(view); if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp index f0fb44b23..9e3bdbf7f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp @@ -54,8 +54,11 @@ namespace OHOS Presenter::OnStop(); } - bool TraingStrongPresenter::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + bool TraingStrongPresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp index 76fe50586..0d3d43927 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-19 17:37:19 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-22 15:21:30 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #include "AppViewIDs.h" #include "NativeAbility.h" diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardPresenter.cpp new file mode 100644 index 000000000..a06e02d55 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardPresenter.cpp @@ -0,0 +1,40 @@ + +#include "traing/traing_card/Traing_CardPresenter.h" +#include "traing/traing_card/Traing_CardView.h" + +#include "AppViewIDs.h" +#include "NativeAbility.h" +#include "UiConfig.h" +#include "wearable_log.h" +namespace OHOS +{ + + bool TraingOnClickListener::OnClick(UIView &view, const ClickEvent &event) + { + UNUSED(event); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Traing_CardView::OnClick %s", view.GetViewId()); + Traing_CardView *cardpage = Traing_CardView::GetInstance(); + if (cardpage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Traing_CardView::GetInstance"); + return false; + } + if (strcmp(view.GetViewId(), BUTTON1) == 0) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL); + } + if (strcmp(view.GetViewId(), BUTTON2) == 0) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL); + } + if (strcmp(view.GetViewId(), BUTTON3) == 0) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL); + } + if (strcmp(view.GetViewId(), BUTTONMORE) == 0) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE); + } + return true; + } +} // namespace OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardPresenter.h new file mode 100644 index 000000000..8c7650d34 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardPresenter.h @@ -0,0 +1,24 @@ + +#ifndef TRAING_CARD_PRESENTER_H +#define TRAING_CARD_PRESENTER_H +#include "components/ui_view.h" +namespace OHOS +{ + class TraingOnClickListener : public UIView::OnClickListener + { + public: + TraingOnClickListener() {} + TraingOnClickListener(UIView *view) : view_(view) {} + ~TraingOnClickListener(){}; + static TraingOnClickListener *GetInstance() + { + static TraingOnClickListener instance; + return &instance; + } + bool OnClick(UIView &view, const ClickEvent &event) override; + + private: + UIView *view_{nullptr}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardView.cpp index e514a9d09..167233263 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/traing_card/Traing_CardView.cpp @@ -8,7 +8,8 @@ #include "components/ui_button.h" #include "components/ui_view_group.h" #include "common/image_cache_manager.h" - +#include "MainPresenterSample.h" +#include "traing/traing_card/Traing_CardPresenter.h" namespace OHOS { static Traing_CardView *g_pTraing_CardView{nullptr}; @@ -93,6 +94,7 @@ namespace OHOS struct ButtonInfo { std::string text; + char *viewid; uint32_t defaultImgSrc; UILabelButtonExt *button; uint16_t posX; @@ -100,10 +102,10 @@ namespace OHOS }; ButtonInfo buttons[] = { - {"健走", TRAINING_BUTTONGROUND2, Button1, 86, 118}, - {"骑行", TRAINING_BOUTTONGROUND, Button2, 236, 118}, - {"跑步", TRAINING_BOUTTONGROUND, Button3, 86, 268}, - {"更多", TRAINING_MORE, ButtonMore, 236, 268}}; + {"健走", BUTTON1, TRAINING_BUTTONGROUND2, Button1, 86, 118}, + {"骑行", BUTTON2, TRAINING_BOUTTONGROUND, Button2, 236, 118}, + {"跑步", BUTTON3, TRAINING_BOUTTONGROUND, Button3, 86, 268}, + {"更多", BUTTONMORE, TRAINING_MORE, ButtonMore, 236, 268}}; for (auto &buttonInfo : buttons) { @@ -120,12 +122,20 @@ namespace OHOS buttonInfo.button->SetPosition(buttonInfo.posX, buttonInfo.posY); buttonInfo.button->Resize(140, 140); + //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Id:[%s]", buttonInfo.viewid); buttonInfo.button->SetText(buttonInfo.text.c_str()); buttonInfo.button->SetLabelPosition(0, 70); buttonInfo.button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); buttonInfo.button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff19ff41, UIButton::PRESSED); buttonInfo.button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - + buttonInfo.button->SetViewId(buttonInfo.viewid); + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TraingOnClickListener::GetInstance(); + if (clickListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddButton::OnStart clickListener NULL"); + return false; + } + buttonInfo.button->SetOnClickListener(clickListener); Add(buttonInfo.button); }