${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/Systemupgrade.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemFactoryResetView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/systemupdate/src/SystemUpdateModel.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/systemupdate/src/SystemUpdateView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/systemupdate/src/SystemUpdatePresenter.cpp
+
#声音与震动
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
VIEW_BRIGHTNESSLEVEL, // 亮度调节
VIEW_NETWORKANDCALL, // 网络与通话
VIEW_MOTION_RECOGNITION, // 运动识别
+ VIEW_SYSTEM_UPDATE, // 系统更新
/* ----------------------------------- 录音 ----------------------------------- */
VIEW_RECORD,
/* ---------------------------------- 界面 ---------------------------------- */
void InitBrightnessLevelSlice(void);
void InitNetworkAndCallSlice(void);
void InitMotionRecognitionSlice(void);
+ void InitSystemUpdateSlice(void);
/* --------------------------------界面------------------------------------ */
void InitRotateSlice(void);
void InitBloodSlice(void);
#include "motionrecognition/include/MotionRecognitionPresenter.h"
#include "motionrecognition/include/MotionRecognitionView.h"
+
+#include "systemupdate/include/SystemUpdatePresenter.h"
+#include "systemupdate/include/SystemUpdateView.h"
/* -------------------------------------------------------------------------- */
#include "traing/include/TraingView.h"
#include "traing/include/TraingPresenter.h"
{VIEW_DISPLAY_BRIGHTNESS, &NativeLauncher::InitDisplayBrightnessSlice}, // 显示与亮度的实例化地址
{VIEW_NETWORKANDCALL, &NativeLauncher::InitNetworkAndCallSlice}, // 网络与通话
{VIEW_MOTION_RECOGNITION, &NativeLauncher::InitMotionRecognitionSlice}, // 网络与通话
+ {VIEW_SYSTEM_UPDATE, &NativeLauncher::InitSystemUpdateSlice}, // 系统更新界面
// {VIEW_SECONDARY_FUNCTION, &NativeLauncher::InitSecondaryFunction},
// {VIEW_FAST_TRAINING, &NativeLauncher::InitFastTrainingSlice},
}
NativeAbility::GetInstance().AddSliceProxy(VIEW_MOTION_RECOGNITION, motionrecognition);
}
+
+ /*系统更新*/
+ void NativeLauncher::InitSystemUpdateSlice(void)
+ {
+ SliceProxy *systemupdate = new AbilitySliceProxy<SystemUpdateView, SystemUpdatePresenter>;
+ if (systemupdate == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "systemupdate");
+ return;
+ }
+ NativeAbility::GetInstance().AddSliceProxy(VIEW_SYSTEM_UPDATE, systemupdate);
+ }
/* -------------------------------------------------------------------------- */
void NativeLauncher::InitSetDesktopSlice(void)
{
}\r
else if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0) // 点击进入系统升级视图\r
{\r
- p_SystemView->ChangeView(SYSTEMVIEW, SYSTEMLUPGRADE);\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
\r
\r
- if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0) //点击是否立即升级\r
+ if (strcmp(view.GetViewId(), "UpdateNowButton") == 0) //点击是否立即升级\r
{\r
SystemupgradeView::GetInstance()->statr_down_fwpkg();\r
}\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemUpgradeButtonExt new fail!");
}
SystemUpgradeButton_->SetPosition(163, 400, 180, 80);
- SystemUpgradeButton_->SetViewId(SYSTEM_UPGRADE);
+ SystemUpgradeButton_->SetViewId("UpdateNowButton");
SystemUpgradeButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
SystemUpgradeButton_->SetText("确认升级");
SystemUpgradeButton_->SetAlign(TEXT_ALIGNMENT_LEFT);
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-05-07 11:26:14
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-05-07 16:31:17
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateModel.h
+ */
+
+#ifndef SYSTEM_UPDATE_MODEL_H
+#define SYSTEM_UPDATE_MODEL_H
+
+namespace OHOS
+{
+ class SystemUpdateModel
+ {
+ public:
+ static SystemUpdateModel &GetInstance(void);
+ bool IsLatestVersion(void);
+
+ private:
+ SystemUpdateModel();
+ SystemUpdateModel(const SystemUpdateModel &) = delete;
+ SystemUpdateModel &operator=(const SystemUpdateModel &) = delete;
+ virtual ~SystemUpdateModel();
+ };
+}
+
+#endif
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-05-07 11:25:49
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-05-07 14:22:10
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdatePresenter.h
+ */
+
+#ifndef SYSTEM_UPDATE_PRESENTER_H
+#define SYSTEM_UPDATE_PRESENTER_H
+
+#include "Presenter.h"
+#include "View.h"
+
+namespace OHOS
+{
+ class SystemUpdateView;
+ class SystemUpdatePresenter : public Presenter<SystemUpdateView>,
+ public UIView::OnClickListener,
+ public RootView::OnKeyActListener,
+ public UIView::OnDragListener
+ {
+ public:
+ SystemUpdatePresenter();
+ virtual ~SystemUpdatePresenter();
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+
+ static SystemUpdatePresenter *GetInstance();
+
+ private:
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnDragEnd(UIView &view, const DragEvent &event) override;
+ bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+
+ bool X_DRAG_FLAG{false};
+ };
+}
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-05-07 11:25:27
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-05-07 16:13:06
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateView.h
+ */
+
+#ifndef SYSTEM_UPDATE_VIEW_H
+#define SYSTEM_UPDATE_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+
+namespace OHOS
+{
+ class SystemUpdatePresenter;
+ class SystemUpdateView : public View<SystemUpdatePresenter>
+ {
+
+ public:
+ SystemUpdateView();
+ virtual ~SystemUpdateView();
+ static SystemUpdateView *GetInstance(void);
+
+ struct LabelConfig
+ {
+ int16_t left;
+ int16_t top;
+ int16_t width;
+ int16_t height;
+ int16_t fontSize; // 字体大小
+ int16_t lineHeigh; // 行高
+ uint16_t textId;
+ uint8_t lineBreakMode; // 断行模式。
+ };
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStop() override;
+
+ UIButton *GetUpdateNowButtton(void);
+ UIButton *GetTryAgainLaterButton(void);
+
+ private:
+ bool SetSystemUpdateScrollView(void);
+ UILabelExt *InitLabel_Ext(LabelConfig &labelConfig);
+ void SystemUpdateViewInit(void);
+ void ClearAll(void);
+
+ UIScrollView *SystemUpdateScrollView{nullptr};
+ UILabelExt *Title{nullptr}; // 标题
+ UIImageView *KUMILOGOImage{nullptr}; // KUMILogo图片
+ UILabelExt *LatestVersionLabel{nullptr}; // 最新版本
+ UILabelExt *VersionIdLabel{nullptr}; // 版本编号
+ UILabelExt *UpdateNowLabel{nullptr}; // 立即升级标签
+ UILabelExt *TryAgainLaterLabel{nullptr}; // 稍后再试标签
+ UIButton *UpdateNowButtton{nullptr}; // 立即升级按钮
+ UIButton *TryAgainLaterButton{nullptr}; // 稍后再试按钮
+ };
+}
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-05-07 11:26:25
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-05-07 16:32:26
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateModel.cpp
+ */
+#include "systemupdate/include/SystemUpdateModel.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+ SystemUpdateModel::SystemUpdateModel()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemUpdateModel::SystemUpdateModel");
+ }
+
+ SystemUpdateModel::~SystemUpdateModel()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemUpdateModel::~SystemUpdateModel");
+ }
+
+ SystemUpdateModel &SystemUpdateModel::GetInstance()
+ {
+ static SystemUpdateModel instance;
+ return instance;
+ }
+
+ //获取是否是最新版本
+ bool SystemUpdateModel::IsLatestVersion(void)
+ {
+ return false;
+ }
+
+}
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-05-07 11:26:06
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-05-07 17:14:36
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdatePresenter.cpp
+ */
+
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+#include "systemupdate/include/SystemUpdatePresenter.h"
+#include "systemupdate/include/SystemUpdateView.h"
+#include "common/key_code.h"
+#include <custom_utils.h>
+#include "UiConfig.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+
+ // 当前Presenter属性实例化的内存指针
+ static SystemUpdatePresenter *g_pSystemUpdatePresenter = nullptr;
+
+ SystemUpdatePresenter::SystemUpdatePresenter()
+ {
+ g_pSystemUpdatePresenter = this;
+ }
+
+ SystemUpdatePresenter::~SystemUpdatePresenter()
+ {
+ g_pSystemUpdatePresenter = nullptr;
+ }
+
+ SystemUpdatePresenter *SystemUpdatePresenter::GetInstance()
+ {
+ return g_pSystemUpdatePresenter;
+ }
+
+ void SystemUpdatePresenter::OnStart()
+ {
+ Presenter<SystemUpdateView>::OnStart();
+ }
+
+ void SystemUpdatePresenter::OnPause(void)
+ {
+ Presenter<SystemUpdateView>::OnPause();
+ }
+
+ void SystemUpdatePresenter::OnResume(void)
+ {
+ Presenter<SystemUpdateView>::OnResume();
+ }
+
+ void SystemUpdatePresenter::OnStop(void)
+ {
+ Presenter<SystemUpdateView>::OnStop();
+ }
+
+ bool SystemUpdatePresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemUpdatePresenter::OnClick");
+ SystemUpdateView *systemUpdateView = SystemUpdateView::GetInstance();
+ if (systemUpdateView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::GetInstance fail!");
+ return false;
+ }
+
+ if (&view == systemUpdateView->GetUpdateNowButtton()) // 如果点击的是立即更新按钮
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetUpdateNowButtton");
+ }
+ else if (&view == systemUpdateView->GetTryAgainLaterButton()) // 如果点击的是稍后再说按钮
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetTryAgainLaterButton");
+ NativeAbility::GetInstance().Back();
+ }
+
+ return true;
+ }
+
+ bool SystemUpdatePresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+ UNUSED(view);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemUpdatePresenter::OnDrag");
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+ {
+ SystemUpdatePresenter::X_DRAG_FLAG = true;
+ }
+ return true;
+ }
+
+ bool SystemUpdatePresenter::OnDragEnd(UIView &view, const DragEvent &event)
+ {
+ UNUSED(view);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemUpdatePresenter::OnDragEnd");
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && SystemUpdatePresenter::X_DRAG_FLAG)
+ {
+ NativeAbility::GetInstance().Back();
+ }
+ return true;
+ }
+
+ bool SystemUpdatePresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件
+ {
+ UNUSED(view);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemUpdatePresenter::OnKeyAct");
+ unsigned short keyID = event.GetKeyId();
+ unsigned short keyState = event.GetState();
+ // 如果是power键,且是亮屏状态,按键释放就返回上一级
+ if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
+ {
+ NativeAbility::GetInstance().Back();
+ }
+ return true;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-05-07 11:25:58
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-05-07 17:15:10
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdateView.cpp
+ */
+
+#include "systemupdate/include/SystemUpdatePresenter.h"
+#include "systemupdate/include/SystemUpdateView.h"
+#include "wearable_log.h"
+#include "language/font/ui_resource_string.h"
+#include "config/include/ConfigModel.h"
+#include "systemupdate/include/SystemUpdateModel.h"
+
+namespace OHOS
+{
+
+ static SystemUpdateView *g_pSystemUpdateView{nullptr};
+
+ SystemUpdateView::SystemUpdateView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::SystemUpdateView");
+ g_pSystemUpdateView = this;
+ }
+
+ SystemUpdateView::~SystemUpdateView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::~SystemUpdateView");
+ ClearAll();
+ g_pSystemUpdateView = nullptr;
+ }
+
+ SystemUpdateView *SystemUpdateView::GetInstance()
+ {
+ return g_pSystemUpdateView;
+ }
+
+ void SystemUpdateView::ClearAll(void)
+ {
+ if (SystemUpdateScrollView != nullptr)
+ {
+ SystemUpdateScrollView->RemoveAll();
+
+ delete Title;
+ Title = nullptr;
+
+ delete KUMILOGOImage;
+ KUMILOGOImage = nullptr;
+
+ delete LatestVersionLabel;
+ LatestVersionLabel = nullptr;
+
+ delete VersionIdLabel;
+ VersionIdLabel = nullptr;
+
+ delete UpdateNowLabel;
+ UpdateNowLabel = nullptr;
+
+ delete TryAgainLaterLabel;
+ TryAgainLaterLabel = nullptr;
+
+ delete UpdateNowButtton;
+ UpdateNowButtton = nullptr;
+
+ delete TryAgainLaterButton;
+ TryAgainLaterButton = nullptr;
+
+ delete SystemUpdateScrollView;
+ SystemUpdateScrollView = nullptr;
+ }
+ }
+
+ UILabelExt *SystemUpdateView::InitLabel_Ext(LabelConfig &labelConfig)
+ {
+ UILabelExt *label = new UILabelExt();
+ if (label == nullptr)
+ {
+ return nullptr;
+ }
+ label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小
+ label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize); // 字体大小
+ label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh); // 字体行高
+ label->SetTextId(labelConfig.textId);
+ label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP);
+ label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelConfig.fontSize);
+ return label;
+ }
+
+ bool SystemUpdateView::SetSystemUpdateScrollView(void)
+ {
+ SystemUpdateScrollView = new UIScrollView();
+ if (SystemUpdateScrollView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemUpdateScrollView new fail!");
+ return false;
+ }
+ SystemUpdateScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ SystemUpdateScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ SystemUpdateScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294);
+ SystemUpdateScrollView->SetScrollBlankSize(35);
+ SystemUpdateScrollView->SetReboundSize(50);
+ SystemUpdateScrollView->SetDirection(1);
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemUpdatePresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::draglistener can not be nullptr!");
+ return false;
+ }
+ SystemUpdateScrollView->SetOnDragListener(draglistener);
+ SystemUpdateScrollView->SetTouchable(true);
+ SystemUpdateScrollView->SetDraggable(true);
+
+ return true;
+ }
+
+ void SystemUpdateView::SystemUpdateViewInit(void)
+ {
+ if (!SetSystemUpdateScrollView())
+ {
+ return;
+ }
+ /* ---------------------------------- Title --------------------------------- */
+ LabelConfig Config = {
+ .left = 83,
+ .top = 52,
+ .width = 300,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ //.text = "系统",
+ .textId = STR_SYSTEM,
+ .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+ };
+ Title = InitLabel_Ext(Config);
+ if (Title == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::Title new fail!");
+ return;
+ }
+ /* ------------------------------ KUMILOGOImage ----------------------------- */
+ KUMILOGOImage = new UIImageView();
+ if (KUMILOGOImage == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!");
+ return;
+ }
+ KUMILOGOImage->SetPosition(117, 87, 230, 160);
+ const char *imagesPath = "/user/res/system/KUMILOGO.bin";
+ KUMILOGOImage->SetSrc(imagesPath);
+ /* --------------------------- LatestVersionLabel --------------------------- */
+ Config = {
+ .left = 33,
+ .top = 227,
+ .width = 400,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ //.text = "最新版本",
+ .textId = STR_LATEST_VERSION,
+ .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+ };
+ LatestVersionLabel = InitLabel_Ext(Config);
+ if (LatestVersionLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::LatestVersionLabel new fail!");
+ return;
+ }
+ /* ----------------------------- VersionIdLabel ----------------------------- */
+ VersionIdLabel = new UILabelExt();
+ if (VersionIdLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::VersionIdLabel new fail!");
+ return;
+ }
+ VersionIdLabel->SetPosition(33, 262, 400, 35);
+ VersionIdLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ VersionIdLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ VersionIdLabel->SetText("OTA V4.0.0");
+ VersionIdLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ VersionIdLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ VersionIdLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ /* ----------------------------- UpdateNowLabel ----------------------------- */
+ Config = {
+ .left = 113,
+ .top = 350,
+ .width = 240,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .textId = STR_LATEST_VERSION,
+ .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+ };
+ UpdateNowLabel = InitLabel_Ext(Config);
+ if (UpdateNowLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::UpdateNowLabel new fail!");
+ return;
+ }
+ /* -------------------------------------------------------------------------- */
+ Config = {
+ .left = 113,
+ .top = 477,
+ .width = 240,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .textId = STR_LATER,
+ .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+ };
+ TryAgainLaterLabel = InitLabel_Ext(Config);
+ if (TryAgainLaterLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::TryAgainLaterLabel new fail!");
+ return;
+ }
+ /* ---------------------------- UpdateNowButtton ---------------------------- */
+ UpdateNowButtton = new UIButton();
+ if (UpdateNowButtton == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::UpdateNowButtton new fail!");
+ return;
+ }
+ UpdateNowButtton->SetPosition(63, 317, 340, 100);
+ UpdateNowButtton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c);
+ UpdateNowButtton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+ /* --------------------------- TryAgainLaterButton -------------------------- */
+ TryAgainLaterButton = new UIButton();
+ if (TryAgainLaterButton == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::TryAgainLaterButton new fail!");
+ return;
+ }
+ TryAgainLaterButton->SetPosition(63, 427, 340, 100);
+ TryAgainLaterButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ TryAgainLaterButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+ /* ----------------------------- OnClickListener ---------------------------- */
+ UIView::OnClickListener *listener = static_cast<UIView::OnClickListener *>(SystemUpdatePresenter::GetInstance());
+ if (listener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::listener can not be nullptr!");
+ return;
+ }
+ UpdateNowButtton->SetOnClickListener(listener);
+ TryAgainLaterButton->SetOnClickListener(listener);
+
+ /* ----------------------------------- Add ---------------------------------- */
+ SystemUpdateScrollView->Add(Title);
+ SystemUpdateScrollView->Add(KUMILOGOImage);
+ SystemUpdateScrollView->Add(LatestVersionLabel);
+ SystemUpdateScrollView->Add(VersionIdLabel);
+ SystemUpdateScrollView->Add(UpdateNowLabel);
+ SystemUpdateScrollView->Add(TryAgainLaterLabel);
+ SystemUpdateScrollView->Add(UpdateNowButtton);
+ SystemUpdateScrollView->Add(TryAgainLaterButton);
+ RootView::GetInstance()->Add(SystemUpdateScrollView);
+ }
+
+ void SystemUpdateView::OnStart()
+ {
+ View<SystemUpdatePresenter>::OnStart();
+
+ if (SystemUpdateModel::GetInstance().IsLatestVersion() == true) //如果是最新版本显示不需要更新界面
+ {
+
+ }
+ else
+ {
+ // 如果需要系统更新
+ SystemUpdateViewInit();
+ }
+
+ // 增加按键监听
+ RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SystemUpdatePresenter::GetInstance();
+ RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ }
+
+ void SystemUpdateView::OnSetUpView()
+ {
+
+ View<SystemUpdatePresenter>::OnSetUpView();
+ Draw();
+ }
+
+ void SystemUpdateView::OnTearDownView()
+ {
+
+ View<SystemUpdatePresenter>::OnTearDownView();
+ return;
+ }
+
+ void SystemUpdateView::OnStop()
+ {
+
+ View<SystemUpdatePresenter>::OnStop();
+ RootView::GetInstance()->RemoveAll();
+ RootView::GetInstance()->ClearOnKeyActListener();
+ return;
+ }
+
+ UIButton *SystemUpdateView::GetUpdateNowButtton(void)
+ {
+ if (UpdateNowButtton != nullptr)
+ {
+ return UpdateNowButtton;
+ }
+ return nullptr;
+ }
+
+ UIButton *SystemUpdateView::GetTryAgainLaterButton(void)
+ {
+ if (TryAgainLaterButton != nullptr)
+ {
+ return TryAgainLaterButton;
+ }
+ return nullptr;
+ }
+}
\ No newline at end of file