From: luozheng <1732036298@qq.com> Date: Tue, 5 Mar 2024 11:32:26 +0000 (+0800) Subject: 系统视图添加系统升级功能 X-Git-Tag: release_V1.2.70_20241020_135402~1274^2~28 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=4bf7ae848975434766b57972016544504cd66055;p=mirrors%2FFD230.git 系统视图添加系统升级功能 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h index f02778015..971196756 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h @@ -9,16 +9,18 @@ #include "components/ui_label.h" #include "components/ui_image_view.h" #include "components/ui_button.h" +#include "components/ui_label_button_ext.h" #include "system/include/SystemAboutTheWatchView.h" #include "system/include/SystemSuperviseView.h" #include "system/include/SystemLanguageView.h" #include "system/include/SystemFactoryResetView.h" namespace OHOS { - static const char *ABOUT_THE_WATCH = "AboutTheWatchButton"; // 关于手表 - static const char *SUPERVISE = "SuperviseButton"; // 监管 - static const char *SYSTEM_LANGUAGE = "SystemLanguageButton"; // 系统语言 - static const char *FACTORY_RESET = "FactoryResetButton"; // 恢复出厂设置 + static const char *ABOUT_THE_WATCH = "AboutTheWatchButton"; // 关于手表 + static const char *SUPERVISE = "SuperviseButton"; // 监管 + static const char *SYSTEM_LANGUAGE = "SystemLanguageButton"; // 系统语言 + static const char *FACTORY_RESET = "FactoryResetButton"; // 恢复出厂设置 + static const char *SYSTEM_UPGRADE = "SystemUpgradeButtonExt"; // 系统升级 static const char *ABOUT_THE_WATCH_IMAGESRC = "/user/res/system/SYSTEM_ABOUT_THE_WATCH.bin"; static const char *SUPERVISE_IMAGESRC = "/user/res/system/SYSTEM_SUPERVISE.bin"; static const char *SYSTEM_LANGUAGE_IMAGESRC = "/user/res/system/SYSTEM_SYSTEM_LANGUAGE.bin"; @@ -53,12 +55,13 @@ namespace OHOS bool ClickFunc(int16_t interface); void ChangeView(int16_t hideView, int16_t showView); UIScrollView *GetSystemScrollView(int ViewId); + private: void InitIView(void); void ClearAll(void); bool SetTheSystemScrollView(void); bool SetTheTitle(void); - UIButton * SetTheButton(ButtonConfig &buttonconfig, UIView::OnClickListener *clickListener); + UIButton *SetTheButton(ButtonConfig &buttonconfig, UIView::OnClickListener *clickListener); SystemAboutTheWatchView *p_SystemAboutTheWatchView{nullptr}; SystemSuperviseView *p_SystemSuperviseView{nullptr}; SystemLanguageView *p_SystemLanguageView{nullptr}; @@ -69,6 +72,7 @@ namespace OHOS UIButton *SuperviseButton = {nullptr}; UIButton *SystemLanguageButton = {nullptr}; UIButton *FactoryResetButton{nullptr}; + UILabelButtonExt *SystemUpgradeButtonExt{nullptr}; bool initViewStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp index 00a01731a..f5fd4bf9a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp @@ -6,6 +6,7 @@ #include "font/font_global_manager.h" #include "font/ui_font.h" #include "language/LanguageInit.h" +#include "../../../../../../drivers/peripheral/utils/custom_utils.h" namespace OHOS { @@ -115,6 +116,11 @@ namespace OHOS p_SystemView->ChangeView(FACTORYRESETVIEW, SYSTEMVIEW); return true; } + else if(strcmp(view.GetViewId(), SYSTEM_UPGRADE)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uaip_cmd_update_request"); + uaip_cmd_update_request(); + } return false; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp index 57ed3a5ae..8aae17802 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp @@ -187,6 +187,24 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FactoryResetButton fail!"); return; } + /* -------------------------------------------------------------------------- */ + SystemUpgradeButtonExt = new UILabelButtonExt(); + if (SystemUpgradeButtonExt == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemUpgradeButtonExt new fail!"); + } + SystemUpgradeButtonExt->SetPosition(43, 600, 380, 100); + SystemUpgradeButtonExt->SetViewId(SYSTEM_UPGRADE); + SystemUpgradeButtonExt->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); + SystemUpgradeButtonExt->SetImagePosition(326, 37); + SystemUpgradeButtonExt->SetImageSrc("/user/res/SETTING_NEXT.bin", nullptr); + SystemUpgradeButtonExt->SetText("系统升级"); + SystemUpgradeButtonExt->SetAlign(TEXT_ALIGNMENT_LEFT); + SystemUpgradeButtonExt->SetLabelPosition(45, 0); + SystemUpgradeButtonExt->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + SystemUpgradeButtonExt->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + SystemUpgradeButtonExt->SetOnClickListener(clickListener); + initViewStatus = true; } @@ -354,6 +372,7 @@ namespace OHOS SystemScrollView[SYSTEMVIEW]->Add(SuperviseButton); SystemScrollView[SYSTEMVIEW]->Add(SystemLanguageButton); SystemScrollView[SYSTEMVIEW]->Add(FactoryResetButton); + SystemScrollView[SYSTEMVIEW]->Add(SystemUpgradeButtonExt); RootView::GetInstance()->Add(SystemScrollView[SYSTEMVIEW]); Draw(); }