From: hcj <1224667075@qq.com> Date: Tue, 27 Aug 2024 09:36:34 +0000 (+0800) Subject: 关机从重启替换成SOS X-Git-Tag: release_V1.2.70_20241020_135402~578^2~4 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=b9899ad2713af79d7b8063da84c6432969926089;p=mirrors%2FFD230.git 关机从重启替换成SOS --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index bc1392af2..c6e3a741a 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -357,7 +357,9 @@ namespace OHOS static constexpr const char *PNG_SETTINGS_SYSTEM = APP_RES_PATH "/settings/SETTINGS_SYSTEM.bin"; // 系统 static constexpr const char *PNG_SETTINGS_SHUTDOWN_AND_RESTART = APP_RES_PATH "/settings/SETTINGS_SHUTDOWN_AND_RESTART.bin"; // 关机和重启 static constexpr const char *PNG_SETTINGS_SETTTING_SHUTDOWN = APP_RES_PATH "/settings/SETTTING_SHUTDOWN.bin"; // 关机 - static constexpr const char *PNG_SETTINGS_SETTTING_REBOOT = APP_RES_PATH "/settings/SETTTING_REBOOT.bin"; // 重启 + static constexpr const char *PNG_SETTINGS_SETTTING_REBOOT = APP_RES_PATH "/settings/SETTTING_REBOOT.bin"; + static constexpr const char *PNG_SETTINGS_SETTTING_SOS = APP_RES_PATH "/settings/SOS.bin"; // 重启 + static constexpr const char *PNG_SETTINGS_SETTTING_SHUTDOWN_1 = APP_RES_PATH "/settings/shutdown.bin"; /* ---------------------------------- 消息中心 ---------------------------------- */ static constexpr const char *PNG_Message_System = APP_RES_PATH "/message/system-icon.bin"; // 系统消息 static constexpr const char *PNG_Message_Note = APP_RES_PATH "/message/message-icon.bin"; // 短信 diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h index bdb6d2da5..e82567225 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h @@ -550,7 +550,13 @@ enum UIResourceTextId : uint16_t { STR_HANG_UP_OR_ANSWER = 537, STR_WATCH_CALL = 538, STR_PHONE_CALL = 539, - STR_MAX_ID = 540, + STR_STEPS_OF_THE_DAY = 540, + STR_MILEAGE = 541, + STR_FAT_BURNING_TIME = 542, + STR_NUMBER_OF_STANDS = 543, + STR_CONSUME_CALORIES = 544, + STR_GOAL_HINT = 545, + STR_MAX_ID = 546, }; // UIResourceTextId enum FontLanguageId : uint8_t { diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 73563069c..7dab81190 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -309,7 +309,7 @@ namespace OHOS {VIEW_COMPASS, &NativeLauncher::InitCompassSlice}, {VIEW_CONNECT_PHONE, &NativeLauncher::InitConnectPhoneSlice}, {VIEW_INDOORWALK, &NativeLauncher::InitIndoorWalkSlice}, - // {VIEW_SHUTDOWN_OR_REBOOT, &NativeLauncher::InitRebootSlice}, + {VIEW_SHUTDOWN_OR_REBOOT, &NativeLauncher::InitRebootSlice}, {VIEW_WEATHER, &NativeLauncher::InitWeatherSlice}, // 天气 {VIEW_GOAL, &NativeLauncher::InitGoalSlice}, // 每日目标 {VIEW_SYSTEM, &NativeLauncher::InitSystemSlice}, // 系统实例化地址 diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp index 29dbd0a01..be32c2f90 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp @@ -283,8 +283,8 @@ bool CallingView::InitUILabelDisplay() if (currentTimes == nullptr) { return false; } - currentTimes->SetPosition(184, 38, - 89, 35); + currentTimes->SetPosition(133, 38, + 200, 35); currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); currentTimes->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h index 91f8a8097..7663dcf56 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h @@ -32,6 +32,7 @@ namespace OHOS static FactoryResetView *GetInstance(void); UIViewGroup *FactoryResetViewInit(void); + UIViewGroup *FactoryResetViewInit(UIView::OnClickListener *FactoryResetButtonCheckOnClick,UIView::OnDragListener *dragListener); void ClearAll(void); private: diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp index 06a74c4bf..8fbdb4d74 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp @@ -206,4 +206,130 @@ namespace OHOS } return group; } + + UIViewGroup *FactoryResetView::FactoryResetViewInit(UIView::OnClickListener *FactoryResetButtonCheckOnClick,UIView::OnDragListener *dragListener) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FactoryResetView::FactoryResetViewInit"); + if (group == nullptr) + { + group = new UIViewGroup(); + if (group == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new group fail!"); + return nullptr; + } + group->SetViewId("FACTORY_RESET_GROUPVIEW"); + group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + group->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + group->SetStyle(STYLE_BORDER_RADIUS, 100); + group->SetTouchable(true); + group->SetDraggable(true); + + group->SetOnDragListener(dragListener); + /* ------------------------------- scrollView ------------------------------- */ + // scrollView = new UIScrollView(); + // if (scrollView == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::scrollView new fail!"); + // return nullptr; + // } + // scrollView->SetPosition(0, 0, 466, 466); + // scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + // scrollView->SetScrollBlankSize(50); + // scrollView->SetReboundSize(35); + // scrollView->SetMaxScrollDistance(1000); + // scrollView->SetThrowDrag(true); + // scrollView->RequestFocus(); + // scrollView->SetRotateFactor(2); + /* ---------------------------------- Title --------------------------------- */ + Title = new UILabelExt(); + if (Title == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new Title fail!"); + return nullptr; + } + Title->SetPosition(83, 50, 300, 35); + Title->SetStyle(STYLE_TEXT_FONT, 30); + Title->SetStyle(STYLE_LINE_HEIGHT, 35); + Title->SetTextId(STR_FACTORY_RESET); /*恢复出厂*/ + Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + Title->SetRollSpeed(70); + Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ---------------------------- FactoryResetImage --------------------------- */ + FactoryResetImage = new UIImageView(); + if (FactoryResetImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetImage fail!"); + return nullptr; + } + FactoryResetImage->SetPosition(193, 120); + FactoryResetImage->SetSrc(PNG_ATTENTION_IMAGE); + /* ---------------------------- FactoryResetNote ---------------------------- */ + FactoryResetNote = new UILabelExt(); + if (FactoryResetNote == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetNote fail!"); + return nullptr; + } + FactoryResetNote->SetPosition(53, 228, 360, 70); + FactoryResetNote->SetStyle(STYLE_TEXT_FONT, 30); + FactoryResetNote->SetStyle(STYLE_LINE_HEIGHT, 35); + FactoryResetNote->SetTextId(STR_RESET_CONFIRM_NOTE); /*该操作会清空并重置手表数据,是否确认继续?*/ + FactoryResetNote->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + FactoryResetNote->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff)); + FactoryResetNote->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + FactoryResetNote->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ----------------------- FactoryResetButtonCheckOff ----------------------- */ + FactoryResetButtonCheckOff = new UIButton(); + if (FactoryResetButtonCheckOff == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetButtonCheckOff fail!"); + return nullptr; + } + FactoryResetButtonCheckOff->SetPosition(97, FactoryResetNote->GetTextHeight() + FactoryResetNote->GetY() + 30, 130, 130); + FactoryResetButtonCheckOff->SetViewId("FACTORY_RESET_BUTTON_CHECK_OFF"); + FactoryResetButtonCheckOff->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + FactoryResetButtonCheckOff->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + FactoryResetButtonCheckOff->SetImagePosition(15, 15); + FactoryResetButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED); + FactoryResetButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + FactoryResetButtonCheckOff->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE); + + FactoryResetButtonCheckOff->SetOnClickListener((UIView::OnClickListener *)FactoryResetButtonCheckOnClick); + /* ------------------------ FactoryResetButtonCheckOn ----------------------- */ + FactoryResetButtonCheckOn = new UIButton(); + if (FactoryResetButtonCheckOn == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetButtonCheckOn fail!"); + return nullptr; + } + FactoryResetButtonCheckOn->SetPosition(240, FactoryResetButtonCheckOff->GetY(), 130, 130); + FactoryResetButtonCheckOn->SetViewId("FACTORY_RESET_BUTTON_CHECK_ON"); + FactoryResetButtonCheckOn->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + FactoryResetButtonCheckOn->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + FactoryResetButtonCheckOn->SetImagePosition(15, 15); + FactoryResetButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED); + FactoryResetButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + FactoryResetButtonCheckOn->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE); + // UIView::OnClickListener *FactoryResetButtonCheckOnClick = static_cast(RebootAndShutdownPresenter::GetInstance()); + // if (FactoryResetButtonCheckOnClick == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::RebootAndShutdownPresenter::GetInstance fail!!"); + // return nullptr; + // } + FactoryResetButtonCheckOn->SetOnClickListener((UIView::OnClickListener *)FactoryResetButtonCheckOnClick); + + /* ----------------------------- Add to scroView ---------------------------- */ + group->Add(Title); + group->Add(FactoryResetImage); + group->Add(FactoryResetNote); + group->Add(FactoryResetButtonCheckOff); + group->Add(FactoryResetButtonCheckOn); + //group->Add(scrollView); + group->SetVisible(false); + initViewStatus = true; + } + return group; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 2f89e3b17..5fa7d3a6e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -92,7 +92,7 @@ namespace OHOS } // 切换到关机/重启卡片 - NativeAbility::GetInstance().EnterSlice(VIEW_REBOOTANDSHUTDOWN); + NativeAbility::GetInstance().EnterSlice(VIEW_SHUTDOWN_OR_REBOOT); } static void HandlePowerKeyLongPress(void) diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/RebootView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/RebootView.h index 9898ebd1f..c8ce0f42c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/RebootView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/RebootView.h @@ -19,6 +19,7 @@ #include "components/ui_button.h" #include "components/ui_image_animator.h" #include "ConfigModel.h" +#include "rebootandshutdown/include/FactoryResetView.h" namespace OHOS { constexpr int16_t NUM_REBOOT_CONTAINER = 4; @@ -34,6 +35,7 @@ public: void OnStop() override; UIViewGroup *InitShowUpView(void); void ChangeView(int16_t hideView, int16_t showView); + void FactoryResetGroupVisible(bool data); private: bool ChangeRebootView(int16_t hideView, int16_t thisView); @@ -43,15 +45,21 @@ private: bool CheckViewParam(int16_t hideView, int16_t showView); bool ShowUpRebootView(void); bool ShowUpShutdownView(void); - UILabel *rebootLabel{nullptr}; + bool factoryResetLabelInit(void); + bool factoryResetViewInit(void); + UILabelExt *rebootLabel{nullptr}; UIButton *rebootButton{nullptr}; - UILabel *shutdownLabel{nullptr}; + UILabelExt *shutdownLabel{nullptr}; + UILabelExt *factoryResetLabel{nullptr}; + UIButton *shutdownButton{nullptr}; + FactoryResetView *factoryResetView{nullptr}; UIViewGroup *group{nullptr}; RebootDeviceView *rebootDeviceView{nullptr}; ShutdownDeviceView *shutdownDeviceView{nullptr}; ShutDownAnimatorView*shutDownAnimatorView{nullptr}; UIViewGroup *container[NUM_REBOOT_CONTAINER]{nullptr}; + UIViewGroup *FactoryResetGroup{nullptr}; typedef bool (RebootView::*PreprosssChangeView)(int16_t hideView, int16_t thisView); PreprosssChangeView preProcessView[NUM_REBOOT_CONTAINER]; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/ShutdownDeviceView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/ShutdownDeviceView.h index ca7733424..8fb6a2eaa 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/ShutdownDeviceView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/include/ShutdownDeviceView.h @@ -22,7 +22,7 @@ public: private: bool ShowUpShutdownDeviceView(void); - UILabel *shutdownDeviceLabel{nullptr}; //关机标签 + UILabelExt *shutdownDeviceLabel{nullptr}; //关机标签 UIButton *shutdownDeviceButton{nullptr}; //关机按钮 UIViewGroup *group{nullptr}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp index 69751cab5..9e0be6819 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp @@ -50,7 +50,7 @@ bool RebootDeviceView::ShowUpRebootDeviceView() } } rebootDeviceLabel->SetPosition(152, 272, 150, 45); // 152:x 272:y 150:width 45:height - rebootDeviceLabel->SetText("重启"); + rebootDeviceLabel->SetText("SOS"); rebootDeviceLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data rebootDeviceLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); rebootDeviceLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, @@ -63,9 +63,9 @@ bool RebootDeviceView::ShowUpRebootDeviceView() return false; } } - rebootDeviceButton->SetPosition(172, 147, 110, 110); // 172:x 147:y 110:width 110:height - rebootDeviceButton->SetImageSrc(PNG_SETTINGS_SETTTING_REBOOT, PNG_SETTINGS_SETTTING_REBOOT); - rebootDeviceButton->SetImagePosition(16, 16); + rebootDeviceButton->SetPosition(172, 147, 100, 100); // 172:x 147:y 110:width 110:height + rebootDeviceButton->SetImageSrc(PNG_SETTINGS_SETTTING_SOS, PNG_SETTINGS_SETTTING_SOS); + rebootDeviceButton->SetImagePosition(0, 0); rebootDeviceButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c); rebootDeviceButton->SetViewId(REBOOTDEVICE_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootModel.cpp index 7d8315c70..143fe0232 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootModel.cpp @@ -75,7 +75,7 @@ namespace OHOS } // 切换到关机/重启卡片 - NativeAbility::GetInstance().EnterSlice(VIEW_REBOOTANDSHUTDOWN); + NativeAbility::GetInstance().EnterSlice(VIEW_SHUTDOWN_OR_REBOOT); } /*注册电源键的长按事件*/ diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp index d137eaafa..8ecbdc09b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp @@ -13,6 +13,9 @@ #include "custom_utils.h" #include "components/ui_image_animator.h" #include "common/key_code.h" +#include "dial_sos_c.h" +//#include "rebootandshutdown/include/FactoryResetVIew.h" + namespace OHOS { static RebootPresenter *g_pRebootPresenter = nullptr; @@ -51,7 +54,7 @@ namespace OHOS bool RebootPresenter::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnClick OnClick"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick OnClick"); if (strcmp(view.GetViewId(), REBOOT_BUTTON) == 0) { RebootView::GetInstance()->ChangeView(REBOOTVIEW, REBOOTDEVICEVIEW); @@ -63,13 +66,14 @@ namespace OHOS else if (strcmp(view.GetViewId(), REBOOTDEVICE_BUTTON) == 0) { // 重启 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "REBOOTDEVICE_BUTTON OnClick"); - RebootView::GetInstance()->ChangeView(REBOOTDEVICEVIEW, SHUTDOWNANIMATORVIEW); - start_shutdown_or_reboot(); - shutdown_reboot_prejobs(); + // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "REBOOTDEVICE_BUTTON OnClick"); + // RebootView::GetInstance()->ChangeView(REBOOTDEVICEVIEW, SHUTDOWNANIMATORVIEW); + // start_shutdown_or_reboot(); + // shutdown_reboot_prejobs(); - ShutDownAnimatorView::GetInstance()->GeShutDownImageAnimatorView()->Start(); - isShutDownOperation = false; + // ShutDownAnimatorView::GetInstance()->GeShutDownImageAnimatorView()->Start(); + // isShutDownOperation = false; + start_SOS_phone_dail(); } else if (strcmp(view.GetViewId(), SHUTDOWNDEVICE_BUTTON) == 0) { @@ -83,6 +87,23 @@ namespace OHOS ShutDownAnimatorView::GetInstance()->GeShutDownImageAnimatorView()->Start(); isShutDownOperation = true; } + else if (strcmp(view.GetViewId(), "FACTORYRESET_LABEL_VIEWID") == 0) // 进入出厂设置界面 + { + // RebootAndShutdownView::GetInstance()->ChangeView(REBOOTANDSHUTDOWN, FACTORYRESET); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FACTORYRESET_LABEL_VIEWID"); + RebootView::GetInstance()-> FactoryResetGroupVisible(true); + return true; + } + else if (strcmp(view.GetViewId(), "FACTORY_RESET_BUTTON_CHECK_ON") == 0) // 恢复出厂设置确认 + { + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0); + return true; + } + else if (strcmp(view.GetViewId(), "FACTORY_RESET_BUTTON_CHECK_OFF") == 0) // 恢复出厂设置取消 + { + // RebootAndShutdownView::GetInstance()->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN); + RebootView::GetInstance()-> FactoryResetGroupVisible(false); + } return true; } @@ -105,6 +126,8 @@ namespace OHOS { RebootView::GetInstance()->ChangeView(SHUTDOWNDEVICEVIEW, REBOOTVIEW); } + else if (strcmp(view.GetViewId(), "FACTORY_RESET_GROUPVIEW") == 0) + RebootView::GetInstance()-> FactoryResetGroupVisible(false); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp index 9b3afd211..1783f75f4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp @@ -9,6 +9,8 @@ #include "wearable_log.h" #include "UiConfig.h" #include "RebootPresenter.h" +#include "ui_resource_string.h" + static constexpr int16_t BOOT_IMAGE_ANIMATOR_VIEW_X = 0; static constexpr int16_t BOOT_IMAGE_ANIMATOR_VIEW_Y = 0; @@ -47,6 +49,25 @@ namespace OHOS shutdownLabel = nullptr; delete shutdownButton; shutdownButton = nullptr; + + if(factoryResetView) + { + delete factoryResetView; + factoryResetView = nullptr; + } + + if(FactoryResetGroup) + { + delete FactoryResetGroup; + FactoryResetGroup = nullptr; + } + + if(factoryResetLabel) + { + delete factoryResetLabel; + factoryResetLabel = nullptr; + } + delete group; group = nullptr; g_pRebootView = nullptr; @@ -111,20 +132,21 @@ namespace OHOS RootView::GetInstance()->RemoveAll(); return; } - + //李代桃僵一手 不改函数名了,变为SOS bool RebootView::ShowUpRebootView() { if (rebootLabel == nullptr) { - rebootLabel = new UILabel(); + rebootLabel = new UILabelExt(); if (rebootLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpRebootView rebootLabel new fail"); return false; } } - rebootLabel->SetPosition(49, 272, 150, 45); // 49:x 272:y 150:width 45:height - rebootLabel->SetText("重启"); + rebootLabel->SetPosition(43, 272, 200, 45); // 49:x 272:y 150:width 45:height + rebootLabel->SetText("SOS"); + rebootLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); rebootLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data rebootLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); rebootLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, @@ -139,9 +161,9 @@ namespace OHOS return false; } } - rebootButton->SetPosition(69, 147, 110, 110); // 69:x 147:y 110:width 110:height - rebootButton->SetImageSrc(PNG_SETTINGS_SETTTING_REBOOT, PNG_SETTINGS_SETTTING_REBOOT); - rebootButton->SetImagePosition(16, 16); + rebootButton->SetPosition(93, 160, 100, 100); // 69:x 147:y 110:width 110:height + rebootButton->SetImageSrc(PNG_SETTINGS_SETTTING_SOS, PNG_SETTINGS_SETTTING_SOS); + rebootButton->SetImagePosition(0, 0); rebootButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c); rebootButton->SetViewId(REBOOT_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); @@ -154,19 +176,97 @@ namespace OHOS return true; } + bool RebootView::factoryResetLabelInit(void) + { + + factoryResetLabel = new UILabelExt(); + if (factoryResetLabel == nullptr) + { + return false; + } + factoryResetLabel->SetPosition(83, 370, 300,70); + factoryResetLabel->SetStyle(STYLE_TEXT_FONT, 30); + factoryResetLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + factoryResetLabel->SetTextId(STR_FACTORY_RESET); + factoryResetLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + factoryResetLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + factoryResetLabel->SetRollSpeed(70); + factoryResetLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + factoryResetLabel->SetViewId("FACTORYRESET_LABEL_VIEWID"); + factoryResetLabel->SetTouchable(true); + factoryResetLabel->SetTextColor(Color::GetColorFromRGBA(0x35, 0x49, 0xff, 0xff)); + factoryResetLabel->SetVisible(true); + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); + if (clickListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance nullptr"); + return false; + } + factoryResetLabel->SetOnClickListener(clickListener); + if(factoryResetLabel) + return true; + else + return false; + } + + void RebootView::FactoryResetGroupVisible(bool data) + { + + FactoryResetGroup->SetVisible(data); + RootView::GetInstance()->Invalidate(); + + + } + + bool RebootView::factoryResetViewInit(void) + { + factoryResetView = new FactoryResetView(); + if (factoryResetView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "factoryResetView new fail"); + return false; + } + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); + if (clickListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance nullptr"); + return false; + } + + UIView::OnDragListener *rebootDragListener = (UIView::OnDragListener *)OHOS::RebootPresenter::GetInstance(); + if (clickListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance nullptr"); + return false; + } + + FactoryResetGroup = factoryResetView->FactoryResetViewInit(clickListener,rebootDragListener); + if(FactoryResetGroup) + { + return true; + } + else + { + return false; + } + + } + bool RebootView::ShowUpShutdownView() { if (shutdownLabel == nullptr) { - shutdownLabel = new UILabel(); + shutdownLabel = new UILabelExt(); if (shutdownLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpShutdownView shutdownLabel new fail"); return false; } } - shutdownLabel->SetPosition(255, 272, 150, 45); // 255:x 272:y 150:width 45:height + shutdownLabel->SetPosition(223, 272, 200, 45); // 255:x 272:y 150:width 45:height shutdownLabel->SetText("关机"); + shutdownLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + shutdownLabel->SetTextId(STR_SHUTDOWN); shutdownLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data shutdownLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); shutdownLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, @@ -181,9 +281,9 @@ namespace OHOS return false; } } - shutdownButton->SetPosition(275, 147, 110, 110); // 275:x 147:y 110:width 110:height - shutdownButton->SetImageSrc(PNG_SETTINGS_SETTTING_SHUTDOWN, PNG_SETTINGS_SETTTING_SHUTDOWN); - shutdownButton->SetImagePosition(16, 16); + shutdownButton->SetPosition(273, 160, 100, 100); // 275:x 147:y 110:width 110:height + shutdownButton->SetImageSrc(PNG_SETTINGS_SETTTING_SHUTDOWN_1, PNG_SETTINGS_SETTTING_SHUTDOWN_1); + shutdownButton->SetImagePosition(0, 0); shutdownButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36); shutdownButton->SetViewId(SHUTDOWN_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); @@ -230,6 +330,25 @@ namespace OHOS } group->Add(shutdownLabel); group->Add(shutdownButton); + + ret=factoryResetLabelInit(); + if(false==ret) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "factoryResetLabelInit fail"); + return nullptr; + } + group->Add(factoryResetLabel); + + + ret=factoryResetViewInit(); + if(false==ret) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "factoryResetViewInit fail"); + return nullptr; + } + group->Add(FactoryResetGroup); + + UIView::OnDragListener *rebootDragListener = (UIView::OnDragListener *)OHOS::RebootPresenter::GetInstance(); if (rebootDragListener == nullptr) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp index 1fc6cda00..08d924bcb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp @@ -8,6 +8,7 @@ #include "wearable_log.h" #include "UiConfig.h" #include "rebootdevice/include/RebootPresenter.h" +#include "ui_resource_string.h" namespace OHOS { static ShutdownDeviceView *g_pShutdownDeviceView{nullptr}; @@ -43,7 +44,7 @@ ShutdownDeviceView *ShutdownDeviceView::GetInstance() bool ShutdownDeviceView::ShowUpShutdownDeviceView() { if (shutdownDeviceLabel == nullptr) { - shutdownDeviceLabel = new UILabel(); + shutdownDeviceLabel = new UILabelExt(); if (shutdownDeviceLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpShutdownDeviceView shutdownDeviceLabel new fail"); return false; @@ -51,6 +52,7 @@ bool ShutdownDeviceView::ShowUpShutdownDeviceView() } shutdownDeviceLabel->SetPosition(152, 272, 150, 45); // 152:x 272:y 150:width 45:height shutdownDeviceLabel->SetText("关机"); + shutdownDeviceLabel->SetTextId(STR_SHUTDOWN); shutdownDeviceLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data shutdownDeviceLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); shutdownDeviceLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, @@ -63,9 +65,9 @@ bool ShutdownDeviceView::ShowUpShutdownDeviceView() return false; } } - shutdownDeviceButton->SetPosition(172, 147, 110, 110); // 172:x 147:y 110:width 110:height - shutdownDeviceButton->SetImageSrc(PNG_SETTINGS_SETTTING_SHUTDOWN, PNG_SETTINGS_SETTTING_SHUTDOWN); - shutdownDeviceButton->SetImagePosition(16, 16); + shutdownDeviceButton->SetPosition(172, 147, 100, 100); // 172:x 147:y 110:width 110:height + shutdownDeviceButton->SetImageSrc(PNG_SETTINGS_SETTTING_SHUTDOWN_1, PNG_SETTINGS_SETTTING_SHUTDOWN_1); + shutdownDeviceButton->SetImagePosition(0, 0); shutdownDeviceButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36); shutdownDeviceButton->SetViewId(SHUTDOWNDEVICE_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index deab92b1b..01112b8bd 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -136,7 +136,7 @@ void start_SOS_phone_dail(void) if(uapi_cat1_get_power_stat()|| uapi_dev_runtime_get_cat1_simstat()) #endif { - calldial_event_sendmsg_toUI(sos_dail_buf[(0)%3]); + calldial_event_sendmsg_toUI(sos_dail_buf[0]); sos_dail_falg=1; } #if SOS_HFP_FALG diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h index bdb6d2da5..e82567225 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h @@ -550,7 +550,13 @@ enum UIResourceTextId : uint16_t { STR_HANG_UP_OR_ANSWER = 537, STR_WATCH_CALL = 538, STR_PHONE_CALL = 539, - STR_MAX_ID = 540, + STR_STEPS_OF_THE_DAY = 540, + STR_MILEAGE = 541, + STR_FAT_BURNING_TIME = 542, + STR_NUMBER_OF_STANDS = 543, + STR_CONSUME_CALORIES = 544, + STR_GOAL_HINT = 545, + STR_MAX_ID = 546, }; // UIResourceTextId enum FontLanguageId : uint8_t { diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SOS.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SOS.bin new file mode 100644 index 000000000..2664a2c91 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SOS.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06229296e50d6cb99265e64876b67ef136252c41eeb187d34186d121a900dff9 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/shutdown.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/shutdown.bin new file mode 100644 index 000000000..7daba9fd8 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/shutdown.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d9472bc6dd86f0fc3b45ec6501e55baf30e76e364df08af06870f34ff1e99cf +size 6824 diff --git a/tools/language_tool/font/ui_resource_string.h b/tools/language_tool/font/ui_resource_string.h index bdb6d2da5..e82567225 100644 --- a/tools/language_tool/font/ui_resource_string.h +++ b/tools/language_tool/font/ui_resource_string.h @@ -550,7 +550,13 @@ enum UIResourceTextId : uint16_t { STR_HANG_UP_OR_ANSWER = 537, STR_WATCH_CALL = 538, STR_PHONE_CALL = 539, - STR_MAX_ID = 540, + STR_STEPS_OF_THE_DAY = 540, + STR_MILEAGE = 541, + STR_FAT_BURNING_TIME = 542, + STR_NUMBER_OF_STANDS = 543, + STR_CONSUME_CALORIES = 544, + STR_GOAL_HINT = 545, + STR_MAX_ID = 546, }; // UIResourceTextId enum FontLanguageId : uint8_t {