* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-20 11:05:46
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-20 15:11:40
+ * @LastEditTime: 2024-08-28 20:21:31
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h
*/
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y = 0;
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_W = 466;
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 466;
- static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数
- static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔
+ static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数
+ static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔
static constexpr const char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; // 关机图片路径
- class ShutDownImageAnimatorView
+ class ShutDownImageAnimatorView : public UIImageAnimatorView::AnimatorStopListener
{
public:
ShutDownImageAnimatorView();
static ShutDownImageAnimatorView *GetInstance();
UIViewGroup *ShutDownAnimatorViewInit(void);
UIImageAnimatorView *GeShutDownImageAnimatorView(void);
+ void ShutDownImageAnimator_Start(bool state);
+ bool GetShutDownImageAnimatorIsStart(void);
private:
+ void OnAnimatorStop(UIView &view) override;
void ClearAll(void);
bool ShowUpShutDownAnimatorView();
const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
UIImageAnimatorView *shutDownImageAnimatorView{nullptr}; // 关机动画
ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
const char **ShutDownPathsArray{nullptr}; // 关机图片路径数组
+ bool isShutDownOperation;
+ bool isShutDownImageAnimatorStart{false};
};
}
#endif
\ No newline at end of file
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-18 14:55:27
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-26 20:56:46
+ * @LastEditTime: 2024-08-28 20:23:14
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp
*/
#include "rebootandshutdown/include/RebootAndShutdownModel.h"
-#include "rebootandshutdown/include/RebootAndShutdownPresenter.h"
+#include "rebootandshutdown/include/ShutDownImageAnimatorView.h"
#include "wearable_log.h"
#include "ConfigModel.h"
#include "NativeAbility.h"
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PowerKeyLongPressCallBack");
- RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
- if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ ShutDownImageAnimatorView *shutDownImageAnimatorView = ShutDownImageAnimatorView::GetInstance();
+ if (shutDownImageAnimatorView != nullptr && true == shutDownImageAnimatorView->GetShutDownImageAnimatorIsStart())
{
return;
}
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PowerKeyDoubleClickCallBack");
- RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
- if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ ShutDownImageAnimatorView *shutDownImageAnimatorView = ShutDownImageAnimatorView::GetInstance();
+ if (shutDownImageAnimatorView != nullptr && true == shutDownImageAnimatorView->GetShutDownImageAnimatorIsStart())
{
return;
}
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::FuncKeyOnPressCallBack");
- RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
- if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ ShutDownImageAnimatorView *shutDownImageAnimatorView = ShutDownImageAnimatorView::GetInstance();
+ if (shutDownImageAnimatorView != nullptr && true == shutDownImageAnimatorView->GetShutDownImageAnimatorIsStart())
{
return;
}
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FuncKeyOnLongPressCallBack");
- RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
- if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ ShutDownImageAnimatorView *shutDownImageAnimatorView = ShutDownImageAnimatorView::GetInstance();
+ if (shutDownImageAnimatorView != nullptr && true == shutDownImageAnimatorView->GetShutDownImageAnimatorIsStart())
{
return;
}
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FuncKeyOnClickCallBack");
- RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
- if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ ShutDownImageAnimatorView *shutDownImageAnimatorView = ShutDownImageAnimatorView::GetInstance();
+ if (shutDownImageAnimatorView != nullptr && true == shutDownImageAnimatorView->GetShutDownImageAnimatorIsStart())
{
return;
}
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FuncKeyDoubleClickCallBack");
- RebootAndShutdownPresenter *rebootAndShutdownPresenter = RebootAndShutdownPresenter::GetInstance();
- if (rebootAndShutdownPresenter != nullptr && true == rebootAndShutdownPresenter->GetIsShutDownImageAnimator())
+ ShutDownImageAnimatorView *shutDownImageAnimatorView = ShutDownImageAnimatorView::GetInstance();
+ if (shutDownImageAnimatorView != nullptr && true == shutDownImageAnimatorView->GetShutDownImageAnimatorIsStart())
{
return;
}
#include "rebootandshutdown/include/ShutDownImageAnimatorView.h"
#include "rebootandshutdown/include/RebootAndShutdownPresenter.h"
#include "wearable_log.h"
+#include <custom_utils.h>
namespace OHOS
{
-
+
static ShutDownImageAnimatorView *g_pShutDownAnimatorView = nullptr;
ShutDownImageAnimatorView::ShutDownImageAnimatorView()
{
}
}
+ void ShutDownImageAnimatorView::OnAnimatorStop(UIView &view)
+ {
+ UNUSED(view);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnAnimatorStop");
+ if (isShutDownOperation == true)
+ {
+ uapi_poweroff_device(); // 关机
+ }
+ else
+ {
+ uapi_reboot_device(); // 重启
+ }
+ }
+
UIImageAnimatorView *ShutDownImageAnimatorView::GeShutDownImageAnimatorView(void)
{
return shutDownImageAnimatorView;
}
+ // true 关机 false 重启
+ void ShutDownImageAnimatorView::ShutDownImageAnimator_Start(bool state)
+ {
+ isShutDownOperation = state;
+ shutDownImageAnimatorView->Start();
+ isShutDownImageAnimatorStart = true;
+ }
+
+ //获取开机动画是否已经开始
+ bool ShutDownImageAnimatorView::GetShutDownImageAnimatorIsStart(void)
+ {
+ return isShutDownImageAnimatorStart;
+ }
+
bool ShutDownImageAnimatorView::ShowUpShutDownAnimatorView()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorView::ShowUpShutDownAnimatorView");
shutDownImageAnimatorView->SetImageAnimatorSrc(ShutDownImageInfo, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, 100);
shutDownImageAnimatorView->SetRepeat(false);
shutDownImageAnimatorView->SetRepeatTimes(1);
- UIImageAnimatorView::AnimatorStopListener *stoplistener = static_cast<UIImageAnimatorView::AnimatorStopListener *>(RebootAndShutdownPresenter::GetInstance());
- if (stoplistener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to Create stoplistener!!");
- return false;
- }
- shutDownImageAnimatorView->SetAnimatorStopListener(stoplistener);
+ shutDownImageAnimatorView->SetAnimatorStopListener(this);
}
return true;
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-02-18 09:09:13
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-24 10:43:23
+ * @LastEditTime: 2024-08-28 20:09:20
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp
*/
#include "settings/include/SettingModel.h"
settings[index++] = {VIEW_SET_DIAL_STYLE, PNG_APPLIST_CHANGEDIAL_IMAGE, STR_WATCH_FACE, true};
settings[index++] = {VIEW_SAVEELE, PNG_APPLIST_SAVEELE_IMAGE, STR_POWER_SAVE_MODE, true};
settings[index++] = {VIEW_SYSTEM, PNG_SETTINGS_SYSTEM, STR_SYSTEM, true};
- settings[index++] = {VIEW_REBOOTANDSHUTDOWN, PNG_SETTINGS_SHUTDOWN_AND_RESTART, STR_SHUTDOWN_AND_RESTART, true};
+ // settings[index++] = {VIEW_REBOOTANDSHUTDOWN, PNG_SETTINGS_SHUTDOWN_AND_RESTART, STR_SHUTDOWN_AND_RESTART, true};
usedLen = index;
}
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-03-30 18:29:43\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-07-25 14:48:37\r
+ * @LastEditTime: 2024-08-28 19:55:18\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemPresenter.h\r
*/\r
\r
\r
namespace OHOS\r
{\r
- \r
\r
/* ---------------------------- 恢复出厂设置界面按钮的VIEWID --------------------------- */\r
- static const char *FACTORYRESET_CHECKON = "ShoutDownButtonCheckOn"; // 确认\r
- static const char *FACTORYRESET_CHECKOFF = "ShoutDownButtonCheckOff"; // 取消\r
+ static const char *FACTORYRESET_CHECKON = "factoryresetButtonCheckOn"; // 确认\r
+ static const char *FACTORYRESET_CHECKOFF = "factoryresetButtonCheckOff"; // 取消\r
\r
class SystemView;\r
class SystemPresenter : public Presenter<SystemView>,\r
private:\r
SystemModel *systemModel;\r
bool X_DRAG_FLAG{false};\r
+ bool isShutDownImageAnimatorStart{false};\r
};\r
} // namespace OHOS\r
\r
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-28 17:29:39
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-28 19:09:57
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemRestart.h
+ */
+#ifndef _RESTARTVIEW_VIEW_H_
+#define _RESTARTVIEW_VIEW_H_
+
+#include "components/ui_label_ext.h"
+#include "components/ui_button.h"
+#include "components/ui_image_view.h"
+#include "components/ui_scroll_view.h"
+namespace OHOS
+{
+ static const char *RESTARTVIEW_CHECKON = "RestartButtonCheckOn"; // 确认
+ static const char *RESTARTVIEW_CHECKOFF = "RestartButtonCheckOff"; // 取消
+ class SystemRestart
+ {
+ public:
+ SystemRestart();
+ ~SystemRestart();
+ UIScrollView *SystemRestartViewInit(void);
+
+ private:
+ void ClearAll(void);
+ UIScrollView *SystemRestartScrollView = nullptr;
+ UILabelExt *title{nullptr};
+ UILabelExt *note{nullptr};
+ UIImageView *image = nullptr;
+ UIButton *button_ensure = nullptr;
+ UIButton *button_cancel = nullptr;
+ };
+
+}
+#endif
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-28 17:29:39
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-28 18:08:10
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemShutdown.h
+ */
+#ifndef _SHUTDOWN_VIEW_H_
+#define _SHUTDOWN_VIEW_H_
+
+#include "components/ui_label_ext.h"
+#include "components/ui_button.h"
+#include "components/ui_image_view.h"
+#include "components/ui_scroll_view.h"
+namespace OHOS
+{
+ static const char *SHUTDOWN_CHECKON = "ShoutDownButtonCheckOn"; // 确认
+ static const char *SHUTDOWN_CHECKOFF = "ShoutDownButtonCheckOff"; // 取消
+ class SystemShutdown
+ {
+ public:
+ SystemShutdown();
+ ~SystemShutdown();
+ UIScrollView *SystemShutdownViewInit(void);
+
+ private:
+ void ClearAll(void);
+ UIScrollView *SystemShutdownScrollView = nullptr;
+ UILabelExt *title{nullptr};
+ UILabelExt *note{nullptr};
+ UIImageView *image = nullptr;
+ UIButton *button_ensure = nullptr;
+ UIButton *button_cancel = nullptr;
+ };
+
+}
+#endif
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-03-30 18:29:39\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-07-25 16:38:48\r
+ * @LastEditTime: 2024-08-28 19:43:28\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h\r
*/\r
#ifndef SYSTEM_VIEW_H\r
#include "system/include/SystemFactoryResetView.h"\r
// #include "system/include/Systemupgrade.h"\r
#include "components/ui_toggle_button.h"\r
-\r
+#include "system/include/SystemShutdown.h"\r
+#include "system/include/SystemRestart.h"\r
+#include "rebootandshutdown/include/ShutDownImageAnimatorView.h"\r
namespace OHOS\r
{\r
static constexpr const char *ABOUT_THE_WATCH = "AboutTheWatchButton"; // 关于手表\r
static constexpr const char *SYSTEM_UPGRADE_t = "SystemUpgradeButtonExt_t"; // 点击系统升级\r
static constexpr const char *WATCH_QR_CODE = "WatchqrcodeButton"; // 手表二维码\r
static constexpr const char *SYSTEM_LANGUAGE = "SystemLanguageButton"; // 系统语言\r
+ static constexpr const char *RESTART = "RestartButton"; // 重启\r
+ static constexpr const char *SHUTDOWN = "ShutdownButton"; // 关机\r
static constexpr const char *FACTORY_RESET = "FactoryResetButton"; // 恢复出厂设置\r
\r
typedef enum\r
{\r
- SYSTEMVIEW = 0, // 系统视图(slice)\r
- ABOUTTHEWATCHVIEW, // 关于手表视图(subView)\r
- FACTORYRESETVIEW, // 恢复出厂设置视图(subView)\r
+ SYSTEMVIEW = 0, // 系统视图(slice)\r
+ ABOUTTHEWATCHVIEW, // 关于手表视图(subView)\r
+ RESTARTVIEW, // 重启视图(subView)\r
+ SHUTDOWNVIEW, // 关机视图(subView)\r
+ FACTORYRESETVIEW, // 恢复出厂设置视图(subView)\r
+ SHUTDOWNANIMATIONVIEW, // 关机动画(subView)\r
MAX_SYSTEMVIEWID,\r
} SYSTEMVIEWID;\r
\r
bool ChangeToSystemView(int16_t thisView);\r
bool ChangeToSystemAboutView(int16_t thisView);\r
bool ChangeToSystemFactoryResetView(int16_t thisView);\r
+ bool ChangeToSystemRestartView(int16_t thisView);\r
+ bool ChangeToSystemShutdownView(int16_t thisView);\r
+ bool ChangeToSystemShutdownAnimatorView(int16_t thisView);\r
bool ClickFunc(int16_t interface);\r
bool CheckViewParam(int16_t hideView, int16_t showView);\r
void ChangeView(int16_t hideView, int16_t showView);\r
UIScrollView *GetSystemScrollView(int ViewId);\r
\r
private:\r
- SystemAboutTheWatchView *p_SystemAboutTheWatchView{nullptr}; // 关于手表\r
- SystemFactoryResetView *p_SystemFactoryResetView{nullptr}; // 恢复出厂设置\r
+ SystemAboutTheWatchView *p_SystemAboutTheWatchView{nullptr}; // 关于手表\r
+ SystemFactoryResetView *p_SystemFactoryResetView{nullptr}; // 恢复出厂设置\r
+ SystemRestart *p_SystemRestart{nullptr}; // 重启\r
+ SystemShutdown *p_SystemShutdown{nullptr}; // 关机\r
+ ShutDownImageAnimatorView *p_ShutDownImageAnimatorView{nullptr}; // 关机动画\r
\r
private:\r
UILabelButtonExt *SystemViewLabelButtonInit(ButtonConfig &buttonconfig);\r
{\r
p_SystemView->ChangeView(ABOUTTHEWATCHVIEW, SYSTEMVIEW);\r
}\r
+ else if (&view == p_SystemView->GetSystemScrollView(RESTARTVIEW))\r
+ {\r
+ p_SystemView->ChangeView(RESTARTVIEW, SYSTEMVIEW);\r
+ }\r
+ else if (&view == p_SystemView->GetSystemScrollView(SHUTDOWNVIEW))\r
+ {\r
+ p_SystemView->ChangeView(SHUTDOWNVIEW, SYSTEMVIEW);\r
+ }\r
else if (&view == p_SystemView->GetSystemScrollView(FACTORYRESETVIEW))\r
{\r
p_SystemView->ChangeView(FACTORYRESETVIEW, SYSTEMVIEW);\r
}\r
else if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0) // 点击进入系统升级视图\r
{\r
- //p_SystemView->ChangeView(SYSTEMVIEW, SYSTEMLUPGRADE);\r
NativeAbility::GetInstance().EnterSlice(VIEW_SYSTEM_UPDATE);\r
return true;\r
}\r
else if (strcmp(view.GetViewId(), WATCH_QR_CODE) == 0) // 点击进入手表二维码视图\r
{\r
- //p_SystemView->ChangeView(SYSTEMVIEW, WATCHQRCODE);\r
NativeAbility::GetInstance().EnterSlice(VIEW_WATCH_QR_CODE);\r
return true;\r
}\r
NativeAbility::GetInstance().EnterSlice(VIEW_LANGUAGE_SWITCH);\r
return true;\r
}\r
+ else if (strcmp(view.GetViewId(), RESTART) == 0) // 点击进入重启界面\r
+ {\r
+ p_SystemView->ChangeView(SYSTEMVIEW, RESTARTVIEW);\r
+ return true;\r
+ }\r
+ else if (strcmp(view.GetViewId(), SHUTDOWN) == 0) // 点击进入关机界面\r
+ {\r
+ p_SystemView->ChangeView(SYSTEMVIEW, SHUTDOWNVIEW);\r
+ return true;\r
+ }\r
else if (strcmp(view.GetViewId(), FACTORY_RESET) == 0) // 点击进入恢复出厂设置界面\r
{\r
p_SystemView->ChangeView(SYSTEMVIEW, FACTORYRESETVIEW);\r
return true;\r
}\r
+ else if (strcmp(view.GetViewId(), RESTARTVIEW_CHECKON) == 0) // 重启确认\r
+ {\r
+ p_SystemView->ChangeView(RESTARTVIEW, SHUTDOWNANIMATIONVIEW);\r
+ start_shutdown_or_reboot();\r
+ shutdown_reboot_prejobs();\r
+\r
+ ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(false);\r
+ isShutDownImageAnimatorStart = true;\r
+ return true;\r
+ }\r
+ else if (strcmp(view.GetViewId(), RESTARTVIEW_CHECKOFF) == 0) // 重启取消\r
+ {\r
+ p_SystemView->ChangeView(RESTARTVIEW, SYSTEMVIEW);\r
+ return true;\r
+ }\r
+ else if (strcmp(view.GetViewId(), SHUTDOWN_CHECKON) == 0) // 关机确认\r
+ {\r
+ p_SystemView->ChangeView(RESTARTVIEW, SHUTDOWNANIMATIONVIEW);\r
+ start_shutdown_or_reboot();\r
+ shutdown_reboot_prejobs();\r
+\r
+ ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(true);\r
+ isShutDownImageAnimatorStart = true;\r
+ return true;\r
+ }\r
+ else if (strcmp(view.GetViewId(), SHUTDOWN_CHECKOFF) == 0) // 关机取消\r
+ {\r
+ p_SystemView->ChangeView(SHUTDOWNVIEW, SYSTEMVIEW);\r
+ return true;\r
+ }\r
else if (strcmp(view.GetViewId(), FACTORYRESET_CHECKON) == 0) // 恢复出厂设置确认\r
{\r
do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);\r
return true;\r
}\r
\r
-\r
// if (strcmp(view.GetViewId(), SYSTEM_UPGRADE_t) == 0) //点击是否立即升级\r
// {\r
// SystemupgradeView::GetInstance()->statr_down_fwpkg();\r
// 如果是power键,且是亮屏状态,按键释放就返回上一级\r
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0)\r
{\r
- NativeAbility::GetInstance().Back();\r
+ if (!isShutDownImageAnimatorStart)\r
+ {\r
+ NativeAbility::GetInstance().Back();\r
+ }\r
}\r
return true;\r
}\r
// }\r
#ifdef __cplusplus\r
#if __cplusplus\r
-extern "C"\r
-{\r
+ extern "C"\r
+ {\r
#endif /* __cplusplus */\r
#endif /* __cplusplus */\r
\r
- void factorytest_enter_test_view(int cmd)\r
- {\r
- if(cmd == 1)\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_TEST);\r
- else\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);\r
- }\r
-\r
+ void factorytest_enter_test_view(int cmd)\r
+ {\r
+ if (cmd == 1)\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TEST);\r
+ else\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);\r
+ }\r
\r
#ifdef __cplusplus\r
#if __cplusplus\r
-}\r
+ }\r
#endif /* __cplusplus */\r
#endif /* __cplusplus */\r
}
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-28 17:30:10
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-28 19:25:08
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemRestart.cpp
+ */
+#include "system/include/SystemRestart.h"
+#include "BaseView.h"
+#include "system/include/SystemPresenter.h"
+#include "ui_resource_string.h"
+namespace OHOS
+{
+ SystemRestart::SystemRestart()
+ {
+ }
+
+ SystemRestart::~SystemRestart()
+ {
+ ClearAll();
+ }
+
+ void SystemRestart::ClearAll(void)
+ {
+ if (SystemRestartScrollView)
+ {
+ SystemRestartScrollView->RemoveAll();
+
+ if (title)
+ {
+ delete title;
+ title = nullptr;
+ }
+ if (note)
+ {
+ delete note;
+ note = nullptr;
+ }
+ if (image)
+ {
+ delete image;
+ image = nullptr;
+ }
+ if (button_ensure)
+ {
+ delete button_ensure;
+ button_ensure = nullptr;
+ }
+ if (button_cancel)
+ {
+ delete button_cancel;
+ button_cancel = nullptr;
+ }
+ delete SystemRestartScrollView;
+ SystemRestartScrollView = nullptr;
+ }
+ }
+ UIScrollView *SystemRestart::SystemRestartViewInit(void)
+ {
+ if (SystemRestartScrollView == nullptr)
+ {
+ SystemRestartScrollView = new UIScrollView();
+ if (SystemRestartScrollView == nullptr)
+ {
+ return nullptr;
+ }
+ SystemRestartScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ SystemRestartScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return nullptr;
+ }
+ SystemRestartScrollView->SetOnDragListener(draglistener);
+ SystemRestartScrollView->SetTouchable(true);
+ SystemRestartScrollView->SetDraggable(true);
+ /* -------------------------------------------------------------------------- */
+ if (title == nullptr)
+ {
+ title = new UILabelExt();
+ if (title == nullptr)
+ {
+ return nullptr;
+ }
+ title->SetPosition(83, 50, 300, 35); // 位置
+ title->SetStyle(STYLE_TEXT_FONT, 30); // 字体大小
+ title->SetStyle(STYLE_LINE_HEIGHT, 35); // 字体行高
+ title->SetTextId(STR_RESTART); // 内容
+ title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ title->SetRollSpeed(70);
+ title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ SystemRestartScrollView->Add(title);
+ }
+ /* -------------------------------------------------------------------------- */
+ if (image == nullptr)
+ {
+ image = new UIImageView();
+ if (image == nullptr)
+ {
+ return nullptr;
+ }
+ image->SetPosition(193, 120, 80, 80);
+ image->SetSrc("/user/res/settings/SETTTING_REBOOT.bin");
+ }
+ SystemRestartScrollView->Add(image);
+ /* -------------------------------------------------------------------------- */
+ if (note == nullptr)
+ {
+ note = new UILabelExt();
+ if (note == nullptr)
+ {
+ return nullptr;
+ }
+ note->SetPosition(53, 232, 360, 35); // 位置
+ note->SetStyle(STYLE_TEXT_FONT, 30); // 字体大小
+ note->SetStyle(STYLE_LINE_HEIGHT, 35); // 字体行高
+ note->SetTextId(STR_RESET_CONFIRM);
+ note->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ note->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ note->SetRollSpeed(70);
+ note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ SystemRestartScrollView->Add(note);
+ }
+ /* -------------------------------------------------------------------------- */
+ button_cancel = new UIButton();
+ if (button_cancel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemRestart::new button_cancel fail!");
+ return nullptr;
+ }
+ button_cancel->SetPosition(97, 299, 130, 130);
+ button_cancel->SetViewId(RESTARTVIEW_CHECKOFF);
+ button_cancel->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ button_cancel->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ button_cancel->SetImagePosition(15, 15);
+ button_cancel->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+ button_cancel->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ button_cancel->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE);
+ SystemRestartScrollView->Add(button_cancel);
+ /* ------------------------ button_ensure ----------------------- */
+ button_ensure = new UIButton();
+ if (button_ensure == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemRestart::new button_ensure fail!");
+ return nullptr;
+ }
+ button_ensure->SetPosition(240, 299, 130, 130);
+ button_ensure->SetViewId(RESTARTVIEW_CHECKON);
+ button_ensure->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ button_ensure->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ button_ensure->SetImagePosition(15, 15);
+ button_ensure->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+ button_ensure->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ button_ensure->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE);
+ SystemRestartScrollView->Add(button_ensure);
+ UIView::OnClickListener *ButtonOnClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());
+ if (ButtonOnClick == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemRestart::ButtonOnClick is nullptr!");
+ return nullptr;
+ }
+ button_cancel->SetOnClickListener(ButtonOnClick);
+ button_ensure->SetOnClickListener(ButtonOnClick);
+ }
+ return SystemRestartScrollView;
+ }
+}
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-28 17:30:10
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-28 18:49:19
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemShutdown.cpp
+ */
+#include "system/include/SystemShutdown.h"
+#include "BaseView.h"
+#include "system/include/SystemPresenter.h"
+#include "ui_resource_string.h"
+namespace OHOS
+{
+ SystemShutdown::SystemShutdown()
+ {
+ }
+
+ SystemShutdown::~SystemShutdown()
+ {
+ ClearAll();
+ }
+
+ void SystemShutdown::ClearAll(void)
+ {
+ if (SystemShutdownScrollView)
+ {
+ SystemShutdownScrollView->RemoveAll();
+
+ if (title)
+ {
+ delete title;
+ title = nullptr;
+ }
+ if (note)
+ {
+ delete note;
+ note = nullptr;
+ }
+ if (image)
+ {
+ delete image;
+ image = nullptr;
+ }
+ if (button_ensure)
+ {
+ delete button_ensure;
+ button_ensure = nullptr;
+ }
+ if (button_cancel)
+ {
+ delete button_cancel;
+ button_cancel = nullptr;
+ }
+ delete SystemShutdownScrollView;
+ SystemShutdownScrollView = nullptr;
+ }
+ }
+ UIScrollView *SystemShutdown::SystemShutdownViewInit(void)
+ {
+ if (SystemShutdownScrollView == nullptr)
+ {
+ SystemShutdownScrollView = new UIScrollView();
+ if (SystemShutdownScrollView == nullptr)
+ {
+ return nullptr;
+ }
+ SystemShutdownScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ SystemShutdownScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return nullptr;
+ }
+ SystemShutdownScrollView->SetOnDragListener(draglistener);
+ SystemShutdownScrollView->SetTouchable(true);
+ SystemShutdownScrollView->SetDraggable(true);
+ /* -------------------------------------------------------------------------- */
+ if (title == nullptr)
+ {
+ title = new UILabelExt();
+ if (title == nullptr)
+ {
+ return nullptr;
+ }
+ title->SetPosition(83, 50, 300, 35); // 位置
+ title->SetStyle(STYLE_TEXT_FONT, 30); // 字体大小
+ title->SetStyle(STYLE_LINE_HEIGHT, 35); // 字体行高
+ title->SetTextId(STR_SHUTDOWN); // 内容
+ title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ title->SetRollSpeed(70);
+ title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ SystemShutdownScrollView->Add(title);
+ }
+ /* -------------------------------------------------------------------------- */
+ if (image == nullptr)
+ {
+ image = new UIImageView();
+ if (image == nullptr)
+ {
+ return nullptr;
+ }
+ image->SetPosition(196, 120, 74, 80);
+ image->SetSrc("/user/res/settings/SETTTING_SHUTDOWN.bin");
+ }
+ SystemShutdownScrollView->Add(image);
+ /* -------------------------------------------------------------------------- */
+ if (note == nullptr)
+ {
+ note = new UILabelExt();
+ if (note == nullptr)
+ {
+ return nullptr;
+ }
+ note->SetPosition(53, 232, 360, 35); // 位置
+ note->SetStyle(STYLE_TEXT_FONT, 30); // 字体大小
+ note->SetStyle(STYLE_LINE_HEIGHT, 35); // 字体行高
+ note->SetTextId(STR_SHUTDOWN_CONFIRM);
+ note->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ note->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ note->SetRollSpeed(70);
+ note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ SystemShutdownScrollView->Add(note);
+ }
+ /* -------------------------------------------------------------------------- */
+ button_cancel = new UIButton();
+ if (button_cancel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemShutdown::new button_cancel fail!");
+ return nullptr;
+ }
+ button_cancel->SetPosition(97, 299, 130, 130);
+ button_cancel->SetViewId(SHUTDOWN_CHECKOFF);
+ button_cancel->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ button_cancel->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ button_cancel->SetImagePosition(15, 15);
+ button_cancel->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+ button_cancel->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ button_cancel->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE);
+ SystemShutdownScrollView->Add(button_cancel);
+ /* ------------------------ button_ensure ----------------------- */
+ button_ensure = new UIButton();
+ if (button_ensure == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemShutdown::new button_ensure fail!");
+ return nullptr;
+ }
+ button_ensure->SetPosition(240, 299, 130, 130);
+ button_ensure->SetViewId(SHUTDOWN_CHECKON);
+ button_ensure->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ button_ensure->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ button_ensure->SetImagePosition(15, 15);
+ button_ensure->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+ button_ensure->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ button_ensure->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE);
+ SystemShutdownScrollView->Add(button_ensure);
+ UIView::OnClickListener *ButtonOnClick = static_cast<UIView::OnClickListener *>(SystemPresenter::GetInstance());
+ if (ButtonOnClick == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemShutdown::ButtonOnClick is nullptr!");
+ return nullptr;
+ }
+ button_cancel->SetOnClickListener(ButtonOnClick);
+ button_ensure->SetOnClickListener(ButtonOnClick);
+ }
+ return SystemShutdownScrollView;
+ }
+}
delete p_SystemAboutTheWatchView;\r
p_SystemAboutTheWatchView = nullptr;\r
}\r
+ if (p_SystemRestart != nullptr)\r
+ {\r
+ delete p_SystemRestart;\r
+ p_SystemRestart = nullptr;\r
+ }\r
+ if (p_SystemShutdown != nullptr)\r
+ {\r
+ delete p_SystemShutdown;\r
+ p_SystemShutdown = nullptr;\r
+ }\r
if (p_SystemFactoryResetView != nullptr)\r
{\r
delete p_SystemFactoryResetView;\r
p_SystemFactoryResetView = nullptr;\r
}\r
+ if (p_ShutDownImageAnimatorView != nullptr)\r
+ {\r
+ delete p_ShutDownImageAnimatorView;\r
+ p_ShutDownImageAnimatorView = nullptr;\r
+ }\r
+ for (int i = SYSTEMVIEW; i < MAX_SYSTEMVIEWID; i++)\r
+ {\r
+ SystemScrollView[i] = nullptr;\r
+ }\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ClearAll end!!");\r
}\r
\r
{273, STR_SYSTEM_UPDATE},\r
{393, STR_WATCH_QR_CODE},\r
{513, STR_SYSTEM_LANGUAGE},\r
- {633, STR_FACTORY_RESET},\r
+ {633, STR_RESTART},\r
+ {753, STR_SHUTDOWN},\r
+ {873, STR_FACTORY_RESET},\r
};\r
labelConfig = {\r
.left = 90,\r
{240, SYSTEM_UPGRADE},\r
{360, WATCH_QR_CODE},\r
{480, SYSTEM_LANGUAGE},\r
- {600, FACTORY_RESET},\r
+ {600, RESTART},\r
+ {720, SHUTDOWN},\r
+ {840, FACTORY_RESET},\r
};\r
\r
for (int i = 0; i < sizeof(buttonSetups) / sizeof(buttonSetups[0]); ++i)\r
return true;\r
}\r
\r
+ // 重启\r
+ bool SystemView::ChangeToSystemRestartView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeToSystemFactoryResetView");\r
+ p_SystemRestart = new SystemRestart();\r
+ if (p_SystemRestart == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = p_SystemRestart->SystemRestartViewInit();\r
+ container_->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ // 关机\r
+ bool SystemView::ChangeToSystemShutdownView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeToSystemFactoryResetView");\r
+ p_SystemShutdown = new SystemShutdown();\r
+ if (p_SystemShutdown == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = p_SystemShutdown->SystemShutdownViewInit();\r
+ container_->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ // 关机动画\r
+ bool SystemView::ChangeToSystemShutdownAnimatorView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeToSystemFactoryResetView");\r
+ p_ShutDownImageAnimatorView = new ShutDownImageAnimatorView();\r
+ if (p_ShutDownImageAnimatorView == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = static_cast<UIScrollView *>(p_ShutDownImageAnimatorView->ShutDownAnimatorViewInit());\r
+ container_->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
struct SystemViewMapper\r
{\r
const int16_t viewId;\r
{SYSTEMVIEW, &SystemView::ChangeToSystemView},\r
{ABOUTTHEWATCHVIEW, &SystemView::ChangeToSystemAboutView},\r
{FACTORYRESETVIEW, &SystemView::ChangeToSystemFactoryResetView},\r
+ {RESTARTVIEW, &SystemView::ChangeToSystemRestartView},\r
+ {SHUTDOWNVIEW, &SystemView::ChangeToSystemShutdownView},\r
+ {SHUTDOWNANIMATIONVIEW, &SystemView::ChangeToSystemShutdownAnimatorView},\r
};\r
\r
// 根据传入的interface参数执行相应视图ID关联的成员函数。\r
version https://git-lfs.github.com/spec/v1
-oid sha256:94e2a8c1bad2a01632f8feebcbdc71bd4de2947fa9b606f9adcea469ab118a28
+oid sha256:f2805f512f3b8f80012837f62d13befd45b5dfaa65ed63fc58eadb22c9741c56
size 4504
version https://git-lfs.github.com/spec/v1
-oid sha256:66dad3548d7036af3d8b9c4a28b8effec69a257ec6ef64edb1e08b0f6509cf48
-size 4504
+oid sha256:031c0997afd524904c5a86c376953677f120e8155550b4eaa6bce3c99dbdab31
+size 4184