From: luozheng <1732036298@qq.com> Date: Thu, 29 May 2025 03:50:42 +0000 (+0800) Subject: 久坐提醒弹窗添加,待测试 X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~270 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=bb81c408904270561c1be89021125e9d6b11c4ed;p=mirrors%2FFD230.git 久坐提醒弹窗添加,待测试 --- diff --git a/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c b/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c index c24781271..17361a1f0 100644 --- a/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c +++ b/code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c @@ -38,6 +38,7 @@ static const TopicToCore topicToCoreArray[] = { {TOPIC_EVENT_CHARGE_UNPLUG, A_CORE_MASK, 1}, {TOPIC_EVENT_LOWPOWER_ALARM, A_CORE_MASK, 1}, {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, A_CORE_MASK, 1}, + {TOPIC_EVENT_INACTIVITY_UPDATE, A_CORE_MASK, 1}, }; /* 所有的topic,其对应的位图 */ diff --git a/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt index 18fb72144..36a4d55e6 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt @@ -151,6 +151,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/motion_recognition_notification.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sedentaryReminder_notification.cpp ) else() set(SOURCES @@ -164,6 +165,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/motion_recognition_notification.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sedentaryReminder_notification.cpp ) endif() diff --git a/code/sdk/application/wearable/fd230/service/msg_center/include/notify/sedentaryReminder_notification.h b/code/sdk/application/wearable/fd230/service/msg_center/include/notify/sedentaryReminder_notification.h new file mode 100644 index 000000000..3873645d0 --- /dev/null +++ b/code/sdk/application/wearable/fd230/service/msg_center/include/notify/sedentaryReminder_notification.h @@ -0,0 +1,39 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-06-12 11:44:04 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-10-18 20:29:35 + * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/service/msg_center/include/notify/sedentaryReminder_notification.h + */ +#ifndef SEDENTARYREMINDER_NOTIFICATION +#define SEDENTARYREMINDER_NOTIFICATION +/*久坐提醒*/ + +namespace OHOS +{ + UIViewGroup *CreateSedentaryReminderView(void); + void FreeSedentaryReminderView(void); + + class SedentaryReminderViewEventListener : public UIView::OnTouchListener, public UIView::OnDragListener + { + public: + static SedentaryReminderViewEventListener &GetInstance(); + bool OnRelease(UIView &view, const ReleaseEvent &event) override; + bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView &view, const DragEvent &event) override; + void SetSedentaryReminderNoteIntervalTime(int interval); + int GetIntervalTime(); + + void record_sedentary_reminder_log(void); + private: + SedentaryReminderViewEventListener(); + ~SedentaryReminderViewEventListener(); + SedentaryReminderViewEventListener(const SedentaryReminderViewEventListener &) = delete; + const SedentaryReminderViewEventListener &operator=(const SedentaryReminderViewEventListener &) = delete; + int interval; // 久坐间隔设置 + std::string reminderTime; // 提醒时间段设置 + bool X_DRAG_FLAG{false}; + }; + +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp index 52095232c..405baf35c 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp @@ -44,7 +44,7 @@ #include "transmitting.h" #include "charge_notification.h" #include "motion_recognition_notification.h" - +#include "sedentaryReminder_notification.h" #ifdef SUPPORT_POWER_MANAGER #include "power_display_service.h" @@ -76,6 +76,7 @@ const PriorityMapper PRI_MAPPER[] = { // #endif // #ifdef SUPPORT_CYWEE_SERVICE {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, PRIORITY_TWO}, + {TOPIC_EVENT_INACTIVITY_UPDATE, PRIORITY_TWO}, // #endif }; @@ -119,6 +120,7 @@ void MsgCenterSubscribe() // #endif // #ifdef SUPPORT_CYWEE_SERVICE MsgCenterSubscribeTopic(TOPIC_EVENT_AR_ALERT_TYPE_UPDATE); + MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_UPDATE); // #endif } @@ -183,6 +185,12 @@ static OHOS::UIViewGroup* showMotionRecognitionNotify(void) return OHOS::CreateMotionRecognitionView(); } +/*显示久坐提醒视图*/ +static OHOS::UIViewGroup* showSedentaryReminderNotify(void) +{ + return OHOS::CreateSedentaryReminderView(); +} + void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) { unused(req); @@ -533,6 +541,55 @@ void MsgCenterNotifyArAlertProc(const Topic topic, Request* req) } } + +void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) +{ + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyInactivityProc !"); + #ifdef SUPPORT_CYWEE_SERVICE + cywee_inactivity_result_t *cywee_Inactivity_Info = (cywee_inactivity_result_t *)malloc(req->len); + if (!cywee_Inactivity_Info) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure"); + return; + } + + int rets = memcpy_s(cywee_Inactivity_Info, req->len, (cywee_inactivity_result_t*)req->data, req->len); + if (rets != EOK) + { + free(cywee_Inactivity_Info); + cywee_Inactivity_Info = NULL; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_inactivity_result_t failed, ret = %d", rets); + return; + } + + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->output_number = %d", cywee_Inactivity_Info->output_number); + + switch (cywee_Inactivity_Info->output_number) + { + case INACTIVITY_MODE_SEDENTARY_OUTPUT: + if(cywee_Inactivity_Info->status == 1) + { + SedentaryReminderViewEventListener::GetInstance().record_sedentary_reminder_log(); + if (CheckPriority(topic)) + { + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); + NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true); + } + } + else if(cywee_Inactivity_Info->status==9) + { + set_stand_falg(); + } + break; + default: + break; + } + + free(cywee_Inactivity_Info); + cywee_Inactivity_Info = NULL; + #endif +} + #endif /* 订阅事件通知逻辑可定制 */ @@ -554,6 +611,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { // #endif // #ifdef SUPPORT_CYWEE_SERVICE {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, MsgCenterNotifyArAlertProc}, + {TOPIC_EVENT_INACTIVITY_UPDATE, MsgCenterNotifyInactivityProc}, // #endif // {TOPIC_EVENT_DEVICE_UNBIND, MsgCenterNotifyDeviceUnBindProc}, // {TOPIC_EVENT_DEVICE_UNBINDING_REQUEST, MsgCenterNotifyDeviceUnBindingRequestProc}, diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/sedentaryReminder_notification.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/sedentaryReminder_notification.cpp new file mode 100644 index 000000000..3e0b08773 --- /dev/null +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/sedentaryReminder_notification.cpp @@ -0,0 +1,336 @@ +#include "notification_manager.h" +#include "wearable_log.h" +#include "components/ui_button.h" +#include "components/ui_image_view.h" +#include "components/ui_label_ext.h" +#include "components/ui_scroll_view.h" +#include "ui_resource_string.h" +#include "uicomponents/UIComponents.h" +#include +#include +#include +#include +#include "ConfigModel.h" +#include "uiservice/include/ui_service.h" +#include "vibrator_service.h" +#include "custom_runtime.h" +#include "system/include/SystemLogModel.h" +#include +#include "sedentaryReminder_notification.h" + +namespace OHOS +{ + + UIViewGroup *SedentaryReminderGroupView{nullptr}; + UIScrollView *SedentaryReminderScrollView{nullptr}; + UILabelExt *SedentaryReminderTitleLabel{nullptr}; // 标题: 久坐提醒 + UIImageView *SedentaryReminderImage{nullptr}; + UILabelExt *SedentaryReminderNoteLabel{nullptr}; // 久坐提醒note + UILabelExt *SedentaryReminderLabel{nullptr}; + UIButton *SedentaryReminderButton{nullptr}; + + static constexpr const int X_DRAG_OFFSET = 20; + static constexpr const int DOUBLES = 2; + + static constexpr const char *SEDENTARY_REMINDER_GROUPVIEWID = "sedentary_reminder_groupviewid"; + static constexpr const char *SEDENTARY_REMINDER_BUTTONVIEWID = "sedentary_reminder_buttonviewid"; + + SedentaryReminderViewEventListener::SedentaryReminderViewEventListener() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SedentaryReminderViewEventListener::SedentaryReminderViewEventListener"); + } + + SedentaryReminderViewEventListener::~SedentaryReminderViewEventListener() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SedentaryReminderViewEventListener::~SedentaryReminderViewEventListener"); + } + + SedentaryReminderViewEventListener &SedentaryReminderViewEventListener::GetInstance() + { + static SedentaryReminderViewEventListener instance; + return instance; + } + + bool SedentaryReminderViewEventListener::OnRelease(UIView &view, const ReleaseEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SedentaryReminderViewEventListener::OnRelease"); + UNUSED(event); + std::string viewId = view.GetViewId(); + if (viewId == SEDENTARY_REMINDER_BUTTONVIEWID) + { + NotificationManager::GetInstance()->StopNotify(); + } + + return true; + } + + bool SedentaryReminderViewEventListener::OnDrag(UIView &view, const DragEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SedentaryReminderViewEventListener::OnDrag"); + UNUSED(view); + if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动 + { + SedentaryReminderViewEventListener::X_DRAG_FLAG = true; + } + return true; + } + + bool SedentaryReminderViewEventListener::OnDragEnd(UIView &view, const DragEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SedentaryReminderViewEventListener::OnDragEnd"); + std::string viewId = view.GetViewId(); + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && SedentaryReminderViewEventListener::X_DRAG_FLAG) + { + if (viewId == SEDENTARY_REMINDER_GROUPVIEWID) + { + NotificationManager::GetInstance()->StopNotify(); + } + SedentaryReminderViewEventListener::X_DRAG_FLAG = false; + } + return true; + } + + // 记录久坐提醒日志 + void SedentaryReminderViewEventListener::record_sedentary_reminder_log(void) + { + // popup_windows_log_data systemlog; + // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime(); + // systemlog.type = popup_windows_type::SEDENTARY_REMINDER; + // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog); + uint8_t type = 2; + do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type)); + } + + static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id) + { + if (label == nullptr) + { + return nullptr; + } + /*取Id对应的字符串*/ + UILabelExt *labelext = new UILabelExt(); + labelext->SetTextId(id); + std::string text = labelext->GetText(); + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateLabel:%s->%s\r\n", text.c_str(), newText.c_str()); + + // 找到标志"XX"在字符串中的位置 + size_t pos = text.find("XX"); + if (pos != std::string::npos) + { + // 替换标志"XX"为更新字符串 + text.replace(pos, 2, newText); // 2 是标志"XX"的长度 + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "newText:%s\r\n", text.c_str()); + label->SetText(text.c_str()); + } + else + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "找不到变量标志位XX,请注意是否已经被修改!"); + } + + delete labelext; + return text; + } + + /*设置喝水提醒note上的提醒时间*/ + void SedentaryReminderViewEventListener::SetSedentaryReminderNoteIntervalTime(int interval) + { + UpdateNoteLabelText(SedentaryReminderNoteLabel, std::to_string(interval), STR_SEDENTARY_REMINDER_NOTE); + } + + // 获取久坐提醒时间间隔 + int SedentaryReminderViewEventListener::GetIntervalTime() + { + interval = ConfigModel::GetInstance()->GetSedentaryInterval(); + return interval; + } + + /*创建久坐提醒视图*/ + UIViewGroup *CreateSedentaryReminderView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CreateSedentaryReminderView(void)"); + if (SedentaryReminderGroupView == nullptr) + { + SedentaryReminderGroupView = new UIViewGroup(); + if (SedentaryReminderGroupView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] SedentaryReminderGroupView new fail!!"); + return nullptr; + } + SedentaryReminderGroupView->SetPosition(0, 0, 466, 466); + SedentaryReminderGroupView->SetViewId(SEDENTARY_REMINDER_GROUPVIEWID); + SedentaryReminderGroupView->SetTouchable(true); + SedentaryReminderGroupView->SetDraggable(true); + UIView::OnDragListener *dragListener = static_cast(&SedentaryReminderViewEventListener::GetInstance()); + if (dragListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] dragListener new fail!!"); + return nullptr; + } + SedentaryReminderGroupView->SetOnDragListener(dragListener); + /* -------------------------------------------------------------------------- */ + if (SedentaryReminderScrollView == nullptr) + { + SedentaryReminderScrollView = new UIScrollView(); + if (SedentaryReminderScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SedentaryReminderScrollView new fail"); + return nullptr; + } + } + SedentaryReminderScrollView->SetPosition(0, 0, 466, 466); + SedentaryReminderScrollView->SetThrowDrag(true); + SedentaryReminderScrollView->SetDraggable(true); + SedentaryReminderScrollView->SetTouchable(true); + SedentaryReminderScrollView->SetReboundSize(30); + SedentaryReminderScrollView->SetScrollBlankSize(30); + SedentaryReminderScrollView->SetSwipeACCLevel(200); // 800: compensation distance + SedentaryReminderScrollView->SetDragACCLevel(5); // 5: drag acceleration + SedentaryReminderScrollView->SetMaxScrollDistance(1000); + SedentaryReminderScrollView->SetDirection(UIScrollView::VERTICAL); + SedentaryReminderScrollView->RequestFocus(); + SedentaryReminderScrollView->SetRotateFactor(1.0); + /* ------------------------- SedentaryReminderTitleLabel ------------------------ */ + SedentaryReminderTitleLabel = new UILabelExt(); + if (SedentaryReminderTitleLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] SedentaryReminderTitleLabel new fail!!"); + return nullptr; + } + SedentaryReminderTitleLabel->SetPosition(83, 52, 300, 35); + SedentaryReminderTitleLabel->SetStyle(STYLE_TEXT_FONT, 30); + SedentaryReminderTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); +#ifdef FD230 + SedentaryReminderTitleLabel->SetTextId(STR_SEDENTARY_REMINDER); +#else + SedentaryReminderTitleLabel->SetText("久坐提醒"); +#endif + SedentaryReminderTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + SedentaryReminderTitleLabel->SetRollSpeed(23); + SedentaryReminderTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + SedentaryReminderTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* --------------------------- SedentaryReminderImage --------------------------- */ + SedentaryReminderImage = new UIImageView(); + if (SedentaryReminderImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] SedentaryReminderImage new fail!!"); + return nullptr; + } + SedentaryReminderImage->SetPosition(193, 130, 80, 80); + SedentaryReminderImage->SetSrc("/user/res/SedentaryReminder/SedentaryReminder.bin"); + /* ------------------------- SedentaryReminderNoteLabel ------------------------- */ + SedentaryReminderNoteLabel = new UILabelExt(); + if (SedentaryReminderNoteLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] SedentaryReminderNoteLabel new fail!!"); + return nullptr; + } + SedentaryReminderNoteLabel->SetPosition(53, 248, 360, 70); + SedentaryReminderNoteLabel->SetStyle(STYLE_TEXT_FONT, 30); + SedentaryReminderNoteLabel->SetStyle(STYLE_LINE_HEIGHT, 35); +#ifdef FD230 + // SetLabelId(SedentaryReminderNoteLabel, STR_SEDENTARY_REMINDER_NOTE); + SedentaryReminderNoteLabel->SetTextId(STR_SEDENTARY_REMINDER_NOTE); +#endif + // UpdateLabel(SedentaryReminderNoteLabel,"1",STR_SEDENTARY_REMINDER_NOTE); + SedentaryReminderViewEventListener::GetInstance().SetSedentaryReminderNoteIntervalTime(SedentaryReminderViewEventListener::GetInstance().GetIntervalTime()); + SedentaryReminderNoteLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + SedentaryReminderNoteLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + SedentaryReminderNoteLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* --------------------------- SedentaryReminderButton -------------------------- */ + SedentaryReminderButton = new UIButton(); + if (SedentaryReminderButton == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] SedentaryReminderButton new fail!!"); + return nullptr; + } + SedentaryReminderButton->SetPosition(0, 366, 466, 100); + SedentaryReminderButton->SetViewId(SEDENTARY_REMINDER_BUTTONVIEWID); + const char *buttonImgSrc = "/user/res/466x100button.bin"; + SedentaryReminderButton->SetImageSrc(buttonImgSrc, buttonImgSrc); + SedentaryReminderButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff0b1928, UIButton::PRESSED); + UIView::OnTouchListener *TouchListener = static_cast(&SedentaryReminderViewEventListener::GetInstance()); + if (TouchListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] TouchListener new fail!!"); + return nullptr; + } + SedentaryReminderButton->SetOnTouchListener(TouchListener); + /* --------------------------- SedentaryReminderLabel --------------------------- */ + SedentaryReminderLabel = new UILabelExt(); + if (SedentaryReminderLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateSedentaryReminderView] SedentaryReminderLabel new fail!!"); + return nullptr; + } + SedentaryReminderLabel->SetPosition(133, 399, 200, 35); + SedentaryReminderLabel->SetStyle(STYLE_TEXT_FONT, 30); + SedentaryReminderLabel->SetStyle(STYLE_LINE_HEIGHT, 35); +#ifdef FD230 + SedentaryReminderLabel->SetTextId(STR_KONW); +#else + SedentaryReminderLabel->SetText("知道了"); +#endif + SedentaryReminderLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + SedentaryReminderLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + SedentaryReminderLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ----------------------------------- Add ---------------------------------- */ + SedentaryReminderScrollView->Add(SedentaryReminderTitleLabel); + SedentaryReminderScrollView->Add(SedentaryReminderImage); + SedentaryReminderScrollView->Add(SedentaryReminderNoteLabel); + SedentaryReminderScrollView->Add(SedentaryReminderButton); + SedentaryReminderScrollView->Add(SedentaryReminderLabel); + SedentaryReminderGroupView->Add(SedentaryReminderScrollView); + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create SedentaryReminderView succeed!!"); + } + /* -------------------------------------------------------------------------- */ + ScreenTurnOn(10 * 1000); // 显示时长10s + if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + { + ui_api_vibrate_once_func(); + } + /* -------------------------------------------------------------------------- */ + NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeSedentaryReminderView); + return SedentaryReminderGroupView; + } + + /*释放久坐提醒视图*/ + void FreeSedentaryReminderView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FreeSedentaryReminderView(void)"); + if (SedentaryReminderGroupView != nullptr) + { + SedentaryReminderGroupView->RemoveAll(); + if (SedentaryReminderScrollView != nullptr) + { + SedentaryReminderScrollView->RemoveAll(); + delete SedentaryReminderTitleLabel; + SedentaryReminderTitleLabel = nullptr; + + delete SedentaryReminderImage; + SedentaryReminderImage = nullptr; + + delete SedentaryReminderNoteLabel; + SedentaryReminderNoteLabel = nullptr; + + delete SedentaryReminderButton; + SedentaryReminderButton = nullptr; + + delete SedentaryReminderLabel; + SedentaryReminderLabel = nullptr; + + SedentaryReminderScrollView->ClearFocus(); + delete SedentaryReminderScrollView; + SedentaryReminderScrollView = nullptr; + } + RootView::GetInstance()->Remove(SedentaryReminderGroupView); + delete SedentaryReminderGroupView; + SedentaryReminderGroupView = nullptr; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Free SedentaryReminderView succeed!!"); + ScreenTurnOff(); + } + return; + } + +} \ No newline at end of file