${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingDetailPresenter.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnoteView.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnotePresenter.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnote2View.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnote2Presenter.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEnddataView.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEnddataPresenter.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingGPSView.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingGPSnotePresenter.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingStrongView.cpp\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingStrongPresenter.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingGPSlostPresenter.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingGPSlostView.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingGPSbackPresenter.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingGPSbackView.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinView.cpp\r
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinPresenter.cpp\r
\r
#ָ����\r
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/compass/src/CompassControlView.cpp\r
VIEW_MAIN_TEMP,\r
VIEW_INDOORWALK,\r
VIEW_REBOOT,\r
- VIEW_UISAMPLE, // 实例\r
- VIEW_GETPIC, // 手势拍照\r
- VIEW_TAKEPIC, // 拍照\r
+ VIEW_UISAMPLE, // 实例\r
+ VIEW_GETPIC, // 手势拍照\r
+ VIEW_TAKEPIC, // 拍照\r
\r
- VIEW_BLOOD, // 血氧\r
- VIEW_BLOODSHOW, // 血氧说明\r
- VIEW_BLOODCHECK, // 血氧检查\r
- VIEW_BLOODERROR, // 血氧监测错误\r
- VIEW_BLOODNOTE, // 血氧过低提醒\r
+ VIEW_BLOOD, // 血氧\r
+ VIEW_BLOODSHOW, // 血氧说明\r
+ VIEW_BLOODCHECK, // 血氧检查\r
+ VIEW_BLOODERROR, // 血氧监测错误\r
+ VIEW_BLOODNOTE, // 血氧过低提醒\r
\r
- VIEW_DIAL, // 表盘\r
- VIEW_DIALSETUP, // 表盘安装\r
- VIEW_DIALSUCCES, // 表盘安装成功\r
+ VIEW_DIAL, // 表盘\r
+ VIEW_DIALSETUP, // 表盘安装\r
+ VIEW_DIALSUCCES, // 表盘安装成功\r
+\r
+ VIEW_SAVEELE, // 省电模式\r
+ VIEW_SAVEBAT, // 省电模式界面\r
\r
- VIEW_SAVEELE, // 省电模式\r
- VIEW_SAVEBAT, // 省电模式界面\r
- \r
VIEW_COMPASS, // 指南针\r
VIEW_COMPASS_PLACE_MAKER, // 指南针:放置标记点\r
VIEW_COMPASS_MAKER_POINT, // 指南针:标记点介绍\r
VIEW_COMPASS_END_BACK_TRACKING_EARLY, // 指南针:提前结束路径回溯\r
VIEW_SPORT, // 活动\r
\r
- VIEW_HEARTRATEREMIND, // 心率提醒\r
+ VIEW_HEARTRATEREMIND, // 心率提醒\r
\r
- VIEW_TRAINING, // 训练\r
- VIEW_TRAININGMORE, // 更多训练\r
- VIEW_TRAININGLIMIT, // 极限运动子列表\r
- VIEW_TRAININGNOMAL, // 正常训练开始界面(除骑行,健走,跑步外)\r
- VIEW_TRAININGSET, // 训练目标(时长,卡路里)\r
- VIEW_TRAININGGPSSET, // GPS训练目标(时长,距离,卡路里,步数)\r
- VIEW_TRAININGSETTIME, // 设置训练时长\r
- VIEW_TRAININGSETCALULI, // 设置训练卡路里\r
- VIEW_TRAININGSETDIST, // 设置训练路程\r
- VIEW_TRAININGSETSTEP, // 设置训练步数\r
- VIEW_TRAININGCRAD, // 训练卡片\r
- VIEW_TRAININGCONTROL, // 训练控制(包括结束,暂停,继续训练)\r
- VIEW_TRAININGDATA, // 训练数据\r
- VIEW_TRAININGDETAIL, // 详细训练数据 \r
- VIEW_TRAININGENDNOTE, // 结束训练提醒\r
- VIEW_TRAININGENDDATA, // 训练结束详细数据\r
- VIEW_TRAININGGPS, // GPS训练\r
- VIEW_TRAININGGPSLACK, // 缺少GPS\r
- VIEW_TRAININGGPSNOTE, // 连接GPS提醒\r
- VIEW_TRAININGSTRONG, // 训练强度介绍\r
- \r
- VIEW_TRAINING_RECORD, // 训练记录\r
- \r
- VIEW_BLOODPRESSURE, // 昨日睡眠时间\r
- VIEW_SLEEPTIME, // 睡眠详细数据\r
- VIEW_SLEEPACT, // 睡眠事项说明\r
- VIEW_MUSIC, // 音乐\r
- VIEW_WEATHER, // 天气\r
- VIEW_WEATHER_REPORT, // 气象报告\r
- VIEW_FUTURE_WEATHER, // 未来天气\r
- VIEW_GET_WEATHER_DATA_ERROR, // 获取天气数据失败\r
- VIEW_RECORD, // 录音\r
+ VIEW_TRAINING, // 训练\r
+ VIEW_TRAININGMORE, // 更多训练\r
+ VIEW_TRAININGLIMIT, // 极限运动子列表\r
+ VIEW_TRAININGNOMAL, // 正常训练开始界面(除骑行,健走,跑步外)\r
+ VIEW_TRAININGSET, // 训练目标(时长,卡路里)\r
+ VIEW_TRAININGGPSSET, // GPS训练目标(时长,距离,卡路里,步数)\r
+ VIEW_TRAININGSETTIME, // 设置训练时长\r
+ VIEW_TRAININGSETCALULI, // 设置训练卡路里\r
+ VIEW_TRAININGSETDIST, // 设置训练路程\r
+ VIEW_TRAININGSETSTEP, // 设置训练步数\r
+ VIEW_TRAININGCRAD, // 训练卡片\r
+ VIEW_TRAININGCONTROL, // 训练控制(包括结束,暂停,继续训练)\r
+ VIEW_TRAININGDATA, // 训练数据\r
+ VIEW_TRAININGDETAIL, // 详细训练数据\r
+ VIEW_TRAININGENDNOTE, // 结束训练提醒\r
+ VIEW_TRAININGENDNOTE2, // 结束训练时间太短\r
+ VIEW_TRAININGENDDATA, // 训练结束详细数据\r
+ VIEW_TRAININGGPS, // GPS训练\r
+ VIEW_TRAININGGPSLACK, // 缺少GPS\r
+ VIEW_TRAININGGPSNOTE, // 连接GPS提醒\r
+ VIEW_TRAININGSTRONG, // 训练强度介绍\r
+ VIEW_TRAININGGPSLOST, // GPS断联\r
+ VIEW_TRAININGGPSBACK, // GPS回连\r
+ VIEW_TRAININGWIN, // 目标达成\r
+\r
+ VIEW_TRAINING_RECORD, // 训练记录\r
+\r
+ VIEW_BLOODPRESSURE, // 昨日睡眠时间\r
+ VIEW_SLEEPTIME, // 睡眠详细数据\r
+ VIEW_SLEEPACT, // 睡眠事项说明\r
+ VIEW_MUSIC, // 音乐\r
+ VIEW_WEATHER, // 天气\r
+ VIEW_WEATHER_REPORT, // 气象报告\r
+ VIEW_FUTURE_WEATHER, // 未来天气\r
+ VIEW_GET_WEATHER_DATA_ERROR, // 获取天气数据失败\r
+ VIEW_RECORD, // 录音\r
// 录音\r
VIEW_RECORD_LIST,\r
VIEW_RECORD_PLAY,\r
VIEW_RECORD_DELETE,\r
VIEW_RECORD_GOING,\r
// 电话\r
- VIEW_PHONE, // 电话\r
- VIEW_PHONECALL, // 拨号\r
- VIEW_PHONERING, // 拨号界面\r
- VIEW_PHONECALLING, // 来电\r
- VIEW_PHONECALLUP, // 通话界面\r
- VIEW_PHONEDIR, // 电话簿\r
- VIEW_MAIN_STOPWATCH,// 秒表主视图\r
- VIEW_STOPWATCH_RECORD_CYCLE_TO_LIMIT, //秒表记录圈速到达上限\r
- VIEW_STOPWATCH_RECORD_TIME_TO_LIMIT, //秒表记录时间到达上限\r
- VIEW_MAIN_COUNTDOWN,// 倒计时主视图\r
- VIEW_COUNTDOWN_TIME_CONFIG,//倒计时时间配置\r
- VIEW_START_COUNTDOWN,//开始倒计时\r
- VIEW_COUNTDOWN_TIME_NOT_NULL,//倒计时时间不能为0\r
- VIEW_BLUETOOTH, // 蓝牙\r
+ VIEW_PHONE, // 电话\r
+ VIEW_PHONECALL, // 拨号\r
+ VIEW_PHONERING, // 拨号界面\r
+ VIEW_PHONECALLING, // 来电\r
+ VIEW_PHONECALLUP, // 通话界面\r
+ VIEW_PHONEDIR, // 电话簿\r
+ \r
+ VIEW_MAIN_STOPWATCH, // 秒表主视图\r
+ VIEW_STOPWATCH_RECORD_CYCLE_TO_LIMIT, // 秒表记录圈速到达上限\r
+ VIEW_STOPWATCH_RECORD_TIME_TO_LIMIT, // 秒表记录时间到达上限\r
+ VIEW_MAIN_COUNTDOWN, // 倒计时主视图\r
+ VIEW_COUNTDOWN_TIME_CONFIG, // 倒计时时间配置\r
+ VIEW_START_COUNTDOWN, // 开始倒计时\r
+ VIEW_COUNTDOWN_TIME_NOT_NULL, // 倒计时时间不能为0\r
+ VIEW_BLUETOOTH, // 蓝牙\r
// 设置\r
VIEW_DISPLAY_BRIGHTNESS, // 屏幕与亮度\r
VIEW_CONNECT_BLUETOOTH, // 蓝牙\r
VIEW_SYSTEM_VOLUME, // 系统音量\r
VIEW_CALL_VOLUME, // 通话音量\r
VIEW_MEDIA_VOLUME, // 媒体音量\r
- VIEW_SECONDARY_FUNCTION, //辅助功能\r
+ VIEW_SECONDARY_FUNCTION, // 辅助功能\r
VIEW_SYSTEM, // 系统\r
// 系统\r
VIEW_SYSTEM_ABOUT_WATCH, // 系统:关于手表\r
VIEW_SYSTEM_FACTORY_RESET, // 系统:恢复出厂设置\r
VIEW_BRIGHTNESS_CONTROL, // 亮度调节\r
VIEW_SCREEN_DURATION, // 亮屏时长\r
- //按键按下进入的视图\r
- VIEW_QUICK_ACCESS, // 快速访问\r
- VIEW_FAST_TRAINING, //快速训练\r
- VIEW_FAST_TRAINING_ATTENTION,//快速训练项目选择超出提示\r
- VIEW_MAX_INTER_APP, // 在此之前添加native应用ID\r
- VIEW_EXTERN_APP = 0xFFFE, // 三方应用\r
+ // 按键按下进入的视图\r
+ VIEW_QUICK_ACCESS, // 快速访问\r
+ VIEW_FAST_TRAINING, // 快速训练\r
+ VIEW_FAST_TRAINING_ATTENTION, // 快速训练项目选择超出提示\r
+ VIEW_MAX_INTER_APP, // 在此之前添加native应用ID\r
+ VIEW_EXTERN_APP = 0xFFFE, // 三方应用\r
VIEW_INVALIDE_APP = 0xFFFF,\r
} AppViewId;\r
\r
void InitTraingDataSlice(void);\r
void InitTraingDetailSlice(void);\r
void InitTraingEndnoteSlice(void);\r
+ void InitTraingEndnote2Slice(void);\r
void InitTraingEnddataSlice(void);\r
void InitTraingGPSSlice(void);\r
void InitTraingGPSlackSlice(void);\r
void InitTraingGPSnoteSlice(void);\r
+ void InitTraingGPSlostSlice(void);\r
+ void InitTraingGPSbackSlice(void);\r
+ void InitTraingWinSlice(void);\r
void InitUIDisplayBrightnessSlice(void); \r
void InitBlueToothSettingSlice(void); \r
void InitBrightnessControlSlice(void); \r
#include "traing/include/TraingDetailView.h"\r
#include "traing/include/TraingEndnotePresenter.h"\r
#include "traing/include/TraingEndnoteView.h"\r
+#include "traing/include/TraingEndnote2Presenter.h"\r
+#include "traing/include/TraingEndnote2View.h"\r
#include "traing/include/TraingEnddataPresenter.h"\r
#include "traing/include/TraingEnddataView.h"\r
#include "traing/include/TraingGPSPresenter.h"\r
#include "traing/include/TraingGPSnoteView.h"\r
#include "traing/include/TraingStrongPresenter.h"\r
#include "traing/include/TraingStrongView.h"\r
+#include "traing/include/TraingGPSlostPresenter.h"\r
+#include "traing/include/TraingGPSlostView.h"\r
+#include "traing/include/TraingGPSbackPresenter.h"\r
+#include "traing/include/TraingGPSbackView.h"\r
+#include "traing/include/TraingWinPresenter.h"\r
+#include "traing/include/TraingWinView.h"\r
#include "displaybrightness/include/DisplayBrightnessPresenter.h"\r
#include "displaybrightness/include/DisplayBrightnessView.h"\r
#include "bluetoothofsetting/include/BlueToothOfSettingPresenter.h"\r
{VIEW_TRAININGDATA, &NativeLauncher::InitTraingDataSlice}, //训练数据 \r
{VIEW_TRAININGDETAIL, &NativeLauncher::InitTraingDetailSlice}, //详细训练数据\r
{VIEW_TRAININGENDNOTE, &NativeLauncher::InitTraingEndnoteSlice}, //训练结束提醒\r
+ {VIEW_TRAININGENDNOTE2, &NativeLauncher::InitTraingEndnote2Slice}, //训练结束时间太短提醒\r
{VIEW_TRAININGENDDATA, &NativeLauncher::InitTraingEnddataSlice}, //训练结束详细数据 \r
{VIEW_TRAININGGPS, &NativeLauncher::InitTraingGPSSlice}, //GPS训练\r
{VIEW_TRAININGGPSLACK, &NativeLauncher::InitTraingGPSlackSlice}, //GPS缺少\r
{VIEW_TRAININGGPSNOTE, &NativeLauncher::InitTraingGPSnoteSlice}, //提醒连接GPS\r
- {VIEW_TRAININGSTRONG, &NativeLauncher::InitTraingStrongSlice}, //训练强度介绍\r
+ {VIEW_TRAININGSTRONG, &NativeLauncher::InitTraingStrongSlice}, //训练强度介绍\r
+ {VIEW_TRAININGGPSLOST, &NativeLauncher::InitTraingGPSlostSlice}, //GPS断联\r
+ {VIEW_TRAININGGPSBACK, &NativeLauncher::InitTraingGPSbackSlice}, //GPS回连\r
+ {VIEW_TRAININGWIN, &NativeLauncher::InitTraingWinSlice}, //训练目标达成\r
\r
\r
{VIEW_DISPLAY_BRIGHTNESS,&NativeLauncher::InitUIDisplayBrightnessSlice}, //显示与亮度的实例化地址\r
SliceProxy *traingendnoteview = new AbilitySliceProxy<TraingEndnoteView, TraingEndnotePresenter>;\r
NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGENDNOTE, traingendnoteview);\r
}\r
+void NativeLauncher::InitTraingEndnote2Slice(void)\r
+{\r
+ SliceProxy *traingendnote2view = new AbilitySliceProxy<TraingEndnote2View, TraingEndnote2Presenter>;\r
+ NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGENDNOTE2, traingendnote2view);\r
+}\r
void NativeLauncher::InitTraingEnddataSlice(void)\r
{\r
SliceProxy *traingenddataview = new AbilitySliceProxy<TraingEnddataView, TraingEnddataPresenter>;\r
SliceProxy *traingStrongview = new AbilitySliceProxy<TraingStrongView, TraingStrongPresenter>;\r
NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGSTRONG, traingStrongview);\r
}\r
+void NativeLauncher::InitTraingGPSlostSlice(void)\r
+{\r
+ SliceProxy *traingGPSlostview = new AbilitySliceProxy<TraingGPSlostView, TraingGPSlostPresenter>;\r
+ NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGGPSLOST, traingGPSlostview);\r
+}\r
+void NativeLauncher::InitTraingGPSbackSlice(void)\r
+{\r
+ SliceProxy *traingGPSbackview = new AbilitySliceProxy<TraingGPSbackView, TraingGPSbackPresenter>;\r
+ NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGGPSBACK, traingGPSbackview);\r
+}\r
+void NativeLauncher::InitTraingWinSlice(void)\r
+{\r
+ SliceProxy *traingwinview = new AbilitySliceProxy<TraingWinView, TraingWinPresenter>;\r
+ NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGWIN, traingwinview);\r
+}\r
//DisplayBrightness的实例化\r
void NativeLauncher::InitUIDisplayBrightnessSlice(void)\r
{\r
--- /dev/null
+#ifndef _TraingEndnote2_PRESENTER_H
+#define _TraingEndnote2_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingEndnote2View.h"
+
+namespace OHOS
+{
+ class TraingEndnote2View;
+
+ class TraingEndnote2Presenter : public Presenter<TraingEndnote2View>,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener
+ {
+ public:
+ TraingEndnote2Presenter();
+ virtual ~TraingEndnote2Presenter();
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+ static TraingEndnote2Presenter *GetInstance();
+
+ private:
+ // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+#ifndef _TraingEndnote2_VIEW_H
+#define _TraingEndnote2_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include <ui_scroll_view.h>
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_chart.h"
+#include "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingEndnote2Presenter.h"
+namespace OHOS
+{
+#define BUTTONNO "button1"
+#define BUTTONYES "button2"
+
+ class TraingEndnote2Presenter;
+ class TraingEndnote2View : public View<TraingEndnote2Presenter>
+ {
+
+ public:
+ TraingEndnote2View();
+ virtual ~TraingEndnote2View();
+ static TraingEndnote2View *GetInstance(void);
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStop() override;
+ void InitView();
+ void DeInit();
+ void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+ void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+ void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+ void InitList();
+ void PreLoad(void);
+
+ // 通过函数改变
+ void SetLabel();
+ void SetButton();
+
+ private:
+ UIView::OnDragListener *draglistener{nullptr};
+ TraingEndnote2View(TraingEndnote2View &&) = delete;
+ TraingEndnote2View &operator=(TraingEndnote2View &&) = delete;
+
+ UIViewGroup *container_ = nullptr;
+
+ UILabel *label1_ = nullptr;
+ UILabel *label2_ = nullptr;
+
+ UIButton *button1_ = nullptr;
+ UIButton *button2_ = nullptr;
+ bool viewiInitStatus{false};
+ };
+} // namespace OHOS
+#endif // TraingEndnote2_PRESENTER_H
--- /dev/null
+#ifndef _TraingGPSback_PRESENTER_H
+#define _TraingGPSback_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingGPSbackView.h"
+
+namespace OHOS
+{
+ class TraingGPSbackView;
+
+ class TraingGPSbackPresenter : public Presenter<TraingGPSbackView>,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener
+ {
+ public:
+ TraingGPSbackPresenter();
+ virtual ~TraingGPSbackPresenter();
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+
+ static TraingGPSbackPresenter *GetInstance();
+
+ private:
+ // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+#ifndef _TraingGPSback_VIEW_H
+#define _TraingGPSback_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include <ui_scroll_view.h>
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_chart.h"
+#include "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingGPSbackPresenter.h"
+namespace OHOS
+{
+#define BUTTONOK "button1"
+
+
+ class TraingGPSbackPresenter;
+ class TraingGPSbackView : public View<TraingGPSbackPresenter>
+ {
+
+ public:
+ TraingGPSbackView();
+ virtual ~TraingGPSbackView();
+ static TraingGPSbackView *GetInstance(void);
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStop() override;
+ void InitView();
+ void DeInit();
+ void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+ void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+ void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+ void InitList();
+ void PreLoad(void);
+
+ private:
+ UIView::OnDragListener *draglistener{nullptr};
+ TraingGPSbackView(TraingGPSbackView &&) = delete;
+ TraingGPSbackView &operator=(TraingGPSbackView &&) = delete;
+ UIViewGroup *container_ = nullptr;
+ UILabel *label1_ = nullptr;
+ UILabel *label2_ = nullptr;
+ UIButton *button1_ = nullptr;
+ UIImageView *image1_ = nullptr;
+ bool viewiInitStatus{false};
+ };
+} // namespace OHOS
+#endif // TraingGPSback_PRESENTER_H
--- /dev/null
+#ifndef _TraingGPSlost_PRESENTER_H
+#define _TraingGPSlost_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingGPSlostView.h"
+
+namespace OHOS
+{
+ class TraingGPSlostView;
+
+ class TraingGPSlostPresenter : public Presenter<TraingGPSlostView>,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener
+ {
+ public:
+ TraingGPSlostPresenter();
+ virtual ~TraingGPSlostPresenter();
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+
+ static TraingGPSlostPresenter *GetInstance();
+
+ private:
+ // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+#ifndef _TraingGPSlost_VIEW_H
+#define _TraingGPSlost_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include <ui_scroll_view.h>
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_chart.h"
+#include "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingGPSlostPresenter.h"
+namespace OHOS
+{
+#define BUTTONOK "button1"
+
+
+ class TraingGPSlostPresenter;
+ class TraingGPSlostView : public View<TraingGPSlostPresenter>
+ {
+
+ public:
+ TraingGPSlostView();
+ virtual ~TraingGPSlostView();
+ static TraingGPSlostView *GetInstance(void);
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStop() override;
+ void InitView();
+ void DeInit();
+ void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+ void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+ void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+ void InitList();
+ void PreLoad(void);
+
+ private:
+ UIView::OnDragListener *draglistener{nullptr};
+ TraingGPSlostView(TraingGPSlostView &&) = delete;
+ TraingGPSlostView &operator=(TraingGPSlostView &&) = delete;
+ UIViewGroup *container_ = nullptr;
+ UILabel *label1_ = nullptr;
+ UILabel *label2_ = nullptr;
+ UIButton *button1_ = nullptr;
+ UIImageView *image1_ = nullptr;
+ bool viewiInitStatus{false};
+ };
+} // namespace OHOS
+#endif // TraingGPSlost_PRESENTER_H
--- /dev/null
+#ifndef _TraingWin_PRESENTER_H
+#define _TraingWin_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingWinView.h"
+
+namespace OHOS
+{
+ class TraingWinView;
+
+ class TraingWinPresenter : public Presenter<TraingWinView>,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener
+ {
+ public:
+ TraingWinPresenter();
+ virtual ~TraingWinPresenter();
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+
+ static TraingWinPresenter *GetInstance();
+
+ private:
+ // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+#ifndef _TraingWin_VIEW_H
+#define _TraingWin_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include <ui_scroll_view.h>
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_chart.h"
+#include "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingWinPresenter.h"
+namespace OHOS
+{
+#define BUTTONOK "button1"
+
+ class TraingWinPresenter;
+ class TraingWinView : public View<TraingWinPresenter>
+ {
+
+ public:
+ TraingWinView();
+ virtual ~TraingWinView();
+ static TraingWinView *GetInstance(void);
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStop() override;
+ void InitView();
+ void DeInit();
+ void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+ void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+ void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+ void InitList();
+ void PreLoad(void);
+
+ private:
+ UIView::OnDragListener *draglistener{nullptr};
+ TraingWinView(TraingWinView &&) = delete;
+ TraingWinView &operator=(TraingWinView &&) = delete;
+ UIViewGroup *container_ = nullptr;
+ UILabel *label1_ = nullptr;
+ UILabel *label2_ = nullptr;
+ UILabel *label3_ = nullptr;
+ UILabel *label4_ = nullptr;
+ UIButton *button1_ = nullptr;
+ UIImageView *image1_ = nullptr;
+ bool viewiInitStatus{false};
+ };
+} // namespace OHOS
+#endif // TraingWin_PRESENTER_H
// 根据控件id查找是哪个控件触发了点击回调\r
if (strcmp(view.GetViewId(), BUTTONSTOP) == 0)\r
{\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDNOTE);\r
+ // 模拟训练\r
+ int random = rand() % 100; // 生成一个0~99的随机数\r
+ if (random < 70)\r
+ {\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDNOTE2);\r
+ }\r
+ else\r
+ {\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDNOTE);\r
+ }\r
}\r
\r
printf("********* test:%s\n", test.c_str());\r
--- /dev/null
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingEndnote2Presenter.h"
+// #include "TraingEndnote2View.h"
+
+namespace OHOS
+{
+
+ // 当前Presenter属性实例化的内存指针
+ static TraingEndnote2Presenter *g_pTraingEndnote2Presenter = nullptr;
+
+ TraingEndnote2Presenter::TraingEndnote2Presenter()
+ {
+
+ g_pTraingEndnote2Presenter = this;
+ }
+
+ TraingEndnote2Presenter::~TraingEndnote2Presenter()
+ {
+
+ g_pTraingEndnote2Presenter = nullptr;
+ }
+
+ TraingEndnote2Presenter *TraingEndnote2Presenter::GetInstance()
+ {
+
+ return g_pTraingEndnote2Presenter;
+ }
+
+ void TraingEndnote2Presenter::OnStart()
+ {
+
+ Presenter<TraingEndnote2View>::OnStart();
+ }
+
+ void TraingEndnote2Presenter::OnPause(void)
+ {
+
+ Presenter<TraingEndnote2View>::OnPause();
+ }
+
+ void TraingEndnote2Presenter::OnResume(void)
+ {
+
+ Presenter<TraingEndnote2View>::OnResume();
+ }
+
+ void TraingEndnote2Presenter::OnStop(void)
+ {
+
+ Presenter<TraingEndnote2View>::OnStop();
+ }
+
+ bool TraingEndnote2Presenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+
+ // if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM)
+ // {
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA);
+ // }
+ UNUSED(view);
+ return true;
+ }
+
+ bool TraingEndnote2Presenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+
+ // 根据控件id查找是哪个控件触发了点击回调
+ if (strcmp(view.GetViewId(), BUTTONNO) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL);
+ }
+ if (strcmp(view.GetViewId(), BUTTONYES) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
+ }
+ return true;
+ }
+}
--- /dev/null
+
+#include "traing/include/TraingEndnote2View.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+ static const char *imagePath_no = "/user/res/Training/no.bin";
+ static const char *imagePath_yes = "/user/res/Training/yes.bin";
+
+ static TraingEndnote2View *g_pTraingEndnote2View{nullptr};
+
+ TraingEndnote2View::TraingEndnote2View()
+ {
+ g_pTraingEndnote2View = this;
+ }
+
+ TraingEndnote2View::~TraingEndnote2View()
+ {
+ DeInit();
+ g_pTraingEndnote2View = nullptr;
+ }
+
+ TraingEndnote2View *TraingEndnote2View::GetInstance()
+ {
+
+ return g_pTraingEndnote2View;
+ }
+ /*
+ InitLabel:初始化标签
+ @param label 标签指针
+ @param left 标签左边位置
+ @param top 标签顶部位置
+ @param width 标签宽度
+ @param height 标签高度
+ @param viewId 标签的视图 ID
+ @param text 标签显示的文本
+ @param fontName 字体名称
+ @param fontSize 字体大小
+ */
+ void TraingEndnote2View::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)
+ {
+ // 检查标签指针是否为空
+ if (label == nullptr)
+ {
+ label = new UILabel();
+ }
+ // 设置标签的位置和大小
+ label->SetPosition(left, top);
+ label->Resize(width, height);
+ // 设置标签的视图 ID
+ label->SetViewId(viewId);
+ // 设置标签的样式
+ label->SetStyle(STYLE_TEXT_FONT, fontSize);
+ label->SetFont(fontName, fontSize);
+ // 设置标签的文本和其他属性
+ label->SetText(text);
+ label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label->SetRollSpeed(0);
+ // 设置标签可见
+ label->SetVisible(true);
+ }
+ /*
+ InitButton:初始化按钮
+ @param button 按钮指针
+ @param left 按钮左边位置
+ @param top 按钮顶部位置
+ @param width 按钮宽度
+ @param height 按钮高度
+ @param viewId 按钮的视图 ID
+ */
+ void TraingEndnote2View::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+ {
+ // 设置按钮的背景颜色
+ uint32_t backgroundColor = 0xff191919; // 默认背景颜色
+ uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+ uint32_t pressedBorderColor = 0xff0b1928; // 按下时的边框颜色
+ // 创建新按钮(如果当前按钮为空)
+ if (button == nullptr)
+ {
+ button = new UIButton();
+ }
+ button->SetPosition(left, top);
+ button->Resize(width, height);
+ button->SetViewId(viewId);
+ button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+ button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+ button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+ // 设置按钮的点击事件监听器为 TraingEndnote2Presenter 的实例
+ button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingEndnote2Presenter::GetInstance()));
+ // 设置按钮可见
+ button->SetVisible(true);
+ }
+ /*
+ InitImageView:初始化图片
+ @param imageView 图片指针
+ @param left 图片左边位置
+ @param top 图片顶部位置
+ @param width 图片宽度
+ @param height 图片高度
+ @param viewId 图片的视图 ID
+ @param imagePath 图片路径
+ */
+ void TraingEndnote2View::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+ {
+ if (imageView == nullptr)
+ {
+ imageView = new UIImageView();
+ }
+ imageView->SetPosition(left, top);
+ imageView->Resize(width, height);
+ imageView->SetViewId(viewId);
+ imageView->SetSrc(imagePath);
+ imageView->SetVisible(true);
+ }
+ /* InitView:初始化界面*/
+ void TraingEndnote2View ::InitView()
+ {
+ if (container_ == nullptr)
+ {
+ container_ = new UIViewGroup();
+ container_->SetPosition(0, 0, 466, 466);
+ container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+ }
+
+ // 初始化Lable
+ InitLabel(label1_, 173, 52, 90, 35, "label1", "注意", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(label2_, 116, 187, 60, 40, "label2", "当前运动量太小,无法记录\n是否结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ container_->Add(label1_);
+ container_->Add(label2_);
+
+ InitButton(button1_, 111, 299, 100, 100, BUTTONNO);
+ // Set additional property
+ const char *button1defaultImgSrc = imagePath_no;
+ char *button1triggeredImgSrc = nullptr;
+ button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+
+ InitButton(button2_, 256, 299, 100, 100, BUTTONYES);
+ // Set additional property
+ const char *button2defaultImgSrc = imagePath_yes;
+ char *button2triggeredImgSrc = nullptr;
+ button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);
+
+ container_->Add(button1_);
+ container_->Add(button2_);
+ }
+
+ /* DeInit:删除组件 */
+ void TraingEndnote2View::DeInit()
+ {
+ UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+ while (view != nullptr)
+ {
+ UIView *tempView = view;
+ view = view->GetNextSibling();
+ if (tempView->GetParent())
+ {
+ static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+ }
+ delete tempView;
+ }
+ delete container_;
+ container_ = nullptr;
+ }
+
+ void TraingEndnote2View::PreLoad(void)
+ {
+ if (!viewiInitStatus)
+ {
+ InitView();
+ viewiInitStatus = true;
+ }
+ }
+ void TraingEndnote2View::OnStart()
+ {
+ container_ = new UIViewGroup();
+ if (container_ == nullptr)
+ {
+ return;
+ }
+ container_->SetPosition(0, 0);
+ container_->SetWidth(Screen::GetInstance().GetWidth());
+ container_->SetHeight(Screen::GetInstance().GetHeight());
+
+ // 创建 draglistener 实例并设置为拖动监听器
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingEndnote2Presenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return;
+ }
+ container_->SetOnDragListener(draglistener);
+
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+
+ PreLoad();
+ RootView::GetInstance()->Add(container_);
+ }
+
+ void TraingEndnote2View::OnSetUpView()
+ {
+
+ View<TraingEndnote2Presenter>::OnSetUpView();
+ Draw();
+ }
+
+ void TraingEndnote2View::OnTearDownView()
+ {
+
+ View<TraingEndnote2Presenter>::OnTearDownView();
+ return;
+ }
+
+ void TraingEndnote2View::OnStop()
+ {
+ View<TraingEndnote2Presenter>::OnStop();
+ RootView::GetInstance()->RemoveAll();
+ return;
+ }
+}
}
if (strcmp(view.GetViewId(), BUTTONYES) == 0)
{
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDDATA);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGWIN);
}
return true;
}
--- /dev/null
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingGPSbackPresenter.h"
+// #include "TraingGPSbackView.h"
+
+namespace OHOS
+{
+
+ // 当前Presenter属性实例化的内存指针
+ static TraingGPSbackPresenter *g_pTraingGPSbackPresenter = nullptr;
+
+ TraingGPSbackPresenter::TraingGPSbackPresenter()
+ {
+
+ g_pTraingGPSbackPresenter = this;
+ }
+
+ TraingGPSbackPresenter::~TraingGPSbackPresenter()
+ {
+
+ g_pTraingGPSbackPresenter = nullptr;
+ }
+
+ TraingGPSbackPresenter *TraingGPSbackPresenter::GetInstance()
+ {
+
+ return g_pTraingGPSbackPresenter;
+ }
+
+ void TraingGPSbackPresenter::OnStart()
+ {
+
+ Presenter<TraingGPSbackView>::OnStart();
+ }
+
+ void TraingGPSbackPresenter::OnPause(void)
+ {
+
+ Presenter<TraingGPSbackView>::OnPause();
+ }
+
+ void TraingGPSbackPresenter::OnResume(void)
+ {
+
+ Presenter<TraingGPSbackView>::OnResume();
+ }
+
+ void TraingGPSbackPresenter::OnStop(void)
+ {
+
+ Presenter<TraingGPSbackView>::OnStop();
+ }
+
+ bool TraingGPSbackPresenter::OnDrag(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();
+ // NativeAbility::GetInstance().ChangeSlice(preSlice);
+ // }
+ UNUSED(view);
+ return true;
+ }
+
+ bool TraingGPSbackPresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ // 根据控件id查找是哪个控件触发了点击回调
+ if (strcmp(view.GetViewId(), BUTTONOK) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL);
+ }
+ return true;
+ }
+}
--- /dev/null
+
+#include "traing/include/TraingGPSbackView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+ static const char *imagePath_warning = "/user/res/Training/back.bin";
+ static TraingGPSbackView *g_pTraingGPSbackView{nullptr};
+
+ TraingGPSbackView::TraingGPSbackView()
+ {
+ g_pTraingGPSbackView = this;
+ }
+
+ TraingGPSbackView::~TraingGPSbackView()
+ {
+ DeInit();
+ g_pTraingGPSbackView = nullptr;
+ }
+
+ TraingGPSbackView *TraingGPSbackView::GetInstance()
+ {
+
+ return g_pTraingGPSbackView;
+ }
+ /*
+ InitLabel:初始化标签
+ @param label 标签指针
+ @param left 标签左边位置
+ @param top 标签顶部位置
+ @param width 标签宽度
+ @param height 标签高度
+ @param viewId 标签的视图 ID
+ @param text 标签显示的文本
+ @param fontName 字体名称
+ @param fontSize 字体大小
+ */
+ void TraingGPSbackView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)
+ {
+ // 检查标签指针是否为空
+ if (label == nullptr)
+ {
+ label = new UILabel();
+ }
+ // 设置标签的位置和大小
+ label->SetPosition(left, top);
+ label->Resize(width, height);
+ // 设置标签的视图 ID
+ label->SetViewId(viewId);
+ // 设置标签的样式
+ label->SetStyle(STYLE_TEXT_FONT, fontSize);
+ label->SetFont(fontName, fontSize);
+ // 设置标签的文本和其他属性
+ label->SetText(text);
+ label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label->SetRollSpeed(0);
+ // 设置标签可见
+ label->SetVisible(true);
+ }
+ /*
+ InitButton:初始化按钮
+ @param button 按钮指针
+ @param left 按钮左边位置
+ @param top 按钮顶部位置
+ @param width 按钮宽度
+ @param height 按钮高度
+ @param viewId 按钮的视图 ID
+ */
+ void TraingGPSbackView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+ {
+ // 设置按钮的背景颜色
+ uint32_t backgroundColor = 0xff191919; // 默认背景颜色
+ uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+ uint32_t pressedBorderColor = 0xff0b1928; // 按下时的边框颜色
+ // 创建新按钮(如果当前按钮为空)
+ if (button == nullptr)
+ {
+ button = new UIButton();
+ }
+ button->SetPosition(left, top);
+ button->Resize(width, height);
+ button->SetViewId(viewId);
+ button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+ button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+ button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+ // 设置按钮的点击事件监听器为 TraingGPSbackPresenter 的实例
+ button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingGPSbackPresenter::GetInstance()));
+ // 设置按钮可见
+ button->SetVisible(true);
+ }
+ /*
+ InitImageView:初始化图片
+ @param imageView 图片指针
+ @param left 图片左边位置
+ @param top 图片顶部位置
+ @param width 图片宽度
+ @param height 图片高度
+ @param viewId 图片的视图 ID
+ @param imagePath 图片路径
+ */
+ void TraingGPSbackView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+ {
+ if (imageView == nullptr)
+ {
+ imageView = new UIImageView();
+ }
+ imageView->SetPosition(left, top);
+ imageView->Resize(width, height);
+ imageView->SetViewId(viewId);
+ imageView->SetSrc(imagePath);
+ imageView->SetVisible(true);
+ }
+
+ /* InitView:初始化界面*/
+ void TraingGPSbackView ::InitView()
+ {
+ if (container_ == nullptr)
+ {
+ container_ = new UIViewGroup();
+ container_->SetPosition(0, 0, 466, 466);
+ container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+ }
+
+ // 初始化Lable
+ InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS连接", DEFAULT_VECTOR_FONT_FILENAME, 35);
+ container_->Add(label1_);
+ InitLabel(label2_, 55, 253, 146, 35, "label2", "GPS已连接,当前信号正常", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ container_->Add(label2_);
+
+ // 初始化image
+ InitImageView(image1_, 193, 140, 40, 40, "image1", imagePath_warning);
+ container_->Add(image1_);
+
+ // 初始化Button
+ InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
+ // Set additional property
+ char *button1defaultImgSrc = "/user/res/Training/buttonok.bin";
+ char *button1triggeredImgSrc = nullptr;
+ button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+ container_->Add(button1_);
+
+ }
+ /* DeInit:删除组件*/
+ void TraingGPSbackView::DeInit()
+ {
+ UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+ while (view != nullptr)
+ {
+ UIView *tempView = view;
+ view = view->GetNextSibling();
+ if (tempView->GetParent())
+ {
+ static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+ }
+ delete tempView;
+ }
+ delete container_;
+ container_ = nullptr;
+ }
+
+ void TraingGPSbackView::PreLoad(void)
+ {
+ if (!viewiInitStatus)
+ {
+ InitView();
+ viewiInitStatus = true;
+ }
+ }
+ void TraingGPSbackView::OnStart()
+ {
+ container_ = new UIViewGroup();
+ if (container_ == nullptr)
+ {
+ return;
+ }
+ container_->SetPosition(0, 0);
+ container_->SetWidth(Screen::GetInstance().GetWidth());
+ container_->SetHeight(Screen::GetInstance().GetHeight());
+
+ // 创建 draglistener 实例并设置为拖动监听器
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSbackPresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return;
+ }
+ container_->SetOnDragListener(draglistener);
+
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+
+ PreLoad();
+ RootView::GetInstance()->Add(container_);
+ }
+
+ void TraingGPSbackView::OnSetUpView()
+ {
+
+ View<TraingGPSbackPresenter>::OnSetUpView();
+ Draw();
+ }
+
+ void TraingGPSbackView::OnTearDownView()
+ {
+
+ View<TraingGPSbackPresenter>::OnTearDownView();
+ return;
+ }
+
+ void TraingGPSbackView::OnStop()
+ {
+ View<TraingGPSbackPresenter>::OnStop();
+ RootView::GetInstance()->RemoveAll();
+ return;
+ }
+}
--- /dev/null
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingGPSlostPresenter.h"
+// #include "TraingGPSlostView.h"
+
+namespace OHOS
+{
+
+ // 当前Presenter属性实例化的内存指针
+ static TraingGPSlostPresenter *g_pTraingGPSlostPresenter = nullptr;
+
+ TraingGPSlostPresenter::TraingGPSlostPresenter()
+ {
+
+ g_pTraingGPSlostPresenter = this;
+ }
+
+ TraingGPSlostPresenter::~TraingGPSlostPresenter()
+ {
+
+ g_pTraingGPSlostPresenter = nullptr;
+ }
+
+ TraingGPSlostPresenter *TraingGPSlostPresenter::GetInstance()
+ {
+
+ return g_pTraingGPSlostPresenter;
+ }
+
+ void TraingGPSlostPresenter::OnStart()
+ {
+
+ Presenter<TraingGPSlostView>::OnStart();
+ }
+
+ void TraingGPSlostPresenter::OnPause(void)
+ {
+
+ Presenter<TraingGPSlostView>::OnPause();
+ }
+
+ void TraingGPSlostPresenter::OnResume(void)
+ {
+
+ Presenter<TraingGPSlostView>::OnResume();
+ }
+
+ void TraingGPSlostPresenter::OnStop(void)
+ {
+
+ Presenter<TraingGPSlostView>::OnStop();
+ }
+
+ bool TraingGPSlostPresenter::OnDrag(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();
+ // NativeAbility::GetInstance().ChangeSlice(preSlice);
+ // }
+ UNUSED(view);
+ return true;
+ }
+
+ bool TraingGPSlostPresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ // 根据控件id查找是哪个控件触发了点击回调
+ if (strcmp(view.GetViewId(), BUTTONOK) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPSBACK);
+ }
+ return true;
+ }
+}
--- /dev/null
+
+#include "traing/include/TraingGPSlostView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+ static const char *imagePath_warning = "/user/res/Training/warning.bin";
+ static TraingGPSlostView *g_pTraingGPSlostView{nullptr};
+
+ TraingGPSlostView::TraingGPSlostView()
+ {
+ g_pTraingGPSlostView = this;
+ }
+
+ TraingGPSlostView::~TraingGPSlostView()
+ {
+ DeInit();
+ g_pTraingGPSlostView = nullptr;
+ }
+
+ TraingGPSlostView *TraingGPSlostView::GetInstance()
+ {
+
+ return g_pTraingGPSlostView;
+ }
+ /*
+ InitLabel:初始化标签
+ @param label 标签指针
+ @param left 标签左边位置
+ @param top 标签顶部位置
+ @param width 标签宽度
+ @param height 标签高度
+ @param viewId 标签的视图 ID
+ @param text 标签显示的文本
+ @param fontName 字体名称
+ @param fontSize 字体大小
+ */
+ void TraingGPSlostView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)
+ {
+ // 检查标签指针是否为空
+ if (label == nullptr)
+ {
+ label = new UILabel();
+ }
+ // 设置标签的位置和大小
+ label->SetPosition(left, top);
+ label->Resize(width, height);
+ // 设置标签的视图 ID
+ label->SetViewId(viewId);
+ // 设置标签的样式
+ label->SetStyle(STYLE_TEXT_FONT, fontSize);
+ label->SetFont(fontName, fontSize);
+ // 设置标签的文本和其他属性
+ label->SetText(text);
+ label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label->SetRollSpeed(0);
+ // 设置标签可见
+ label->SetVisible(true);
+ }
+ /*
+ InitButton:初始化按钮
+ @param button 按钮指针
+ @param left 按钮左边位置
+ @param top 按钮顶部位置
+ @param width 按钮宽度
+ @param height 按钮高度
+ @param viewId 按钮的视图 ID
+ */
+ void TraingGPSlostView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+ {
+ // 设置按钮的背景颜色
+ uint32_t backgroundColor = 0xff191919; // 默认背景颜色
+ uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+ uint32_t pressedBorderColor = 0xff0b1928; // 按下时的边框颜色
+ // 创建新按钮(如果当前按钮为空)
+ if (button == nullptr)
+ {
+ button = new UIButton();
+ }
+ button->SetPosition(left, top);
+ button->Resize(width, height);
+ button->SetViewId(viewId);
+ button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+ button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+ button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+ // 设置按钮的点击事件监听器为 TraingGPSlostPresenter 的实例
+ button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingGPSlostPresenter::GetInstance()));
+ // 设置按钮可见
+ button->SetVisible(true);
+ }
+ /*
+ InitImageView:初始化图片
+ @param imageView 图片指针
+ @param left 图片左边位置
+ @param top 图片顶部位置
+ @param width 图片宽度
+ @param height 图片高度
+ @param viewId 图片的视图 ID
+ @param imagePath 图片路径
+ */
+ void TraingGPSlostView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+ {
+ if (imageView == nullptr)
+ {
+ imageView = new UIImageView();
+ }
+ imageView->SetPosition(left, top);
+ imageView->Resize(width, height);
+ imageView->SetViewId(viewId);
+ imageView->SetSrc(imagePath);
+ imageView->SetVisible(true);
+ }
+
+ /* InitView:初始化界面*/
+ void TraingGPSlostView ::InitView()
+ {
+ if (container_ == nullptr)
+ {
+ container_ = new UIViewGroup();
+ container_->SetPosition(0, 0, 466, 466);
+ container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+ }
+
+ // 初始化Lable
+ InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS丢失", DEFAULT_VECTOR_FONT_FILENAME, 35);
+ container_->Add(label1_);
+ InitLabel(label2_, 55, 253, 146, 35, "label2", "当前位置搜索不到GPS信号", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ container_->Add(label2_);
+
+ // 初始化image
+ InitImageView(image1_, 193, 140, 40, 40, "image1", imagePath_warning);
+ container_->Add(image1_);
+
+ // 初始化Button
+ InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
+ // Set additional property
+ char *button1defaultImgSrc = "/user/res/Training/buttonok.bin";
+ char *button1triggeredImgSrc = nullptr;
+ button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+ container_->Add(button1_);
+
+ }
+ /* DeInit:删除组件*/
+ void TraingGPSlostView::DeInit()
+ {
+ UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+ while (view != nullptr)
+ {
+ UIView *tempView = view;
+ view = view->GetNextSibling();
+ if (tempView->GetParent())
+ {
+ static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+ }
+ delete tempView;
+ }
+ delete container_;
+ container_ = nullptr;
+ }
+
+ void TraingGPSlostView::PreLoad(void)
+ {
+ if (!viewiInitStatus)
+ {
+ InitView();
+ viewiInitStatus = true;
+ }
+ }
+ void TraingGPSlostView::OnStart()
+ {
+ container_ = new UIViewGroup();
+ if (container_ == nullptr)
+ {
+ return;
+ }
+ container_->SetPosition(0, 0);
+ container_->SetWidth(Screen::GetInstance().GetWidth());
+ container_->SetHeight(Screen::GetInstance().GetHeight());
+
+ // 创建 draglistener 实例并设置为拖动监听器
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSlostPresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return;
+ }
+ container_->SetOnDragListener(draglistener);
+
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+
+ PreLoad();
+ RootView::GetInstance()->Add(container_);
+ }
+
+ void TraingGPSlostView::OnSetUpView()
+ {
+
+ View<TraingGPSlostPresenter>::OnSetUpView();
+ Draw();
+ }
+
+ void TraingGPSlostView::OnTearDownView()
+ {
+
+ View<TraingGPSlostPresenter>::OnTearDownView();
+ return;
+ }
+
+ void TraingGPSlostView::OnStop()
+ {
+ View<TraingGPSlostPresenter>::OnStop();
+ RootView::GetInstance()->RemoveAll();
+ return;
+ }
+}
// 根据控件id查找是哪个控件触发了点击回调
if (strcmp(view.GetViewId(), BUTTONBACK) == 0)
{
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPS);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPSLACK);
}
if (strcmp(view.GetViewId(), BUTTONGO) == 0)
{
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPSLOST);
}
return true;
}
button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c);
scrollView1_->Add(button1_);
- InitButton(button2_, 118, 434, 230, 80, BUTTONBACK);
+ InitButton(button2_, 118, 434, 230, 80, BUTTONGO);
scrollView1_->Add(button2_);
// 初始化Lable
--- /dev/null
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingWinPresenter.h"
+// #include "TraingWinView.h"
+
+namespace OHOS
+{
+
+ // 当前Presenter属性实例化的内存指针
+ static TraingWinPresenter *g_pTraingWinPresenter = nullptr;
+
+ TraingWinPresenter::TraingWinPresenter()
+ {
+
+ g_pTraingWinPresenter = this;
+ }
+
+ TraingWinPresenter::~TraingWinPresenter()
+ {
+
+ g_pTraingWinPresenter = nullptr;
+ }
+
+ TraingWinPresenter *TraingWinPresenter::GetInstance()
+ {
+
+ return g_pTraingWinPresenter;
+ }
+
+ void TraingWinPresenter::OnStart()
+ {
+
+ Presenter<TraingWinView>::OnStart();
+ }
+
+ void TraingWinPresenter::OnPause(void)
+ {
+
+ Presenter<TraingWinView>::OnPause();
+ }
+
+ void TraingWinPresenter::OnResume(void)
+ {
+
+ Presenter<TraingWinView>::OnResume();
+ }
+
+ void TraingWinPresenter::OnStop(void)
+ {
+
+ Presenter<TraingWinView>::OnStop();
+ }
+
+ bool TraingWinPresenter::OnDrag(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();
+ // NativeAbility::GetInstance().ChangeSlice(preSlice);
+ // }
+ UNUSED(view);
+ return true;
+ }
+
+ bool TraingWinPresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ // 根据控件id查找是哪个控件触发了点击回调
+ if (strcmp(view.GetViewId(), BUTTONOK) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDDATA);
+ }
+ return true;
+ }
+}
--- /dev/null
+
+#include "traing/include/TraingWinView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+ static const char *imagePath_win = "/user/res/Training/win.bin";
+ static TraingWinView *g_pTraingWinView{nullptr};
+
+ TraingWinView::TraingWinView()
+ {
+ g_pTraingWinView = this;
+ }
+
+ TraingWinView::~TraingWinView()
+ {
+ DeInit();
+ g_pTraingWinView = nullptr;
+ }
+
+ TraingWinView *TraingWinView::GetInstance()
+ {
+
+ return g_pTraingWinView;
+ }
+ /*
+ InitLabel:初始化标签
+ @param label 标签指针
+ @param left 标签左边位置
+ @param top 标签顶部位置
+ @param width 标签宽度
+ @param height 标签高度
+ @param viewId 标签的视图 ID
+ @param text 标签显示的文本
+ @param fontName 字体名称
+ @param fontSize 字体大小
+ */
+ void TraingWinView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)
+ {
+ // 检查标签指针是否为空
+ if (label == nullptr)
+ {
+ label = new UILabel();
+ }
+ // 设置标签的位置和大小
+ label->SetPosition(left, top);
+ label->Resize(width, height);
+ // 设置标签的视图 ID
+ label->SetViewId(viewId);
+ // 设置标签的样式
+ label->SetStyle(STYLE_TEXT_FONT, fontSize);
+ label->SetFont(fontName, fontSize);
+ // 设置标签的文本和其他属性
+ label->SetText(text);
+ label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label->SetRollSpeed(0);
+ // 设置标签可见
+ label->SetVisible(true);
+ }
+ /*
+ InitButton:初始化按钮
+ @param button 按钮指针
+ @param left 按钮左边位置
+ @param top 按钮顶部位置
+ @param width 按钮宽度
+ @param height 按钮高度
+ @param viewId 按钮的视图 ID
+ */
+ void TraingWinView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+ {
+ // 设置按钮的背景颜色
+ uint32_t backgroundColor = 0xff191919; // 默认背景颜色
+ uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+ uint32_t pressedBorderColor = 0xff0b1928; // 按下时的边框颜色
+ // 创建新按钮(如果当前按钮为空)
+ if (button == nullptr)
+ {
+ button = new UIButton();
+ }
+ button->SetPosition(left, top);
+ button->Resize(width, height);
+ button->SetViewId(viewId);
+ button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+ button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+ button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+ // 设置按钮的点击事件监听器为 TraingWinPresenter 的实例
+ button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingWinPresenter::GetInstance()));
+ // 设置按钮可见
+ button->SetVisible(true);
+ }
+ /*
+ InitImageView:初始化图片
+ @param imageView 图片指针
+ @param left 图片左边位置
+ @param top 图片顶部位置
+ @param width 图片宽度
+ @param height 图片高度
+ @param viewId 图片的视图 ID
+ @param imagePath 图片路径
+ */
+ void TraingWinView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+ {
+ if (imageView == nullptr)
+ {
+ imageView = new UIImageView();
+ }
+ imageView->SetPosition(left, top);
+ imageView->Resize(width, height);
+ imageView->SetViewId(viewId);
+ imageView->SetSrc(imagePath);
+ imageView->SetVisible(true);
+ }
+
+ /* InitView:初始化界面*/
+ void TraingWinView ::InitView()
+ {
+ if (container_ == nullptr)
+ {
+ container_ = new UIViewGroup();
+ container_->SetPosition(0, 0, 466, 466);
+ container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+ }
+
+ // 初始化Lable
+ InitLabel(label1_, 155, 52, 195, 35, "label1", "目标已达成", DEFAULT_VECTOR_FONT_FILENAME, 35);
+ container_->Add(label1_);
+ InitLabel(label2_, 108, 215, 146, 35, "label2", "10,000", DEFAULT_VECTOR_FONT_FILENAME, 80);
+ label2_->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+ container_->Add(label2_);
+ InitLabel(label3_, 132, 307, 146, 35, "label3", "完成目标", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ container_->Add(label3_);
+ InitLabel(label4_, 280, 307, 146, 35, "label3", "100%", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ label4_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+ container_->Add(label4_);
+
+ // 初始化image
+ InitImageView(image1_, 173, 100, 120, 120, "image1", imagePath_win);
+ container_->Add(image1_);
+
+ // 初始化Button
+ InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
+ // Set additional property
+ char *button1defaultImgSrc = "/user/res/Training/buttonok.bin";
+ char *button1triggeredImgSrc = nullptr;
+ button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+ container_->Add(button1_);
+ }
+ /* DeInit:删除组件*/
+ void TraingWinView::DeInit()
+ {
+ UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+ while (view != nullptr)
+ {
+ UIView *tempView = view;
+ view = view->GetNextSibling();
+ if (tempView->GetParent())
+ {
+ static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+ }
+ delete tempView;
+ }
+ delete container_;
+ container_ = nullptr;
+ }
+
+ void TraingWinView::PreLoad(void)
+ {
+ if (!viewiInitStatus)
+ {
+ InitView();
+ viewiInitStatus = true;
+ }
+ }
+ void TraingWinView::OnStart()
+ {
+ container_ = new UIViewGroup();
+ if (container_ == nullptr)
+ {
+ return;
+ }
+ container_->SetPosition(0, 0);
+ container_->SetWidth(Screen::GetInstance().GetWidth());
+ container_->SetHeight(Screen::GetInstance().GetHeight());
+
+ // 创建 draglistener 实例并设置为拖动监听器
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingWinPresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return;
+ }
+ container_->SetOnDragListener(draglistener);
+
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+
+ PreLoad();
+ RootView::GetInstance()->Add(container_);
+ }
+
+ void TraingWinView::OnSetUpView()
+ {
+
+ View<TraingWinPresenter>::OnSetUpView();
+ Draw();
+ }
+
+ void TraingWinView::OnTearDownView()
+ {
+
+ View<TraingWinPresenter>::OnTearDownView();
+ return;
+ }
+
+ void TraingWinView::OnStop()
+ {
+ View<TraingWinPresenter>::OnStop();
+ RootView::GetInstance()->RemoveAll();
+ return;
+ }
+}