#系统
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemPresenter.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemView.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemAboutPresenter.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemAboutView.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemSupervisePresenter.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemAboutTheWatchView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemSuperviseView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemLanguagePresenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemLanguageView.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemRebootPresenter.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemRebootView.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemShoutDownPresenter.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemShoutDownView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemFactoryResetPresenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemFactoryResetView.cpp
VIEW_FUTURE_WEATHER, // 未来天气
VIEW_GET_WEATHER_DATA_ERROR, // 获取天气数据失败
VIEW_SYSTEM, // 系统
- VIEW_SYSTEM_ABOUT_WATCH, // 系统:关于手表
- VIEW_SYSTEM_SUPERVISE, // 系统:监管
VIEW_SYSTEM_SYSTEM_LANGUAGE, // 系统:系统语言
- VIEW_SYSTEM_REBOOT, // 系统:重新启动
- VIEW_SYSTEM_SHOUTDOWN, // 系统:关机
VIEW_SYSTEM_FACTORY_RESET, // 系统:恢复出厂设置
/* -------------------------------------------------------------------------- */
VIEW_MAIN_TEMP, // 体温界面(暂时不用)
void InitFutureWeatherSlice(void);
void InitGetWeatherDataErrorSlice(void);
/* -------------------------------------------------------------------------- */
- void InitSystemSlice(void);
- void InitSystemAboutWatchSlice(void);
- void InitSystemSuperviseSlice(void);
- void InitSystemLanguageSlice(void);
- void InitSystemRebootSlice(void);
- void InitSystemShoutDownSlice(void);
+ void InitSystemSlice(void);
+ void InitSystemLanguageSlice(void);
void InitSystemFactoryResetSlice(void);
private:
void InitAllNativeSlices(void);
#include "system/include/SystemPresenter.h"
#include "system/include/SystemView.h"
-#include "system/include/SystemAboutPresenter.h"
-#include "system/include/SystemAboutView.h"
-#include "system/include/SystemSupervisePresenter.h"
-#include "system/include/SystemSuperviseView.h"
#include "system/include/SystemLanguagePresenter.h"
#include "system/include/SystemLanguageView.h"
-#include "system/include/SystemRebootPresenter.h"
-#include "system/include/SystemRebootView.h"
-#include "system/include/SystemShoutDownPresenter.h"
-#include "system/include/SystemShoutDownView.h"
#include "system/include/SystemFactoryResetPresenter.h"
#include "system/include/SystemFactoryResetView.h"
{VIEW_FUTURE_WEATHER, &NativeLauncher::InitFutureWeatherSlice}, // 未来天气
{VIEW_GET_WEATHER_DATA_ERROR, &NativeLauncher::InitGetWeatherDataErrorSlice}, // 获取天气数据失败
{VIEW_SYSTEM, &NativeLauncher::InitSystemSlice}, // 系统实例化地址
- {VIEW_SYSTEM_ABOUT_WATCH, &NativeLauncher::InitSystemAboutWatchSlice}, // 系统:关于手表实例化地址
- {VIEW_SYSTEM_SUPERVISE, &NativeLauncher::InitSystemSuperviseSlice}, // 系统:监管实例化地址
{VIEW_SYSTEM_SYSTEM_LANGUAGE, &NativeLauncher::InitSystemLanguageSlice}, // 系统:系统语言实例化地址
- {VIEW_SYSTEM_REBOOT, &NativeLauncher::InitSystemRebootSlice}, // 系统:重启实例化地址
- {VIEW_SYSTEM_SHOUTDOWN, &NativeLauncher::InitSystemShoutDownSlice}, // 系统:关机实例化地址
{VIEW_SYSTEM_FACTORY_RESET, &NativeLauncher::InitSystemFactoryResetSlice}, // 系统:恢复出厂设置实例化地址
//{VIEW_MAIN_ACTIVITY, &NativeLauncher::InitActivitySlice},
//{VIEW_OFFLINEVOICE, &NativeLauncher::InitOfflineVoice},
}
NativeAbility::GetInstance().AddSliceProxy(VIEW_SYSTEM, system);
}
- void NativeLauncher::InitSystemAboutWatchSlice(void) // 系统:关于手表
- {
- SliceProxy *systemaboutwatch = new AbilitySliceProxy<SystemAboutView, SystemAboutPresenter>;
- if (systemaboutwatch == nullptr)
- {
- return;
- }
- NativeAbility::GetInstance().AddSliceProxy(VIEW_SYSTEM_ABOUT_WATCH, systemaboutwatch);
- }
-
- void NativeLauncher::InitSystemSuperviseSlice(void) // 系统:监管
- {
- SliceProxy *systemsupervise = new AbilitySliceProxy<SystemSuperviseView, SystemSupervisePresenter>;
- if (systemsupervise == nullptr)
- {
- return;
- }
- NativeAbility::GetInstance().AddSliceProxy(VIEW_SYSTEM_SUPERVISE, systemsupervise);
- }
void NativeLauncher::InitSystemLanguageSlice(void) // 系统:系统语言
{
}
NativeAbility::GetInstance().AddSliceProxy(VIEW_SYSTEM_SYSTEM_LANGUAGE, systemlanguage);
}
- void NativeLauncher::InitSystemRebootSlice(void) // 系统:重新启动
- {
- SliceProxy *systemreboot = new AbilitySliceProxy<SystemRebootView, SystemRebootPresenter>;
- if (systemreboot == nullptr)
- {
- return;
- }
- NativeAbility::GetInstance().AddSliceProxy(VIEW_SYSTEM_REBOOT, systemreboot);
- }
- void NativeLauncher::InitSystemShoutDownSlice(void) // 系统:关机
- {
- SliceProxy *systemshoutdown = new AbilitySliceProxy<SystemShoutDownView, SystemShoutDownPresenter>;
- if (systemshoutdown == nullptr)
- {
- return;
- }
- NativeAbility::GetInstance().AddSliceProxy(VIEW_SYSTEM_SHOUTDOWN, systemshoutdown);
- }
+
void NativeLauncher::InitSystemFactoryResetSlice(void) // 系统:恢复出厂设置
{
SliceProxy *systemfactoryreset = new AbilitySliceProxy<SystemFactoryResetView, SystemFactoryResetPresenter>;
+++ /dev/null
-#ifndef SYSTEM_ABOUT_PRESENTER_H\r
-#define SYSTEM_ABOUT_PRESENTER_H\r
- \r
-#include "Presenter.h"\r
- \r
-#include "SystemAboutView.h"\r
- \r
-namespace OHOS\r
-{\r
- class SystemAboutView;\r
- \r
- class SystemAboutPresenter : public Presenter<SystemAboutView>,\r
- public UIView::OnClickListener,\r
- public UIView::OnDragListener\r
- {\r
- public:\r
- SystemAboutPresenter();\r
- virtual ~SystemAboutPresenter();\r
- \r
- void OnStart() override; \r
- void OnPause() override; \r
- void OnResume() override; \r
- void OnStop() override; \r
- \r
- static SystemAboutPresenter *GetInstance(); \r
- \r
- private:\r
- //因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
- bool OnClick(UIView &view, const ClickEvent &event) override; \r
- bool OnDrag(UIView &view, const DragEvent &event) override; \r
- };\r
-} //namespace OHOS\r
- \r
- \r
-#endif //SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+#ifndef SYSTEM_ABOUT_VIEW_H\r
+#define SYSTEM_ABOUT_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include <iostream>\r
+namespace OHOS\r
+{\r
+ class SystemAboutTheWatchView\r
+ {\r
+\r
+ public:\r
+ SystemAboutTheWatchView();\r
+ virtual ~SystemAboutTheWatchView();\r
+ static SystemAboutTheWatchView *GetInstance(void);\r
+ struct LabelConfig\r
+ {\r
+ int16_t left;\r
+ int16_t top;\r
+ int16_t width;\r
+ int16_t height;\r
+ int16_t fontSize; // 字体大小\r
+ int16_t lineHeigh; // 行高\r
+ const char *text; // 文本\r
+ uint8_t lineBreakMode; // 断行模式。\r
+ };\r
+ UIScrollView *SystemAbouTheWatchtInitIView(void);\r
+ void ClearAll(void);\r
+ UILabel *InitLabel(LabelConfig &labelConfig);\r
+\r
+ private:\r
+ bool SetSystemAboutTheWatchScrollView(void);\r
+ UIScrollView *SystemAboutTheWatchScrollView{nullptr};\r
+ UILabel *SystemAboutTheWatchTitle{nullptr}; // “关于”\r
+ UILabel *WatchNameTitle{nullptr}; // “手表名称”\r
+ UILabel *WatchName{nullptr};\r
+ UILabel *FirmwareVersionTitle{nullptr}; // "固件版本"\r
+ UILabel *FirmwareVersion{nullptr};\r
+ UILabel *AlgorithmVersionTitle{nullptr}; // “算法版本”\r
+ UILabel *AlgorithmVersion{nullptr};\r
+ UILabel *BluetoothAddressTitle{nullptr}; // “蓝牙地址”\r
+ UILabel *BluetoothAddress{nullptr};\r
+ UILabel *LANAddressTitle{nullptr}; // “局域网地址”\r
+ UILabel *LANAddress = nullptr;\r
+ UILabel *FONTTitle = nullptr;\r
+ UILabel *FONT = nullptr;\r
+\r
+ UIImageView *image = nullptr;\r
+ UIView::OnDragListener *draglistener{nullptr};\r
+ };\r
+}\r
+#endif
\ No newline at end of file
+++ /dev/null
-#ifndef SYSTEM_ABOUT_VIEW_H\r
-#define SYSTEM_ABOUT_VIEW_H\r
-\r
-#include "BaseView.h"\r
-#include "View.h"\r
-#include "components/ui_view_group.h"\r
-#include "components/ui_scroll_view.h"\r
-#include "components/ui_label.h"\r
-#include "components/ui_image_view.h"\r
-namespace OHOS\r
-{\r
- class SystemAboutPresenter;\r
- class SystemAboutView : public View<SystemAboutPresenter>\r
- {\r
-\r
- public:\r
- SystemAboutView();\r
- virtual ~SystemAboutView();\r
- static SystemAboutView *GetInstance(void);\r
-\r
- UILabel *InitLabel(int left, int top, int width, int height, const char *text, const char *viewId, int fontSize, int fontlineHeigh, uint16_t speed);\r
-\r
- public:\r
- void OnStart() override;\r
- void OnSetUpView() override;\r
- void OnTearDownView() override;\r
- void OnStop() override;\r
-\r
- private:\r
- void SystemAboutInitIView(void);\r
- void DeSystemAboutInitIView(void);\r
-\r
- private:\r
- UIViewGroup *container_ = nullptr;\r
- UIScrollView *scrollView1_ = nullptr;\r
- UILabel *label1_ = nullptr;\r
- UILabel *label2_ = nullptr;\r
- UILabel *label3_ = nullptr;\r
- UILabel *label4_ = nullptr;\r
- UILabel *label5_ = nullptr;\r
- UILabel *label6_ = nullptr;\r
- UILabel *label7_ = nullptr;\r
- UILabel *label8_ = nullptr;\r
- UILabel *label9_ = nullptr;\r
- UILabel *label10_ = nullptr;\r
- UILabel *label11_ = nullptr;\r
- UILabel *label12_ = nullptr;\r
- UILabel *label13_ = nullptr;\r
-\r
- UIImageView *image = nullptr;\r
- };\r
-} // namespace OHOS\r
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
private:\r
//因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
bool OnClick(UIView &view, const ClickEvent &event) override; \r
- bool OnDrag(UIView &view, const DragEvent &event) override; \r
+ bool OnDrag(UIView& view, const DragEvent& event) override;\r
+ bool OnDragEnd(UIView &view, const DragEvent &event) override; \r
};\r
} //namespace OHOS\r
\r
+++ /dev/null
-#ifndef SYSTEM_REBOOT_PRESENTER_H\r
-#define SYSTEM_REBOOT_PRESENTER_H\r
-\r
-#include "Presenter.h"\r
-\r
-#include "SystemRebootView.h"\r
-\r
-namespace OHOS\r
-{\r
- class SystemRebootView;\r
-\r
- class SystemRebootPresenter : public Presenter<SystemRebootView>,\r
- public UIView::OnClickListener,\r
- public UIView::OnDragListener\r
- {\r
- public:\r
- SystemRebootPresenter();\r
- virtual ~SystemRebootPresenter();\r
-\r
- void OnStart() override;\r
- void OnPause() override;\r
- void OnResume() override;\r
- void OnStop() override;\r
-\r
- static SystemRebootPresenter *GetInstance();\r
-\r
- private:\r
- // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
- bool OnClick(UIView &view, const ClickEvent &event) override;\r
- bool OnDrag(UIView &view, const DragEvent &event) override;\r
- };\r
-} // namespace OHOS\r
-\r
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
+++ /dev/null
-#ifndef SYSTEM_REBOOT_VIEW_H\r
-#define SYSTEM_REBOOT_VIEW_H\r
-\r
-#include "BaseView.h"\r
-#include "View.h"\r
-\r
-#include "components/ui_view_group.h"\r
-#include "components/ui_image_view.h"\r
-#include "components/ui_button.h"\r
-namespace OHOS\r
-{\r
- static const char *REBOOT_CHECKON = "ShoutDownButtonCheckOn";//确认\r
- static const char *REBOOT_CHECKOFF = "ShoutDownButtonCheckOff";//取消\r
- class SystemRebootPresenter;\r
- class SystemRebootView : public View<SystemRebootPresenter>\r
- {\r
-\r
- public:\r
- SystemRebootView();\r
- virtual ~SystemRebootView();\r
- static SystemRebootView *GetInstance(void);\r
-\r
- void OnStart() override;\r
- void OnSetUpView() override;\r
- void OnTearDownView() override;\r
- void OnStop() override;\r
-\r
- private:\r
-\r
- void InitView(void);\r
- void DeInitView(void);\r
-\r
- UIViewGroup *container_ = nullptr;\r
- UIImageView *RebootImage = nullptr;\r
- UIButton *RebootButtonCheckOn = nullptr;\r
- UIButton *RebootButtonCheckOff = nullptr;\r
- };\r
-} // namespace OHOS\r
-#endif
\ No newline at end of file
+++ /dev/null
-#ifndef SYSTEM_SHOUTDOWN_PRESENTER_H\r
-#define SYSTEM_SHOUTDOWN_PRESENTER_H\r
-\r
-#include "Presenter.h"\r
-\r
-#include "SystemShoutDownView.h"\r
-\r
-namespace OHOS\r
-{\r
- class SystemShoutDownView;\r
-\r
- class SystemShoutDownPresenter : public Presenter<SystemShoutDownView>,\r
- public UIView::OnClickListener,\r
- public UIView::OnDragListener\r
- {\r
- public:\r
- SystemShoutDownPresenter();\r
- virtual ~SystemShoutDownPresenter();\r
-\r
- void OnStart() override;\r
- void OnPause() override;\r
- void OnResume() override;\r
- void OnStop() override;\r
-\r
- static SystemShoutDownPresenter *GetInstance();\r
-\r
- private:\r
- // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
- bool OnClick(UIView &view, const ClickEvent &event) override;\r
- bool OnDrag(UIView &view, const DragEvent &event) override;\r
- };\r
-} // namespace OHOS\r
-\r
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
+++ /dev/null
-#ifndef SYSTEM_SHOUTDOWN_VIEW_H\r
-#define SYSTEM_SHOUTDOWN_VIEW_H\r
-\r
-#include "BaseView.h"\r
-#include "View.h"\r
-\r
-#include "components/ui_view_group.h"\r
-#include "components/ui_image_view.h"\r
-#include "components/ui_button.h"\r
-namespace OHOS\r
-{\r
- static const char *SHOUTDOWN_BUTTON_CHECKON = "ShoutDownButtonCheckOn";//确认\r
- static const char *SHOUTDOWN_BUTTON_CHECKOFF = "ShoutDownButtonCheckOff";//取消\r
- class SystemShoutDownPresenter;\r
- class SystemShoutDownView : public View<SystemShoutDownPresenter>\r
- {\r
-\r
- public:\r
- SystemShoutDownView();\r
- virtual ~SystemShoutDownView();\r
- static SystemShoutDownView *GetInstance(void);\r
-\r
- void OnStart() override;\r
- void OnSetUpView() override;\r
- void OnTearDownView() override;\r
- void OnStop() override;\r
-\r
- private:\r
-\r
- void InitView(void);\r
- void DeInitView(void);\r
-\r
- UIViewGroup *container_ = nullptr;\r
- UIImageView *ShoutDownImage = nullptr;\r
- UIButton *ShoutDownButtonCheckOn = nullptr;\r
- UIButton *ShoutDownButtonCheckOff = nullptr;\r
- };\r
-} // namespace OHOS\r
-#endif
\ No newline at end of file
+++ /dev/null
-#ifndef SYSTEM_SUPERVISE_PRESENTER_H\r
-#define SYSTEM_SUPERVISE_PRESENTER_H\r
-\r
-#include "Presenter.h"\r
-\r
-#include "SystemSuperviseView.h"\r
-\r
-namespace OHOS\r
-{\r
- class SystemSuperviseView;\r
-\r
- class SystemSupervisePresenter : public Presenter<SystemSuperviseView>,\r
- public UIView::OnClickListener,\r
- public UIView::OnDragListener\r
- {\r
- public:\r
- SystemSupervisePresenter();\r
- virtual ~SystemSupervisePresenter();\r
-\r
- void OnStart() override;\r
- void OnPause() override;\r
- void OnResume() override;\r
- void OnStop() override;\r
-\r
- static SystemSupervisePresenter *GetInstance();\r
-\r
- private:\r
- // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
- bool OnClick(UIView &view, const ClickEvent &event) override;\r
- bool OnDrag(UIView &view, const DragEvent &event) override;\r
- };\r
-} // namespace OHOS\r
-\r
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
#include "components/ui_label.h"\r
namespace OHOS\r
{\r
- class SystemSupervisePresenter;\r
- class SystemSuperviseView : public View<SystemSupervisePresenter>\r
- {\r
\r
+ class SystemSuperviseView\r
+ {\r
public:\r
SystemSuperviseView();\r
virtual ~SystemSuperviseView();\r
static SystemSuperviseView *GetInstance(void);\r
UILabel *InitLabel(int left, int top, int width, int height, const char *text, const char *viewId, int fontSize, int fontlineHeigh, uint16_t speed);\r
- void OnStart() override;\r
- void OnSetUpView() override;\r
- void OnTearDownView() override;\r
- void OnStop() override;\r
-\r
- private:\r
- void InitView(void);\r
- void DeInitView(void);\r
+ UIScrollView *SystemSuperviseViewInit(void);\r
+ void ClearAll(void);\r
\r
private:\r
UIViewGroup *container_ = nullptr;\r
- UIScrollView *scrollView1_ = nullptr;\r
- UILabel *label1_ = nullptr;\r
- UILabel *label2_ = nullptr;\r
- UILabel *label3_ = nullptr;\r
- UILabel *label4_ = nullptr;\r
- UILabel *label5_ = nullptr;\r
+ UIScrollView *SystemSuperviseViewScrollView = nullptr;\r
+ UIView::OnDragListener *draglistener{nullptr};\r
+ UILabel *Title = nullptr;\r
+ UILabel *ProductModel = nullptr;\r
+ UILabel *ProductModelName = nullptr;\r
+ UILabel *CMIT = nullptr;\r
+ UILabel *CMITName = nullptr;\r
};\r
} // namespace OHOS\r
#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
#include "components/ui_label.h"\r
#include "components/ui_image_view.h"\r
#include "components/ui_button.h"\r
-\r
+#include "system/include/SystemAboutTheWatchView.h"\r
+#include "system/include/SystemSuperviseView.h"\r
namespace OHOS\r
{\r
static const char *ABOUT_THE_WATCH = "AboutTheWatchButton"; // 关于手表\r
static const char *SUPERVISE = "SuperviseButton"; // 监管\r
static const char *SYSTEM_LANGUAGE = "SystemLanguageButton"; // 系统语言\r
- static const char *REBOOT = "RebootButton"; // 重启\r
- static const char *SHOUTDOWM = "ShoutdownButton"; // 关机\r
static const char *FACTORY_RESET = "FactoryResetButton"; // 恢复出厂设置\r
+ static const char *ABOUT_THE_WATCH_IMAGESRC = "/user/res/system/SYSTEM_ABOUT_THE_WATCH.bin";\r
+ static const char *SUPERVISE_IMAGESRC = "/user/res/system/SYSTEM_SUPERVISE.bin";\r
+ static const char *SYSTEM_LANGUAGE_IMAGESRC = "/user/res/system/SYSTEM_SYSTEM_LANGUAGE.bin";\r
+ static const char *FACTORY_RESET_LANGUAGE_IMAGESRC = "/user/res/system/SYSTEM_FACTORY_RESET.bin";\r
class SystemPresenter;\r
class SystemView : public View<SystemPresenter>\r
{\r
void OnSetUpView() override;\r
void OnTearDownView() override;\r
void OnStop() override;\r
-\r
+ struct ButtonConfig\r
+ {\r
+ int x;\r
+ int y;\r
+ int w;\r
+ int h;\r
+ const char *ViewId;\r
+ const char *ImageSrc;\r
+ };\r
+ bool ChangeSystemView(int16_t thisView);\r
+ bool ChangeSystemAboutView(int16_t thisView);\r
+ bool ChangeSystemSuperviseView(int16_t thisView);\r
+ bool ClickFunc(int16_t interface);\r
+ void ChangeView(int16_t hideView, int16_t showView);\r
private:\r
- UIView::OnDragListener *draglistener{nullptr};\r
-\r
void InitIView(void);\r
- void DeInitView(void);\r
-\r
- private:\r
- UIViewGroup *container_ = nullptr;\r
- UIScrollView *SystemScrollView = nullptr;\r
- UILabel *SystemLabel = nullptr;\r
- UIImageView *image2_ = nullptr;\r
- UIImageView *image1_ = nullptr;\r
- UIButton *FactoryResetButton = nullptr;\r
- UIButton *ShoutdownButton = nullptr;\r
- UIButton *RebootButton = nullptr;\r
- UIButton *AboutTheWatchButton = nullptr;\r
- UIButton *SuperviseButton = nullptr;\r
- UIButton *SystemLanguageButton = nullptr;\r
+ void ClearAll(void);\r
+ bool SetTheSystemScrollView(void);\r
+ bool SetTheTitle(void);\r
+ UIButton * SetTheButton(ButtonConfig &buttonconfig, UIView::OnClickListener *clickListener);\r
+ SystemAboutTheWatchView *p_SystemAboutTheWatchView{nullptr};\r
+ SystemSuperviseView *p_SystemSuperviseView{nullptr};\r
+ UIScrollView *SystemScrollView[5]{nullptr};\r
+ UILabel *SystemLabel{nullptr}; // 标题\r
+ UIButton *FactoryResetButton{nullptr};\r
+ UIButton *AboutTheWatchButton{nullptr};\r
+ UIButton *SuperviseButton = {nullptr};\r
+ UIButton *SystemLanguageButton = {nullptr};\r
+ UIView::OnDragListener *draglistener{nullptr};\r
+ UIView::OnClickListener *clickListener{nullptr};\r
+ bool initViewStatus{false};\r
};\r
} // namespace OHOS\r
\r
+++ /dev/null
-#include "AppViewIDs.h"\r
-#include "NativeAbility.h"\r
-#include "graphic_math.h"\r
-#include "string.h"\r
-#include "system/include/SystemAboutPresenter.h"\r
-namespace OHOS\r
-{\r
-\r
- // 当前Presenter属性实例化的内存指针\r
- static SystemAboutPresenter *g_pSystemAboutPresenter = nullptr;\r
-\r
- SystemAboutPresenter::SystemAboutPresenter()\r
- {\r
-\r
- g_pSystemAboutPresenter = this;\r
- }\r
-\r
- SystemAboutPresenter::~SystemAboutPresenter()\r
- {\r
-\r
- g_pSystemAboutPresenter = nullptr;\r
- }\r
-\r
- SystemAboutPresenter *SystemAboutPresenter::GetInstance()\r
- {\r
-\r
- return g_pSystemAboutPresenter;\r
- }\r
-\r
- void SystemAboutPresenter::OnStart()\r
- {\r
-\r
- Presenter<SystemAboutView>::OnStart();\r
- }\r
-\r
- void SystemAboutPresenter::OnPause(void)\r
- {\r
-\r
- Presenter<SystemAboutView>::OnPause();\r
- }\r
-\r
- void SystemAboutPresenter::OnResume(void)\r
- {\r
-\r
- Presenter<SystemAboutView>::OnResume();\r
- }\r
-\r
- void SystemAboutPresenter::OnStop(void)\r
- {\r
-\r
- Presenter<SystemAboutView>::OnStop();\r
- }\r
-\r
- bool SystemAboutPresenter::OnDrag(UIView &view, const DragEvent &event)\r
- {\r
-\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
- (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
- {\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM);\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- bool SystemAboutPresenter::OnClick(UIView &view, const ClickEvent &event)\r
- {\r
-\r
- // 根据控件id查找是哪个控件触发了点击回调\r
- // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
- return true;\r
- }\r
-}
\ No newline at end of file
--- /dev/null
+#include "system/include/SystemAboutTheWatchView.h"\r
+#include "system/include/SystemPresenter.h"\r
+#include "wearable_log.h"\r
+namespace OHOS\r
+{\r
+\r
+ static SystemAboutTheWatchView *g_pSystemAboutTheWatchView{nullptr};\r
+\r
+ SystemAboutTheWatchView::SystemAboutTheWatchView()\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView");\r
+ g_pSystemAboutTheWatchView = this;\r
+ }\r
+\r
+ SystemAboutTheWatchView::~SystemAboutTheWatchView()\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView");\r
+ ClearAll();\r
+ g_pSystemAboutTheWatchView = nullptr;\r
+ }\r
+\r
+ SystemAboutTheWatchView *SystemAboutTheWatchView::GetInstance()\r
+ {\r
+\r
+ return g_pSystemAboutTheWatchView;\r
+ }\r
+\r
+ UILabel *SystemAboutTheWatchView::InitLabel(LabelConfig &labelConfig)\r
+ {\r
+ UILabel *label = new UILabel();\r
+ if (label == nullptr)\r
+ {\r
+ return nullptr;\r
+ }\r
+ label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小\r
+ label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize); // 字体大小\r
+ label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh); // 字体行高\r
+ label->SetText(labelConfig.text); // 内容\r
+ label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。\r
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+ label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelConfig.fontSize);\r
+ return label;\r
+ }\r
+\r
+ bool SystemAboutTheWatchView::SetSystemAboutTheWatchScrollView(void)\r
+ {\r
+ SystemAboutTheWatchScrollView = new UIScrollView();\r
+ if (SystemAboutTheWatchScrollView == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchScrollView new fail!");\r
+ return false;\r
+ }\r
+ SystemAboutTheWatchScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+ SystemAboutTheWatchScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+ SystemAboutTheWatchScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294);\r
+ SystemAboutTheWatchScrollView->SetScrollBlankSize(35);\r
+ SystemAboutTheWatchScrollView->SetReboundSize(50);\r
+ SystemAboutTheWatchScrollView->SetDirection(1);\r
+ draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());\r
+ if (draglistener == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");\r
+ return false;\r
+ }\r
+ SystemAboutTheWatchScrollView->SetOnDragListener(draglistener);\r
+ SystemAboutTheWatchScrollView->SetTouchable(true);\r
+ SystemAboutTheWatchScrollView->SetDraggable(true);\r
+ return true;\r
+ }\r
+\r
+ UIScrollView *SystemAboutTheWatchView::SystemAbouTheWatchtInitIView()\r
+ {\r
+ if (!SetSystemAboutTheWatchScrollView())\r
+ {\r
+ return nullptr;\r
+ }\r
+ /* -------------------------------------------------------------------------- */\r
+ LabelConfig Config = {\r
+ .left = 203,\r
+ .top = 52,\r
+ .width = 60,\r
+ .height = 35,\r
+ .fontSize = 30,\r
+ .lineHeigh = 35,\r
+ .text = "关于",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+ };\r
+ SystemAboutTheWatchTitle = InitLabel(Config);\r
+ if (SystemAboutTheWatchTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ SystemAboutTheWatchScrollView->Add(SystemAboutTheWatchTitle);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 173,\r
+ .top = 160,\r
+ .width = 120,\r
+ .height = 35,\r
+ .fontSize = 30,\r
+ .lineHeigh = 35,\r
+ .text = "手表名称",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+ };\r
+ WatchNameTitle = InitLabel(Config);\r
+ if (WatchNameTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchNameTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ SystemAboutTheWatchScrollView->Add(WatchNameTitle);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 37,\r
+ .top = 216,\r
+ .width = 400,\r
+ .height = 30,\r
+ .fontSize = 26,\r
+ .lineHeigh = 30,\r
+ .text = "Watch Soar",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS,\r
+ };\r
+ WatchName = InitLabel(Config);\r
+ if (WatchName == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchName new fail!");\r
+ return nullptr;\r
+ }\r
+ WatchName->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemAboutTheWatchScrollView->Add(WatchName);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 173,\r
+ .top = 305,\r
+ .width = 120,\r
+ .height = 35,\r
+ .fontSize = 30,\r
+ .lineHeigh = 35,\r
+ .text = "固件版本",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+ };\r
+ FirmwareVersionTitle = InitLabel(Config);\r
+ if (FirmwareVersionTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FirmwareVersionTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ SystemAboutTheWatchScrollView->Add(FirmwareVersionTitle);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 37,\r
+ .top = 361,\r
+ .width = 400,\r
+ .height = 30,\r
+ .fontSize = 26,\r
+ .lineHeigh = 30,\r
+ .text = "V1.0",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS,\r
+ };\r
+ FirmwareVersion = InitLabel(Config);\r
+ if (FirmwareVersion == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FirmwareVersion new fail!");\r
+ return nullptr;\r
+ }\r
+ FirmwareVersion->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemAboutTheWatchScrollView->Add(FirmwareVersion);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 173,\r
+ .top = 450,\r
+ .width = 120,\r
+ .height = 35,\r
+ .fontSize = 30,\r
+ .lineHeigh = 35,\r
+ .text = "算法版本",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+ };\r
+ AlgorithmVersionTitle = InitLabel(Config);\r
+ if (AlgorithmVersionTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::AlgorithmVersionTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ SystemAboutTheWatchScrollView->Add(AlgorithmVersionTitle);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 37,\r
+ .top = 506,\r
+ .width = 400,\r
+ .height = 30,\r
+ .fontSize = 26,\r
+ .lineHeigh = 30,\r
+ .text = "V02.03.01 OTA88",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS,\r
+ };\r
+ AlgorithmVersion = InitLabel(Config);\r
+ if (AlgorithmVersion == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::AlgorithmVersion new fail!");\r
+ return nullptr;\r
+ }\r
+ AlgorithmVersion->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemAboutTheWatchScrollView->Add(AlgorithmVersion);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 173,\r
+ .top = 595,\r
+ .width = 120,\r
+ .height = 35,\r
+ .fontSize = 30,\r
+ .lineHeigh = 35,\r
+ .text = "蓝牙地址",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+ };\r
+ BluetoothAddressTitle = InitLabel(Config);\r
+ if (BluetoothAddressTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BluetoothAddressTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ SystemAboutTheWatchScrollView->Add(BluetoothAddressTitle);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 37,\r
+ .top = 651,\r
+ .width = 400,\r
+ .height = 30,\r
+ .fontSize = 26,\r
+ .lineHeigh = 30,\r
+ .text = "D4:FF:E3:12:00:A4",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS,\r
+ };\r
+ BluetoothAddress = InitLabel(Config);\r
+ if (BluetoothAddress == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BluetoothAddress new fail!");\r
+ return nullptr;\r
+ }\r
+ BluetoothAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemAboutTheWatchScrollView->Add(BluetoothAddress);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 173,\r
+ .top = 740,\r
+ .width = 120,\r
+ .height = 35,\r
+ .fontSize = 30,\r
+ .lineHeigh = 35,\r
+ .text = "局域网地址",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+ };\r
+ LANAddressTitle = InitLabel(Config);\r
+ if (LANAddressTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddressTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ SystemAboutTheWatchScrollView->Add(LANAddressTitle);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 37,\r
+ .top = 796,\r
+ .width = 400,\r
+ .height = 30,\r
+ .fontSize = 26,\r
+ .lineHeigh = 30,\r
+ .text = "D4:FF:E3:12:00:A4",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS,\r
+ };\r
+ LANAddress = InitLabel(Config);\r
+ if (LANAddress == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddress new fail!");\r
+ return nullptr;\r
+ }\r
+ LANAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemAboutTheWatchScrollView->Add(LANAddress);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 173,\r
+ .top = 885,\r
+ .width = 120,\r
+ .height = 35,\r
+ .fontSize = 30,\r
+ .lineHeigh = 35,\r
+ .text = "FONTS",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+ };\r
+ FONTTitle = InitLabel(Config);\r
+ if (FONTTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FONTTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ SystemAboutTheWatchScrollView->Add(FONTTitle);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = 37,\r
+ .top = 941,\r
+ .width = 400,\r
+ .height = 30,\r
+ .fontSize = 26,\r
+ .lineHeigh = 30,\r
+ .text = "HarmonyOS Sans",\r
+ .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS,\r
+ };\r
+ LANAddress = InitLabel(Config);\r
+ if (LANAddress == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddress new fail!");\r
+ return nullptr;\r
+ }\r
+ LANAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemAboutTheWatchScrollView->Add(LANAddress);\r
+\r
+ return SystemAboutTheWatchScrollView;\r
+ }\r
+\r
+ void SystemAboutTheWatchView::ClearAll()\r
+ {\r
+ SystemAboutTheWatchScrollView->RemoveAll();\r
+ delete SystemAboutTheWatchTitle;\r
+ SystemAboutTheWatchTitle = nullptr;\r
+ delete WatchNameTitle;\r
+ WatchNameTitle = nullptr;\r
+ delete WatchName;\r
+ WatchName = nullptr;\r
+ delete FirmwareVersionTitle;\r
+ FirmwareVersionTitle = nullptr;\r
+ delete FirmwareVersion;\r
+ FirmwareVersion = nullptr;\r
+ delete AlgorithmVersionTitle;\r
+ AlgorithmVersionTitle = nullptr;\r
+ delete AlgorithmVersion;\r
+ AlgorithmVersion = nullptr;\r
+ delete BluetoothAddressTitle;\r
+ BluetoothAddressTitle = nullptr;\r
+ delete BluetoothAddress;\r
+ BluetoothAddress = nullptr;\r
+ delete LANAddressTitle;\r
+ LANAddressTitle = nullptr;\r
+ delete LANAddress;\r
+ LANAddress = nullptr;\r
+ delete FONTTitle;\r
+ FONTTitle = nullptr;\r
+ delete FONT;\r
+ FONT = nullptr;\r
+ delete SystemAboutTheWatchScrollView;\r
+ SystemAboutTheWatchScrollView = nullptr;\r
+ }\r
+}
\ No newline at end of file
+++ /dev/null
-#include "system/include/SystemAboutView.h"\r
-#include "system/include/SystemAboutPresenter.h"\r
-#include "UiConfig.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
- static SystemAboutView *g_pSystemAboutView{nullptr};\r
-\r
- SystemAboutView::SystemAboutView()\r
- {\r
-\r
- g_pSystemAboutView = this;\r
- }\r
-\r
- SystemAboutView::~SystemAboutView()\r
- {\r
-\r
- g_pSystemAboutView = nullptr;\r
- }\r
-\r
- SystemAboutView *SystemAboutView::GetInstance()\r
- {\r
-\r
- return g_pSystemAboutView;\r
- }\r
- UILabel *SystemAboutView::InitLabel(int left, int top, int width, int height, const char *text, const char *viewId, int fontSize, int fontlineHeigh, uint16_t speed)\r
- {\r
- UILabel *label = new UILabel();\r
- label->SetPosition(left, top); // 位置\r
- label->Resize(width, height); // 大小\r
- label->SetViewId(viewId); // id\r
- label->SetStyle(STYLE_TEXT_FONT, fontSize); // 字体大小\r
- label->SetStyle(STYLE_LINE_HEIGHT, fontlineHeigh); // 字体行高\r
- label->SetText(text); // 内容\r
- label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label->SetRollSpeed(speed);\r
- label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, fontSize);\r
-\r
- return label;\r
- }\r
-\r
- void SystemAboutView::SystemAboutInitIView()\r
- {\r
- if (container_ == nullptr)\r
- {\r
- container_ = new UIViewGroup();\r
- container_->SetPosition(0, 0, 466, 466);\r
- container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemAboutPresenter::GetInstance());\r
- if (draglistener == nullptr)\r
- {\r
- return;\r
- }\r
- container_->SetOnDragListener(draglistener);\r
- container_->SetTouchable(true);\r
- container_->SetDraggable(true);\r
- }\r
- \r
- if (scrollView1_ == nullptr)\r
- {\r
- scrollView1_ = new UIScrollView();\r
- }\r
- scrollView1_->SetPosition(0, 0); \r
- scrollView1_->Resize(466, 466); \r
- scrollView1_->SetViewId("scrollView"); \r
- scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
- scrollView1_->SetStyle(STYLE_BORDER_RADIUS, 1294);\r
- container_->Add(scrollView1_);\r
- scrollView1_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label1_ == nullptr)\r
- {\r
- label1_ = InitLabel(203, 52, 60, 35, "关于", "label1", 30, 35, 6);\r
- }\r
- scrollView1_->Add(label1_);\r
- label1_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label2_ == nullptr)\r
- {\r
- label2_ = InitLabel(173, 160, 120, 35, "手表名称", "label2", 30, 35, 6);\r
- }\r
- scrollView1_->Add(label2_);\r
- label2_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label3_ == nullptr)\r
- {\r
- label3_ = InitLabel(97, 217, 263, 30, "周冰鸿的 Smart Watch", "label3", 26, 30, 6);\r
- }\r
- label3_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label3_);\r
- label3_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Label to App\r
- if (label4_ == nullptr)\r
- {\r
- label4_ = InitLabel(173, 305, 120, 35, "固件版本", "label4", 30, 35, 6);\r
- }\r
- scrollView1_->Add(label4_);\r
- label4_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Label to App\r
- if (label5_ == nullptr)\r
- {\r
- label5_ = InitLabel(174, 361, 119, 30, "V02.03.01", "label5", 26, 30, 6);\r
- }\r
- label5_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label5_);\r
- label5_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label6_ == nullptr)\r
- {\r
- label6_ = InitLabel(173, 450, 120, 35, "算法版本", "label6", 30, 35, 6);\r
- }\r
- scrollView1_->Add(label6_);\r
- label6_->SetVisible(true);\r
- RootView::GetInstance()->Add(container_);\r
- /***********************************************************************************************************/\r
- if (label7_ == nullptr)\r
- {\r
- label7_ = InitLabel(131, 506, 204, 30, "V02.03.01 OTA88", "label7", 26, 30, 6);\r
- }\r
- label7_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label7_);\r
- label7_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label8_ == nullptr)\r
- {\r
- label8_ = InitLabel(173, 595, 120, 35, "蓝牙地址", "label8", 30, 35, 6);\r
- }\r
-\r
- scrollView1_->Add(label8_);\r
- label8_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label9_ == nullptr)\r
- {\r
- label9_ = InitLabel(123, 651, 220, 30, "D4:FF:E3:12:00:A4", "label9", 26, 30, 6);\r
- }\r
-\r
- label9_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label9_);\r
- label9_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label10_ == nullptr)\r
- {\r
- label10_ = InitLabel(158, 740, 120, 35, "局域网地址", "label10", 30, 35, 6);\r
- }\r
- scrollView1_->Add(label10_);\r
- label10_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label11_ == nullptr)\r
- {\r
- label11_ = InitLabel(123, 796, 220, 30, "D4:FF:E3:12:00:A4", "label11", 26, 30, 6);\r
- }\r
- label11_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label11_);\r
- label11_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label12_ == nullptr)\r
- {\r
- label12_ = InitLabel(185, 885, 97, 35, "FONTS", "label12", 30, 35, 6);\r
- }\r
- scrollView1_->Add(label12_);\r
- label12_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label13_ == nullptr)\r
- {\r
- label13_ = InitLabel(130, 941, 207, 30, "HarmonyOS Sans", "label13", 26, 30, 6);\r
- }\r
- label13_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label13_);\r
- label13_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add ImageView to App\r
- if (image == nullptr)\r
- {\r
- image = new UIImageView();\r
- }\r
- image->SetPosition(183, 941);\r
- image->Resize(100, 100); \r
- image->SetViewId("image"); \r
-\r
- scrollView1_->Add(image);\r
- image->SetVisible(true);\r
- }\r
- void SystemAboutView::DeSystemAboutInitIView()\r
- {\r
- if (container_ != nullptr)\r
- {\r
- container_->RemoveAll();\r
- delete container_;\r
- container_ = nullptr;\r
- }\r
- if (scrollView1_ != nullptr)\r
- {\r
- delete scrollView1_;\r
- scrollView1_ = nullptr;\r
- }\r
- if (label1_ != nullptr)\r
- {\r
- delete label1_;\r
- label1_ = nullptr;\r
- }\r
- if (label2_ != nullptr)\r
- {\r
- delete label2_;\r
- label2_ = nullptr;\r
- }\r
- if (label3_ != nullptr)\r
- {\r
- delete label3_;\r
- label3_ = nullptr;\r
- }\r
- if (label4_ != nullptr)\r
- {\r
- delete label4_;\r
- label4_ = nullptr;\r
- }\r
- if (label5_ != nullptr)\r
- {\r
- delete label5_;\r
- label5_ = nullptr;\r
- }\r
- if (label6_ != nullptr)\r
- {\r
- delete label6_;\r
- label6_ = nullptr;\r
- }\r
- if (label7_ != nullptr)\r
- {\r
- delete label7_;\r
- label7_ = nullptr;\r
- }\r
- if (label8_ != nullptr)\r
- {\r
- delete label8_;\r
- label8_ = nullptr;\r
- }\r
- if (label9_ != nullptr)\r
- {\r
- delete label9_;\r
- label9_ = nullptr;\r
- }\r
- if (label10_ != nullptr)\r
- {\r
- delete label10_;\r
- label10_ = nullptr;\r
- }\r
- if (label11_ != nullptr)\r
- {\r
- delete label11_;\r
- label11_ = nullptr;\r
- }\r
- if (label12_ != nullptr)\r
- {\r
- delete label12_;\r
- label12_ = nullptr;\r
- }\r
- if (label13_ != nullptr)\r
- {\r
- delete label13_;\r
- label13_ = nullptr;\r
- }\r
- if (image != nullptr)\r
- {\r
- delete image;\r
- image = nullptr;\r
- }\r
- }\r
-\r
- void SystemAboutView::OnStart()\r
- {\r
- SystemAboutInitIView();\r
- RootView::GetInstance()->Add(container_);\r
- }\r
-\r
- void SystemAboutView::OnSetUpView()\r
- {\r
-\r
- View<SystemAboutPresenter>::OnSetUpView();\r
- Draw();\r
- }\r
-\r
- void SystemAboutView::OnTearDownView()\r
- {\r
-\r
- View<SystemAboutPresenter>::OnTearDownView();\r
- return;\r
- }\r
-\r
- void SystemAboutView::OnStop()\r
- {\r
-\r
- View<SystemAboutPresenter>::OnStop();\r
- RootView::GetInstance()->RemoveAll();\r
- return;\r
- }\r
-}
\ No newline at end of file
}\r
\r
bool SystemPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ return true;\r
+ }\r
+\r
+ bool SystemPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
{\r
\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
- (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
{\r
NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);\r
return true;\r
// 根据控件id查找是哪个控件触发了点击回调\r
if (strcmp(view.GetViewId(), ABOUT_THE_WATCH) == 0)\r
{\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_ABOUT_WATCH);\r
- return true; \r
+ SystemView::GetInstance()->ChangeView(0,1);\r
+ return true;\r
}\r
else if (strcmp(view.GetViewId(), SUPERVISE) == 0)\r
{\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_SUPERVISE);\r
+ SystemView::GetInstance()->ChangeView(0,2);\r
return true;\r
}\r
else if (strcmp(view.GetViewId(), SYSTEM_LANGUAGE) == 0)\r
NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_SYSTEM_LANGUAGE);\r
return true;\r
}\r
- else if (strcmp(view.GetViewId(), REBOOT) == 0)\r
- {\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_REBOOT);\r
- return true;\r
- }\r
- else if (strcmp(view.GetViewId(), SHOUTDOWM) == 0)\r
- {\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_SHOUTDOWN);\r
- return true;\r
- }\r
else if (strcmp(view.GetViewId(), FACTORY_RESET) == 0)\r
{\r
NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_FACTORY_RESET);\r
+++ /dev/null
-#include "AppViewIDs.h"\r
-#include "NativeAbility.h"\r
-#include "graphic_math.h"\r
-#include "string.h"\r
-#include "system/include/SystemRebootPresenter.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
- // 当前Presenter属性实例化的内存指针\r
- static SystemRebootPresenter *g_pSystemRebootPresenter = nullptr;\r
-\r
- SystemRebootPresenter::SystemRebootPresenter()\r
- {\r
-\r
- g_pSystemRebootPresenter = this;\r
- }\r
-\r
- SystemRebootPresenter::~SystemRebootPresenter()\r
- {\r
-\r
- g_pSystemRebootPresenter = nullptr;\r
- }\r
-\r
- SystemRebootPresenter *SystemRebootPresenter::GetInstance()\r
- {\r
-\r
- return g_pSystemRebootPresenter;\r
- }\r
-\r
- void SystemRebootPresenter::OnStart()\r
- {\r
-\r
- Presenter<SystemRebootView>::OnStart();\r
- }\r
-\r
- void SystemRebootPresenter::OnPause(void)\r
- {\r
-\r
- Presenter<SystemRebootView>::OnPause();\r
- }\r
-\r
- void SystemRebootPresenter::OnResume(void)\r
- {\r
-\r
- Presenter<SystemRebootView>::OnResume();\r
- }\r
-\r
- void SystemRebootPresenter::OnStop(void)\r
- {\r
-\r
- Presenter<SystemRebootView>::OnStop();\r
- }\r
-\r
- bool SystemRebootPresenter::OnDrag(UIView &view, const DragEvent &event)\r
- {\r
-\r
- UNUSED(view);\r
- UNUSED(event);\r
- return true;\r
- }\r
- extern "C"\r
- {\r
- //重启\r
- uint32_t mcu_os_sys_reset(uint8_t *para, uint32_t para_len); \r
- }\r
- bool SystemRebootPresenter::OnClick(UIView &view, const ClickEvent &event)\r
- {\r
-\r
- // 根据控件id查找是哪个控件触发了点击回调\r
- if (strcmp(view.GetViewId(), REBOOT_CHECKON) == 0)\r
- {\r
- mcu_os_sys_reset(NULL,NULL);\r
- return true;\r
- }\r
- else if (strcmp(view.GetViewId(), REBOOT_CHECKOFF) == 0)\r
- {\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM);\r
- return true;\r
- }\r
- return false;\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-#include "system/include/SystemRebootView.h"\r
-#include "system/include/SystemRebootPresenter.h"\r
-\r
-#include "UiConfig.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
- static SystemRebootView *g_pSystemRebootView{nullptr};\r
-\r
- SystemRebootView::SystemRebootView()\r
- {\r
- g_pSystemRebootView = this;\r
- }\r
-\r
- SystemRebootView::~SystemRebootView()\r
- {\r
- DeInitView();\r
- g_pSystemRebootView = nullptr;\r
- }\r
-\r
- SystemRebootView *SystemRebootView::GetInstance()\r
- {\r
- return g_pSystemRebootView;\r
- }\r
-\r
- void SystemRebootView::InitView()\r
- {\r
- if (container_ == nullptr)\r
- {\r
- container_ = new UIViewGroup();\r
- container_->SetPosition(0, 0, 466, 466);\r
- container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
- }\r
- // Add ImageView to App\r
- if (RebootImage == nullptr)\r
- {\r
- RebootImage = new UIImageView();\r
- }\r
- RebootImage->SetPosition(0, 0); // widget's left position and top position\r
- RebootImage->Resize(466, 466); // widget's width and height\r
- RebootImage->SetViewId("RebootImage"); // Set style\r
- RebootImage->SetStyle(STYLE_BORDER_RADIUS, 300);\r
- RebootImage->SetSrc("/user/res/system/reboot.bin"); //重新启动\r
- // Add to rootView\r
- container_->Add(RebootImage);\r
- RebootImage->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (RebootButtonCheckOn == nullptr)\r
- {\r
- RebootButtonCheckOn = new UIButton();\r
- }\r
- RebootButtonCheckOn->SetPosition(256, 299); // widget's left position and top position\r
- RebootButtonCheckOn->Resize(100, 100); // widget's width and height\r
- RebootButtonCheckOn->SetViewId(REBOOT_CHECKON); // Set style\r
- RebootButtonCheckOn->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
- RebootButtonCheckOn->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, nullptr);\r
- RebootButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);\r
- RebootButtonCheckOn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- // Add the CallBack about events\r
- UIView::OnClickListener *RebootButtonCheckOnClick = static_cast<UIView::OnClickListener *>(SystemRebootPresenter::GetInstance());\r
- RebootButtonCheckOn->SetOnClickListener(RebootButtonCheckOnClick);\r
- // Add to rootView\r
- container_->Add(RebootButtonCheckOn);\r
- RebootButtonCheckOn->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (RebootButtonCheckOff == nullptr)\r
- {\r
- RebootButtonCheckOff = new UIButton();\r
- }\r
- RebootButtonCheckOff->SetPosition(111, 299); // widget's left position and top position\r
- RebootButtonCheckOff->Resize(100, 100); // widget's width and height\r
- RebootButtonCheckOff->SetViewId(REBOOT_CHECKOFF); // Set style\r
- RebootButtonCheckOff->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
- RebootButtonCheckOff->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, nullptr);\r
- RebootButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);\r
- RebootButtonCheckOff->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- // Add the CallBack about events\r
- UIView::OnClickListener *RebootButtonCheckOffClick = static_cast<UIView::OnClickListener *>(SystemRebootPresenter::GetInstance());\r
- RebootButtonCheckOff->SetOnClickListener(RebootButtonCheckOffClick);\r
- // Add to rootView\r
- container_->Add(RebootButtonCheckOff);\r
- RebootButtonCheckOff->SetVisible(true);\r
- }\r
-\r
- void SystemRebootView::DeInitView()\r
- {\r
- if (container_ != nullptr)\r
- {\r
- container_->RemoveAll();\r
- delete container_;\r
- container_ = nullptr;\r
- }\r
- if (RebootImage != nullptr)\r
- {\r
- delete RebootImage;\r
- RebootImage = nullptr;\r
- }\r
- if (RebootButtonCheckOn != nullptr)\r
- {\r
- delete RebootButtonCheckOn;\r
- RebootButtonCheckOn = nullptr;\r
- }\r
- if (RebootButtonCheckOff != nullptr)\r
- {\r
- delete RebootButtonCheckOff;\r
- RebootButtonCheckOff = nullptr;\r
- }\r
- }\r
-\r
- void SystemRebootView::OnStart()\r
- {\r
- View<SystemRebootPresenter>::OnStart();\r
- InitView();\r
- RootView::GetInstance()->Add(container_);\r
- }\r
-\r
- void SystemRebootView::OnSetUpView()\r
- {\r
- View<SystemRebootPresenter>::OnSetUpView();\r
- Draw();\r
- }\r
-\r
- void SystemRebootView::OnTearDownView()\r
- {\r
- View<SystemRebootPresenter>::OnTearDownView();\r
- return;\r
- }\r
-\r
- void SystemRebootView::OnStop()\r
- {\r
- View<SystemRebootPresenter>::OnStop();\r
- RootView::GetInstance()->RemoveAll();\r
- return;\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-#include "AppViewIDs.h"\r
-#include "NativeAbility.h"\r
-#include "graphic_math.h"\r
-#include "string.h"\r
-#include "system/include/SystemShoutDownPresenter.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
- // 当前Presenter属性实例化的内存指针\r
- static SystemShoutDownPresenter *g_pSystemShoutDownPresenter = nullptr;\r
-\r
- SystemShoutDownPresenter::SystemShoutDownPresenter()\r
- {\r
-\r
- g_pSystemShoutDownPresenter = this;\r
- }\r
-\r
- SystemShoutDownPresenter::~SystemShoutDownPresenter()\r
- {\r
-\r
- g_pSystemShoutDownPresenter = nullptr;\r
- }\r
-\r
- SystemShoutDownPresenter *SystemShoutDownPresenter::GetInstance()\r
- {\r
-\r
- return g_pSystemShoutDownPresenter;\r
- }\r
-\r
- void SystemShoutDownPresenter::OnStart()\r
- {\r
-\r
- Presenter<SystemShoutDownView>::OnStart();\r
- }\r
-\r
- void SystemShoutDownPresenter::OnPause(void)\r
- {\r
-\r
- Presenter<SystemShoutDownView>::OnPause();\r
- }\r
-\r
- void SystemShoutDownPresenter::OnResume(void)\r
- {\r
-\r
- Presenter<SystemShoutDownView>::OnResume();\r
- }\r
-\r
- void SystemShoutDownPresenter::OnStop(void)\r
- {\r
-\r
- Presenter<SystemShoutDownView>::OnStop();\r
- }\r
-\r
- bool SystemShoutDownPresenter::OnDrag(UIView &view, const DragEvent &event)\r
- {\r
- UNUSED(view);\r
- UNUSED(event);\r
- return true;\r
- }\r
- extern "C" {\r
- //关机\r
- void uapi_sys_shipmode(uint32_t arg); \r
- }\r
- bool SystemShoutDownPresenter::OnClick(UIView &view, const ClickEvent &event)\r
- {\r
-\r
- // 根据控件id查找是哪个控件触发了点击回调\r
- if (strcmp(view.GetViewId(), SHOUTDOWN_BUTTON_CHECKON) == 0)\r
- { \r
- uapi_sys_shipmode(0);\r
- return true;\r
- }\r
- else if (strcmp(view.GetViewId(), SHOUTDOWN_BUTTON_CHECKOFF) == 0)\r
- {\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM);\r
- return true;\r
- }\r
- return false;\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-#include "system/include/SystemShoutDownView.h"\r
-#include "system/include/SystemShoutDownPresenter.h"\r
-\r
-#include "UiConfig.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
- static SystemShoutDownView *g_pSystemShoutDownView{nullptr};\r
-\r
- SystemShoutDownView::SystemShoutDownView()\r
- {\r
- g_pSystemShoutDownView = this;\r
- }\r
-\r
- SystemShoutDownView::~SystemShoutDownView()\r
- {\r
- DeInitView();\r
- g_pSystemShoutDownView = nullptr;\r
- }\r
-\r
- SystemShoutDownView *SystemShoutDownView::GetInstance()\r
- {\r
- return g_pSystemShoutDownView;\r
- }\r
-\r
- void SystemShoutDownView::InitView()\r
- {\r
- if (container_ == nullptr)\r
- {\r
- container_ = new UIViewGroup();\r
- container_->SetPosition(0, 0, 466, 466);\r
- container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
- }\r
- // Add ImageView to App\r
- if (ShoutDownImage == nullptr)\r
- {\r
- ShoutDownImage = new UIImageView();\r
- }\r
- ShoutDownImage->SetPosition(0, 0); // widget's left position and top position\r
- ShoutDownImage->Resize(466, 466); // widget's width and height\r
- ShoutDownImage->SetViewId("ShoutDownImage"); // Set style\r
- ShoutDownImage->SetStyle(STYLE_BORDER_RADIUS, 300);\r
- ShoutDownImage->SetSrc("/user/res/system/shoutdown.bin");\r
- // Add to rootView\r
- container_->Add(ShoutDownImage);\r
- ShoutDownImage->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (ShoutDownButtonCheckOn == nullptr)\r
- {\r
- ShoutDownButtonCheckOn = new UIButton();\r
- }\r
- ShoutDownButtonCheckOn->SetPosition(256, 299); // widget's left position and top position\r
- ShoutDownButtonCheckOn->Resize(100, 100); // widget's width and height\r
- ShoutDownButtonCheckOn->SetViewId(SHOUTDOWN_BUTTON_CHECKON); // Set style\r
- ShoutDownButtonCheckOn->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
- ShoutDownButtonCheckOn->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, nullptr);\r
- ShoutDownButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);\r
- ShoutDownButtonCheckOn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- // Add the CallBack about events\r
- UIView::OnClickListener *ShoutDownButtonCheckOnClick = static_cast<UIView::OnClickListener *>(SystemShoutDownPresenter::GetInstance());\r
- ShoutDownButtonCheckOn->SetOnClickListener(ShoutDownButtonCheckOnClick);\r
- // Add to rootView\r
- container_->Add(ShoutDownButtonCheckOn);\r
- ShoutDownButtonCheckOn->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (ShoutDownButtonCheckOff == nullptr)\r
- {\r
- ShoutDownButtonCheckOff = new UIButton();\r
- }\r
- ShoutDownButtonCheckOff->SetPosition(111, 299); // widget's left position and top position\r
- ShoutDownButtonCheckOff->Resize(100, 100); // widget's width and height\r
- ShoutDownButtonCheckOff->SetViewId(SHOUTDOWN_BUTTON_CHECKOFF); // Set style\r
- ShoutDownButtonCheckOff->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
- ShoutDownButtonCheckOff->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, nullptr);\r
- ShoutDownButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);\r
- ShoutDownButtonCheckOff->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- // Add the CallBack about events\r
- UIView::OnClickListener *ShoutDownButtonCheckOffClick = static_cast<UIView::OnClickListener *>(SystemShoutDownPresenter::GetInstance());\r
- ShoutDownButtonCheckOff->SetOnClickListener(ShoutDownButtonCheckOffClick);\r
- // Add to rootView\r
- container_->Add(ShoutDownButtonCheckOff);\r
- ShoutDownButtonCheckOff->SetVisible(true);\r
- }\r
-\r
- void SystemShoutDownView::DeInitView()\r
- {\r
- if (container_ != nullptr)\r
- {\r
- container_->RemoveAll();\r
- delete container_;\r
- container_ = nullptr;\r
- }\r
- if (ShoutDownImage != nullptr)\r
- {\r
- delete ShoutDownImage;\r
- ShoutDownImage = nullptr;\r
- }\r
- if (ShoutDownButtonCheckOn != nullptr)\r
- {\r
- delete ShoutDownButtonCheckOn;\r
- ShoutDownButtonCheckOn = nullptr;\r
- }\r
- if (ShoutDownButtonCheckOff != nullptr)\r
- {\r
- delete ShoutDownButtonCheckOff;\r
- ShoutDownButtonCheckOff = nullptr;\r
- }\r
- }\r
-\r
- void SystemShoutDownView::OnStart()\r
- {\r
- View<SystemShoutDownPresenter>::OnStart();\r
- InitView();\r
- RootView::GetInstance()->Add(container_);\r
- }\r
-\r
- void SystemShoutDownView::OnSetUpView()\r
- {\r
- View<SystemShoutDownPresenter>::OnSetUpView();\r
- Draw();\r
- }\r
-\r
- void SystemShoutDownView::OnTearDownView()\r
- {\r
- View<SystemShoutDownPresenter>::OnTearDownView();\r
- return;\r
- }\r
-\r
- void SystemShoutDownView::OnStop()\r
- {\r
- View<SystemShoutDownPresenter>::OnStop();\r
- RootView::GetInstance()->RemoveAll();\r
- return;\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-#include "AppViewIDs.h"\r
-#include "NativeAbility.h"\r
-#include "graphic_math.h"\r
-#include "string.h"\r
-#include "system/include/SystemSupervisePresenter.h"\r
-\r
-namespace OHOS\r
-{\r
-\r
- // 当前Presenter属性实例化的内存指针\r
- static SystemSupervisePresenter *g_pSystemSupervisePresenter = nullptr;\r
-\r
- SystemSupervisePresenter::SystemSupervisePresenter()\r
- {\r
-\r
- g_pSystemSupervisePresenter = this;\r
- }\r
-\r
- SystemSupervisePresenter::~SystemSupervisePresenter()\r
- {\r
-\r
- g_pSystemSupervisePresenter = nullptr;\r
- }\r
-\r
- SystemSupervisePresenter *SystemSupervisePresenter::GetInstance()\r
- {\r
-\r
- return g_pSystemSupervisePresenter;\r
- }\r
-\r
- void SystemSupervisePresenter::OnStart()\r
- {\r
-\r
- Presenter<SystemSuperviseView>::OnStart();\r
- }\r
-\r
- void SystemSupervisePresenter::OnPause(void)\r
- {\r
-\r
- Presenter<SystemSuperviseView>::OnPause();\r
- }\r
-\r
- void SystemSupervisePresenter::OnResume(void)\r
- {\r
-\r
- Presenter<SystemSuperviseView>::OnResume();\r
- }\r
-\r
- void SystemSupervisePresenter::OnStop(void)\r
- {\r
-\r
- Presenter<SystemSuperviseView>::OnStop();\r
- }\r
-\r
- bool SystemSupervisePresenter::OnDrag(UIView &view, const DragEvent &event)\r
- {\r
-\r
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
- (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
- {\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM);\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- bool SystemSupervisePresenter::OnClick(UIView &view, const ClickEvent &event)\r
- {\r
-\r
- // 根据控件id查找是哪个控件触发了点击回调\r
- // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
- return true;\r
- }\r
-}
\ No newline at end of file
#include "system/include/SystemSuperviseView.h"\r
-#include "system/include/SystemSupervisePresenter.h"\r
-\r
+#include "system/include/SystemPresenter.h"\r
+#include "wearable_log.h"\r
namespace OHOS\r
{\r
\r
\r
SystemSuperviseView::SystemSuperviseView()\r
{\r
-\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemSuperviseView::SystemSuperviseView");\r
g_pSystemSuperviseView = this;\r
}\r
\r
SystemSuperviseView::~SystemSuperviseView()\r
{\r
- DeInitView();\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemSuperviseView::~SystemSuperviseView");\r
+ ClearAll();\r
g_pSystemSuperviseView = nullptr;\r
}\r
\r
SystemSuperviseView *SystemSuperviseView::GetInstance()\r
{\r
-\r
return g_pSystemSuperviseView;\r
}\r
UILabel *SystemSuperviseView::InitLabel(int left, int top, int width, int height, const char *text, const char *viewId, int fontSize, int fontlineHeigh, uint16_t speed)\r
return label;\r
}\r
\r
- void SystemSuperviseView::InitView()\r
+ UIScrollView *SystemSuperviseView::SystemSuperviseViewInit()\r
{\r
- if (container_ == nullptr)\r
+ if (SystemSuperviseViewScrollView == nullptr)\r
{\r
- container_ = new UIViewGroup();\r
- container_->SetPosition(0, 0, 466, 466);\r
- container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemSupervisePresenter::GetInstance());\r
- if (draglistener == nullptr)\r
- {\r
- return;\r
- }\r
- container_->SetOnDragListener(draglistener);\r
- container_->SetTouchable(true);\r
- container_->SetDraggable(true);\r
+ SystemSuperviseViewScrollView = new UIScrollView();\r
}\r
- if (scrollView1_ == nullptr)\r
+ SystemSuperviseViewScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+ SystemSuperviseViewScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+ SystemSuperviseViewScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294);\r
+ draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());\r
+ if (draglistener == nullptr)\r
{\r
- scrollView1_ = new UIScrollView();\r
+ return nullptr;\r
}\r
- scrollView1_->SetPosition(0, 0); // widget's left position and top position\r
- scrollView1_->Resize(466, 466); // widget's width and height\r
- scrollView1_->SetViewId("scrollView"); // Set style\r
- scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
- scrollView1_->SetStyle(STYLE_BORDER_RADIUS, 1294);\r
-\r
- container_->Add(scrollView1_);\r
- scrollView1_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label1_ == nullptr)\r
+ SystemSuperviseViewScrollView->SetOnDragListener(draglistener);\r
+ SystemSuperviseViewScrollView->SetTouchable(true);\r
+ SystemSuperviseViewScrollView->SetDraggable(true);\r
+ /* -------------------------------------------------------------------------- */\r
+ if (Title == nullptr)\r
{\r
- label1_ = InitLabel(203, 52, 60, 35, "监管", "label1", 30, 35, 6);\r
+ Title = InitLabel(203, 52, 60, 35, "监管", "Title", 30, 35, 6);\r
}\r
- scrollView1_->Add(label1_);\r
- label1_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label2_ == nullptr)\r
+ SystemSuperviseViewScrollView->Add(Title);\r
+ /* -------------------------------------------------------------------------- */\r
+ if (ProductModel == nullptr)\r
{\r
- label2_ = InitLabel(203, 164, 60, 35, "型号", "label2", 30, 35, 6);\r
+ ProductModel = InitLabel(203, 164, 60, 35, "型号", "ProductModel", 30, 35, 6);\r
}\r
- scrollView1_->Add(label2_);\r
- label2_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label3_ == nullptr)\r
+ SystemSuperviseViewScrollView->Add(ProductModel);\r
+ /* -------------------------------------------------------------------------- */\r
+ ProductModelName = new UILabel();\r
+ if (ProductModelName == nullptr)\r
{\r
- label3_ = InitLabel(102, 221, 263, 30, "周冰鸿的 Smart Watch", "label3", 26, 30, 6);\r
+ return nullptr;\r
}\r
- label3_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label3_);\r
- label3_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label4_ == nullptr)\r
+ ProductModelName->SetPosition(37, 221, 400, 30); // 位置大小\r
+ ProductModelName->SetStyle(STYLE_TEXT_FONT, 26); // 字体大小\r
+ ProductModelName->SetStyle(STYLE_LINE_HEIGHT, 30); // 字体行高\r
+ ProductModelName->SetText("Watch Soar"); // 内容\r
+ ProductModelName->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); // 断行模式。\r
+ ProductModelName->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+ ProductModelName->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+ ProductModelName->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemSuperviseViewScrollView->Add(ProductModelName);\r
+ /* -------------------------------------------------------------------------- */\r
+ if (CMIT == nullptr)\r
{\r
- label4_ = InitLabel(198, 310, 71, 35, "CMIT", "label4", 30, 35, 6);\r
+ CMIT = InitLabel(198, 310, 71, 35, "CMIT", "CMIT", 30, 35, 6);\r
}\r
- scrollView1_->Add(label4_);\r
- label4_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- if (label5_ == nullptr)\r
+ SystemSuperviseViewScrollView->Add(CMIT);\r
+ /* -------------------------------------------------------------------------- */\r
+ CMITName = new UILabel();\r
+ if (CMITName == nullptr)\r
{\r
- label5_ = InitLabel(175, 367, 119, 30, "V02.03.01", "label5", 26, 30, 6);\r
+ return nullptr;\r
}\r
- label5_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
- scrollView1_->Add(label5_);\r
- label5_->SetVisible(true);\r
+ CMITName->SetPosition(37, 367, 400, 30); // 位置大小\r
+ CMITName->SetStyle(STYLE_TEXT_FONT, 26); // 字体大小\r
+ CMITName->SetStyle(STYLE_LINE_HEIGHT, 30); // 字体行高\r
+ CMITName->SetText("V02.03.01"); // 内容\r
+ CMITName->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); // 断行模式。\r
+ CMITName->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+ CMITName->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+ CMITName->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
+ SystemSuperviseViewScrollView->Add(CMITName);\r
+\r
+ return SystemSuperviseViewScrollView;\r
}\r
\r
- void SystemSuperviseView::DeInitView()\r
+ void SystemSuperviseView::ClearAll()\r
{\r
- if (container_ != nullptr)\r
- {\r
- container_->RemoveAll();\r
- delete container_;\r
- container_ = nullptr;\r
- }\r
- if (scrollView1_ != nullptr)\r
+ SystemSuperviseViewScrollView->RemoveAll();\r
+ delete draglistener;\r
+ draglistener = nullptr;\r
+ if (Title != nullptr)\r
{\r
- delete scrollView1_;\r
- scrollView1_ = nullptr;\r
+ delete Title;\r
+ Title = nullptr;\r
}\r
- if (label1_ != nullptr)\r
+ if (ProductModel != nullptr)\r
{\r
- delete label1_;\r
- label1_ = nullptr;\r
+ delete ProductModel;\r
+ ProductModel = nullptr;\r
}\r
- if (label2_ != nullptr)\r
+ if (ProductModelName != nullptr)\r
{\r
- delete label2_;\r
- label2_ = nullptr;\r
+ delete ProductModelName;\r
+ ProductModelName = nullptr;\r
}\r
- if (label3_ != nullptr)\r
+ if (CMIT != nullptr)\r
{\r
- delete label3_;\r
- label3_ = nullptr;\r
+ delete CMIT;\r
+ CMIT = nullptr;\r
}\r
- if (label4_ != nullptr)\r
+ if (CMITName != nullptr)\r
{\r
- delete label4_;\r
- label4_ = nullptr;\r
+ delete CMITName;\r
+ CMITName = nullptr;\r
}\r
- if (label5_ != nullptr)\r
- {\r
- delete label5_;\r
- label5_ = nullptr;\r
- }\r
- }\r
-\r
- void SystemSuperviseView::OnStart()\r
- {\r
- InitView();\r
- RootView::GetInstance()->Add(container_);\r
+ delete SystemSuperviseViewScrollView;\r
+ SystemSuperviseViewScrollView = nullptr;\r
}\r
\r
- void SystemSuperviseView::OnSetUpView()\r
- {\r
- View<SystemSupervisePresenter>::OnSetUpView();\r
- Draw();\r
- }\r
-\r
- void SystemSuperviseView::OnTearDownView()\r
- {\r
-\r
- View<SystemSupervisePresenter>::OnTearDownView();\r
- return;\r
- }\r
-\r
- void SystemSuperviseView::OnStop()\r
- {\r
-\r
- View<SystemSupervisePresenter>::OnStop();\r
- RootView::GetInstance()->RemoveAll();\r
- return;\r
- }\r
}
\ No newline at end of file
#include "system/include/SystemView.h"\r
#include "system/include/SystemPresenter.h"\r
-\r
-#include "UiConfig.h"\r
-\r
+#include "wearable_log.h"\r
namespace OHOS\r
{\r
\r
\r
SystemView::SystemView()\r
{\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemView");\r
g_pSystemView = this;\r
}\r
\r
SystemView::~SystemView()\r
{\r
- DeInitView();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::~SystemView");\r
+ ClearAll();\r
g_pSystemView = nullptr;\r
}\r
\r
SystemView *SystemView::GetInstance()\r
{\r
-\r
return g_pSystemView;\r
}\r
\r
- void SystemView::InitIView()\r
+ /// @brief 设置SystemScrollView\r
+ /// @param void\r
+ /// @return true 设置成功,false 失败\r
+ bool SystemView::SetTheSystemScrollView(void)\r
{\r
- if (container_ == nullptr)\r
+ SystemScrollView[0] = new UIScrollView();\r
+ if (SystemScrollView == nullptr)\r
{\r
- container_ = new UIViewGroup();\r
- container_->SetPosition(0, 0, 466, 466);\r
- container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());\r
- if (draglistener == nullptr)\r
- {\r
- return;\r
- }\r
- container_->SetOnDragListener(draglistener);\r
- container_->SetTouchable(true);\r
- container_->SetDraggable(true);\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemScrollView new fail!");\r
+ return false;\r
}\r
- /***********************************************************************************************************/\r
- // Add ScrollView to App\r
- if (SystemScrollView == nullptr)\r
+ SystemScrollView[0]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+ SystemScrollView[0]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+ SystemScrollView[0]->SetScrollBlankSize(35);\r
+ SystemScrollView[0]->SetReboundSize(50);\r
+ SystemScrollView[0]->SetDirection(1);\r
+ draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());\r
+ if (draglistener == nullptr)\r
{\r
- SystemScrollView = new UIScrollView();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");\r
+ return false;\r
}\r
- SystemScrollView->SetPosition(0, 0); // widget's left position and top position\r
- SystemScrollView->Resize(466, 466); // widget's width and height\r
- SystemScrollView->SetViewId("SystemScrollView"); // Set style\r
- SystemScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
- container_->Add(SystemScrollView);\r
- SystemScrollView->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Label to App\r
+ SystemScrollView[0]->SetOnDragListener(draglistener);\r
+ SystemScrollView[0]->SetTouchable(true);\r
+ SystemScrollView[0]->SetDraggable(true);\r
+ return true;\r
+ }\r
+\r
+ /// @brief 设置标题\r
+ /// @param void\r
+ /// @return true 设置成功,false 失败\r
+ bool SystemView::SetTheTitle(void)\r
+ {\r
+ SystemLabel = new UILabel();\r
if (SystemLabel == nullptr)\r
{\r
- SystemLabel = new UILabel();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLabel new fail!");\r
+ return false;\r
}\r
- SystemLabel->SetPosition(203, 52); // widget's left position and top position\r
- SystemLabel->Resize(200, 60); // widget's width and height\r
- SystemLabel->SetViewId("SystemLabel"); // Set style\r
+ SystemLabel->SetPosition(203, 52);\r
SystemLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
SystemLabel->SetStyle(STYLE_TEXT_FONT, 30);\r
SystemLabel->SetStyle(STYLE_LINE_HEIGHT, 35);\r
- // Set additional property\r
SystemLabel->SetText("系统");\r
SystemLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
SystemLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
SystemLabel->SetRollSpeed(6);\r
SystemLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
- // Add to scrollView3\r
- SystemScrollView->Add(SystemLabel);\r
- SystemLabel->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Button to App\r
- if (AboutTheWatchButton == nullptr)\r
- {\r
- AboutTheWatchButton = new UIButton();\r
- }\r
- AboutTheWatchButton->SetPosition(43, 120); // widget's left position and top position\r
- AboutTheWatchButton->Resize(380, 100); // widget's width and height\r
- AboutTheWatchButton->SetViewId(ABOUT_THE_WATCH); // Set style //关于手表\r
- AboutTheWatchButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- AboutTheWatchButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+ return true;\r
+ }\r
\r
- AboutTheWatchButton->SetImageSrc("/user/res/system/SYSTEM_ABOUT_THE_WATCH.bin", nullptr);\r
- AboutTheWatchButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- // Add the CallBack about events\r
- UIView::OnClickListener *AboutTheWatchButtonClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());\r
- AboutTheWatchButton->SetOnClickListener(AboutTheWatchButtonClick);\r
- // Add to scrollView3\r
- SystemScrollView->Add(AboutTheWatchButton);\r
- AboutTheWatchButton->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Button to App\r
- if (SuperviseButton == nullptr)\r
+ /// @brief 设置按钮\r
+ /// @param button\r
+ /// @return true 设置成功,false 失败\r
+ UIButton *SystemView::SetTheButton(ButtonConfig &buttonconfig, UIView::OnClickListener *clickListener)\r
+ {\r
+ UIButton *button = new UIButton();\r
+ if (button == nullptr)\r
{\r
- SuperviseButton = new UIButton();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button new fail!");\r
+ return nullptr;\r
}\r
- SuperviseButton->SetPosition(43, 240); // widget's left position and top position\r
- SuperviseButton->Resize(380, 100); // widget's width and height\r
- SuperviseButton->SetViewId(SUPERVISE); // Set style //监管\r
- SuperviseButton->SetStyle(STYLE_BORDER_RADIUS, 50);\r
- SuperviseButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- SuperviseButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
- SuperviseButton->SetImageSrc("/user/res/system/SYSTEM_SUPERVISE.bin", nullptr);\r
- SuperviseButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- SuperviseButton->SetStyleForState(STYLE_BORDER_RADIUS, 50, UIButton::PRESSED);\r
+ button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);\r
+ button->SetViewId(buttonconfig.ViewId);\r
+ button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
+ button->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+ button->SetImageSrc(buttonconfig.ImageSrc, nullptr);\r
+ button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+ button->SetOnClickListener(clickListener);\r
+ return button;\r
+ }\r
\r
- // Add the CallBack about events\r
- UIView::OnClickListener *SuperviseButtonClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());\r
- SuperviseButton->SetOnClickListener(SuperviseButtonClick);\r
- // Add to scrollView3\r
- SystemScrollView->Add(SuperviseButton);\r
- SuperviseButton->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Button to App\r
- if (SystemLanguageButton == nullptr)\r
+ void SystemView::InitIView(void)\r
+ {\r
+ if (!SetTheSystemScrollView())\r
{\r
- SystemLanguageButton = new UIButton();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheSystemScrollView() fail!");\r
+ return;\r
}\r
- SystemLanguageButton->SetPosition(43, 360); // widget's left position and top position\r
- SystemLanguageButton->Resize(380, 100); // widget's width and height\r
- SystemLanguageButton->SetViewId(SYSTEM_LANGUAGE); // Set style //系统语言\r
- SystemLanguageButton->SetStyle(STYLE_BORDER_RADIUS, 50);\r
- SystemLanguageButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- SystemLanguageButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
- SystemLanguageButton->SetImageSrc("/user/res/system/SYSTEM_SYSTEM_LANGUAGE.bin", nullptr);\r
- SystemLanguageButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- SystemLanguageButton->SetStyleForState(STYLE_BORDER_RADIUS, 50, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *SystemLanguageButtonClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());\r
- SystemLanguageButton->SetOnClickListener(SystemLanguageButtonClick);\r
- // Add to scrollView3\r
- SystemScrollView->Add(SystemLanguageButton);\r
- SystemLanguageButton->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Button to App\r
- if (RebootButton == nullptr)\r
+ if (!SetTheTitle())\r
{\r
- RebootButton = new UIButton();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheTitle() fail!");\r
+ return;\r
}\r
- RebootButton->SetPosition(43, 480); // widget's left position and top position\r
- RebootButton->Resize(380, 100); // widget's width and height\r
- RebootButton->SetViewId(REBOOT); // Set style //重启\r
- RebootButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- RebootButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
- RebootButton->SetImageSrc("/user/res/system/SYSTEM_REBOOT.bin", nullptr);\r
- RebootButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- // Add the CallBack about events\r
- UIView::OnClickListener *RebootButtonClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());\r
- RebootButton->SetOnClickListener(RebootButtonClick);\r
- // Add to scrollView3\r
- SystemScrollView->Add(RebootButton);\r
- RebootButton->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add Button to App\r
- if (ShoutdownButton == nullptr)\r
+ /* -------------------------------------------------------------------------- */\r
+ clickListener = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());\r
+ /* -------------------------------------------------------------------------- */\r
+ ButtonConfig buttonconfig;\r
+ buttonconfig.x = 43;\r
+ buttonconfig.y = 120;\r
+ buttonconfig.w = 380;\r
+ buttonconfig.h = 100;\r
+ buttonconfig.ViewId = ABOUT_THE_WATCH;\r
+ buttonconfig.ImageSrc = ABOUT_THE_WATCH_IMAGESRC;\r
+ AboutTheWatchButton = SetTheButton(buttonconfig, clickListener);\r
+ if (nullptr == AboutTheWatchButton)\r
{\r
- ShoutdownButton = new UIButton();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::AboutTheWatchButton new fail!");\r
+ return;\r
}\r
- ShoutdownButton->SetPosition(43, 600); // widget's left position and top position\r
- ShoutdownButton->Resize(380, 100); // widget's width and height\r
- ShoutdownButton->SetViewId(SHOUTDOWM); // Set style //关机\r
- ShoutdownButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- ShoutdownButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
- // Set additional property\r
- char *button5triggeredImgSrc = nullptr;\r
- ShoutdownButton->SetImageSrc("/user/res/system/SYSTEM_SHOUTDOWM.bin", nullptr);\r
- ShoutdownButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *ShoutdownButtonClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());\r
- ShoutdownButton->SetOnClickListener(ShoutdownButtonClick);\r
- // Add to scrollView3\r
- SystemScrollView->Add(ShoutdownButton);\r
- ShoutdownButton->SetVisible(true);\r
-\r
- /***********************************************************************************************************/\r
- // Add Button to App\r
- if (FactoryResetButton == nullptr)\r
+ /* -------------------------------------------------------------------------- */\r
+ buttonconfig.y = 240;\r
+ buttonconfig.ViewId = SUPERVISE;\r
+ buttonconfig.ImageSrc = SUPERVISE_IMAGESRC;\r
+ SuperviseButton = SetTheButton(buttonconfig, clickListener);\r
+ if (nullptr == SuperviseButton)\r
{\r
- FactoryResetButton = new UIButton();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SuperviseButton new fail!");\r
}\r
- FactoryResetButton->SetPosition(43, 720); // widget's left position and top position\r
- FactoryResetButton->Resize(380, 100); // widget's width and height\r
- FactoryResetButton->SetViewId(FACTORY_RESET); // Set style //恢复出厂设置\r
- FactoryResetButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- FactoryResetButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
- FactoryResetButton->SetImageSrc("/user/res/system/SYSTEM_FACTORY_RESET.bin", nullptr);\r
- FactoryResetButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *FactoryResetButtonClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());\r
- FactoryResetButton->SetOnClickListener(FactoryResetButtonClick);\r
- // Add to scrollView3\r
- SystemScrollView->Add(FactoryResetButton);\r
- FactoryResetButton->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add ImageView to App\r
- if (image1_ == nullptr)\r
+ /* -------------------------------------------------------------------------- */\r
+ buttonconfig.y = 360;\r
+ buttonconfig.ViewId = SYSTEM_LANGUAGE;\r
+ buttonconfig.ImageSrc = SYSTEM_LANGUAGE_IMAGESRC;\r
+ SystemLanguageButton = SetTheButton(buttonconfig, clickListener);\r
+ if (nullptr == SystemLanguageButton)\r
{\r
- image1_ = new UIImageView();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLanguageButton fail!");\r
+ return;\r
}\r
- image1_->SetPosition(171, 801); // widget's left position and top position\r
- image1_->Resize(100, 100); // widget's width and height\r
- image1_->SetViewId("image1"); // Set style\r
-\r
- // Add to scrollView3\r
- SystemScrollView->Add(image1_);\r
- image1_->SetVisible(true);\r
- /***********************************************************************************************************/\r
- // Add ImageView to App\r
- if (image2_ == nullptr)\r
+ /* -------------------------------------------------------------------------- */\r
+ buttonconfig.y = 480;\r
+ buttonconfig.ViewId = FACTORY_RESET;\r
+ buttonconfig.ImageSrc = FACTORY_RESET_LANGUAGE_IMAGESRC;\r
+ FactoryResetButton = SetTheButton(buttonconfig, clickListener);\r
+ if (nullptr == FactoryResetButton)\r
{\r
- image2_ = new UIImageView();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FactoryResetButton fail!");\r
+ return;\r
}\r
- image2_->SetPosition(183, 21); // widget's left position and top position\r
- image2_->Resize(100, 100); // widget's width and height\r
- image2_->SetViewId("image2"); // Set style\r
- // Add to scrollView3\r
- SystemScrollView->Add(image2_);\r
- image2_->SetVisible(true);\r
+ initViewStatus = true;\r
}\r
\r
- void SystemView::DeInitView()\r
+ void SystemView::ClearAll()\r
{\r
- if (container_ != nullptr)\r
- {\r
- container_->RemoveAll();\r
- delete container_;\r
- container_ = nullptr;\r
- }\r
- if (SystemScrollView != nullptr)\r
- {\r
- delete SystemScrollView;\r
- SystemScrollView = nullptr;\r
- }\r
- if (SystemLabel != nullptr)\r
+ if (initViewStatus == true)\r
{\r
+ SystemScrollView[0]->RemoveAll();\r
+ for (int i = 0; i < 3; i++)\r
+ {\r
+ delete SystemScrollView[i];\r
+ SystemScrollView[i] = nullptr;\r
+ }\r
delete SystemLabel;\r
SystemLabel = nullptr;\r
- }\r
- if (image2_ != nullptr)\r
- {\r
- delete image2_;\r
- image2_ = nullptr;\r
- }\r
- if (image1_ != nullptr)\r
- {\r
- delete image1_;\r
- image1_ = nullptr;\r
- }\r
- if (FactoryResetButton != nullptr)\r
- {\r
+ delete AboutTheWatchButton;\r
+ AboutTheWatchButton = nullptr;\r
+ delete SuperviseButton;\r
+ SuperviseButton = nullptr;\r
+ delete SystemLanguageButton;\r
+ SystemLanguageButton = nullptr;\r
delete FactoryResetButton;\r
FactoryResetButton = nullptr;\r
}\r
- if (ShoutdownButton != nullptr)\r
+ }\r
+\r
+ bool SystemView::ChangeSystemView(int16_t thisView)\r
+ {\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ return true;\r
+ }\r
+\r
+ //跳转到关于手表\r
+ bool SystemView::ChangeSystemAboutView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
{\r
- delete ShoutdownButton;\r
- ShoutdownButton = nullptr;\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ p_SystemAboutTheWatchView = new SystemAboutTheWatchView();\r
+ if (p_SystemAboutTheWatchView == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = p_SystemAboutTheWatchView->SystemAbouTheWatchtInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
}\r
- if (RebootButton != nullptr)\r
+ return true;\r
+ }\r
+ /* -------------------------------------------------------------------------- */\r
+ // 1.MainStopWatchViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。\r
+ struct SystemViewMapper\r
+ {\r
+ const int16_t viewId;\r
+ bool (SystemView::*func)(int16_t thisView);\r
+ };\r
+\r
+ //跳转到系统监管\r
+ bool SystemView::ChangeSystemSuperviseView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
{\r
- delete RebootButton;\r
- RebootButton = nullptr;\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemSuperviseView");\r
+ p_SystemSuperviseView = new SystemSuperviseView();\r
+ if (p_SystemSuperviseView == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = p_SystemSuperviseView->SystemSuperviseViewInit();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
}\r
- if (AboutTheWatchButton != nullptr)\r
+ return true;\r
+ }\r
+ // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与MainStopWatchView类中的特定成员函数指针进行了绑定。\r
+ static const SystemViewMapper ViewMapper[] =\r
{\r
- delete AboutTheWatchButton;\r
- AboutTheWatchButton = nullptr;\r
- }\r
- if (SuperviseButton != nullptr)\r
+ {0, &SystemView::ChangeSystemView},\r
+ {1, &SystemView::ChangeSystemAboutView},\r
+ {2, &SystemView::ChangeSystemSuperviseView}\r
+ };\r
+\r
+ // 3.根据传入的interface参数执行相应视图ID关联的成员函数。\r
+ bool SystemView::ClickFunc(int16_t interface)\r
+ {\r
+ int funcSize = sizeof(ViewMapper) / sizeof(ViewMapper[0]);\r
+ for (int i = 0; i < funcSize; i++)\r
{\r
- delete SuperviseButton;\r
- SuperviseButton = nullptr;\r
+ if (interface == ViewMapper[i].viewId)\r
+ {\r
+ bool jug = (this->*(ViewMapper[i].func))(interface);\r
+ if (jug == false)\r
+ {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
}\r
- if (SystemLanguageButton != nullptr)\r
+ return false;\r
+ }\r
+\r
+ // 4.切换视图\r
+ void SystemView::ChangeView(int16_t hideView, int16_t showView)\r
+ {\r
+ if (hideView > 4)\r
{\r
- delete SystemLanguageButton;\r
- SystemLanguageButton = nullptr;\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainStopWatchView:: StopWatchViewId Overstep ones bounds");\r
+ return;\r
}\r
+ SystemScrollView[hideView]->SetVisible(false);\r
+ ClickFunc(showView);\r
+ SystemScrollView[showView]->SetVisible(true);\r
+ Draw();\r
}\r
\r
void SystemView::OnStart()\r
{\r
View<SystemPresenter>::OnStart();\r
InitIView();\r
- RootView::GetInstance()->Add(container_);\r
}\r
\r
void SystemView::OnSetUpView()\r
{\r
View<SystemPresenter>::OnSetUpView();\r
+ if (SystemScrollView[0] == nullptr)\r
+ {\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemView:: OnSetUpView has nullptr");\r
+ return;\r
+ }\r
+ SystemScrollView[0]->Add(SystemLabel);\r
+ SystemScrollView[0]->Add(AboutTheWatchButton);\r
+ SystemScrollView[0]->Add(SuperviseButton);\r
+ SystemScrollView[0]->Add(SystemLanguageButton);\r
+ SystemScrollView[0]->Add(FactoryResetButton);\r
+ RootView::GetInstance()->Add(SystemScrollView[0]);\r
Draw();\r
}\r
\r