+/***
+ * @Date: 2024-08-29 19:24:30
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 18:57:46
+ * @FilePath: /FD230/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp
+ */
/***
* @Date: 2024-05-10 10:27:30
* @LastEditors: Caisking 3449750381@qq.com
imageView->SetPosition(left, top);
imageView->SetAutoEnable(true);
imageView->SetViewId(viewId);
- imageView->SetSrc(imagePath);
+
+ ImageInfo *image = ImageCacheManager::GetInstance().LoadSingleRes(imagePath, false);
+ if (image == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LoadAllDialFromRam loadimage %s fail",
+ imagePath);
+ return false;
+ }
+ imageView->SetSrc(image);
return true;
}
/*带默认参数的初始化label*/
/* -------------------------------------------------------------------------- */
/**
* 创建包含图片文件路径的数组
- * @param basePath 包含图片文件的基本路径
- * @param fileExtension 图片文件的扩展名
- * @param numImages 图片文件的数量
- * @return 返回包含图片文件路径的数组
+ * @param basePath 包含图片文件的基本路径
+ * @param fileExtension 图片文件的扩展名
+ * @param numImages 图片文件的数量
+ * @return 返回包含图片文件路径的数组
*/
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
+ const char **CreateImagePathsArray(const char *basePath, int numImages, const char *fileExtension)
{
- const char **imagePaths = new const char *[numImages];
+ const char **imagePaths = static_cast<const char **>(UIMalloc(numImages * sizeof(const char *)));
+ if (imagePaths == nullptr)
+ {
+ return nullptr; // 检查内存分配是否成功
+ }
+
char buffer[256];
for (int i = 0; i < numImages; i++)
{
snprintf(buffer, sizeof(buffer), "%s/%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
+ imagePaths[i] = static_cast<char *>(UIMalloc(strlen(buffer) + 1)); // 分配内存来存储每个路径
+ if (imagePaths[i] == nullptr)
+ {
+ // 如果分配失败,释放已经分配的内存并返回 nullptr
+ for (int j = 0; j < i; j++)
+ {
+ UIFree(const_cast<char *>(imagePaths[j])); // 释放已分配的内存
+ }
+ UIFree(imagePaths);
+ return nullptr;
+ }
+ strcpy(const_cast<char *>(imagePaths[i]), buffer); // 使用 strcpy 拷贝字符串
}
return imagePaths;
}
+ /**
+ * 释放创建的图片路径数组
+ * @param imagePaths 包含图片路径的数组
+ * @param numImages 图片文件的数量
+ */
+ void FreeImagePathsArray(const char **imagePaths, int numImages)
+ {
+ if (imagePaths != nullptr)
+ {
+ for (int i = 0; i < numImages; i++)
+ {
+ UIFree(const_cast<char *>(imagePaths[i])); // 释放每个路径字符串
+ }
+ UIFree(const_cast<const char **>(imagePaths)); // 释放整个数组
+ }
+ }
+
/*解析动画资源数组 imageche*/
std::vector<ImageInfo *> AnalysisArray(const char *filename, uint32_t startId, uint32_t lastId)
{
-/***
- * @Date: 2024-07-29 10:31:48
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-08-21 16:17:07
- * @FilePath: /FD230/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h
- */
-/***
- * @Date: 2024-05-30 15:59:37
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-07-29 14:19:44
- * @FilePath: /FD230/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h
- */
-/***
- * @Date: 2024-05-30 15:59:37
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-06-27 15:04:48
- * @FilePath: /FD230/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h
- */
-/***
- * @Date: 2024-05-10 10:27:30
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-05-10 11:04:28
- * @FilePath: /sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h
- */
+
#ifndef UICOMPONENTS_H
#define UICOMPONENTS_H
#include "BaseView.h"
#include "View.h"
#include <string>
+
+// UI 组件
#include "components/ui_scroll_view.h"
#include "components/ui_view_group.h"
#include "components/ui_label.h"
#include "components/ui_chart.h"
#include "components/ui_list.h"
#include "components/icon_adapter.h"
+#include "components/ui_card_page.h"
+
+// 日志和类型定义
#include "wearable_log.h"
#include "ohos_types.h"
-#include "components/ui_card_page.h"
+#include "common/image_cache_manager.h"
+
#ifdef FD230
#include "traing/include/TraingModel.h"
#include "ui_resource_string.h"
#endif
-#include "common/image_cache_manager.h"
namespace OHOS
{
- /*初始化label[可使用text]*/
+
+ // 初始化和创建 UI 组件
+ // =======================
+ /* 初始化 UILabel */
bool InitLabel(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
- /*初始化label[可使用text]*/
bool InitUILabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
- /*初始化button*/
+
+ /* 初始化 UIButton */
bool InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
- /*初始化labelbutton*/
+
+ /* 初始化 UILabelButton */
bool InitLabelButton(UILabelButton *&button, int left, int top, int width, int height, const char *viewId, const char *text, int fontSize);
- /*初始化image*/
+
+ /* 初始化 UIImageView */
bool InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
- /*生成动画资源数组*/
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
- /*自适应label*/
+
+ /* 初始化动画资源 */
+ void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const std::vector<std::string> &imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId, int time);
+
+ /* 自适应 UILabel */
bool InitLabelAdapt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+
+ // 默认参数的 UILabel 初始化
+ void InitLabelDefault(UILabelExt *&label, int x, int y, int width, int height, const char *viewId, const char *text, int fontSize = 30, const char *fontName = DEFAULT_VECTOR_FONT_FILENAME);
+
+ /*生成动画资源数组*/
+ const char **CreateImagePathsArray(const char *basePath, int numImages, const char *fileExtension = "bin");
+
+ /*释放动画资源数组*/
+ void FreeImagePathsArray(const char **imagePaths, int numImages);
+
/*初始化动画资源*/
void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId, int time);
- /*InitLabel[默认参数]*/
- void InitLabelDefault(UILabelExt *&label, int x, int y, int width, int height, const char *viewId, const char *text, int fontSize = 30, const char *fontName = DEFAULT_VECTOR_FONT_FILENAME);
+
#ifdef FD230
- /*初始化labelExt*/
+ // 扩展功能
+ // =======================
bool InitLabelExt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, const char *fontName, int fontSize);
bool InitButtonExt(UILabelButtonExt *&button, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, int fontSize);
- /*通用替换*/
+
+ // 更新 Label 的文本
std::string UpdateLabelText(UILabelExt *&label, const std::string &newText, UIResourceTextId id);
- /*更新label的数字*/
std::string UpdateLabel(UILabelExt *&label, int num, UIResourceTextId id);
- /*更新label的字符串*/
std::string UpdateLabel(UILabelExt *&label, const std::string &updatestr, UIResourceTextId id);
- /*通过labelext获取Id设置label*/
+
+ // 设置 Label ID
void SetLabelId(UILabel *&label, UIResourceTextId id);
-#endif
- /*解析动画资源数组 imageche*/
- std::vector<ImageInfo *> AnalysisArray(const char *filename, uint32_t startId, uint32_t lastId);
-}
+#endif // FD230
+
+} // namespace OHOS
+
#endif // UICOMPONENTS_H
\ No newline at end of file
+/***
+ * @Date: 2024-08-19 19:20:08
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 18:57:30
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceConnectingView.h
+ */
/*
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-08-03 11:09:56
UIScrollView *CreateAiVoiceConnectingView(void);
UIScrollView *CreateAiVoiceConnectingView(uint8_t);
private:
- const char **CreateImagePathsArray(const char *basePath, const int numImages, const char *fileExtension = "bin");
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
UIImageAnimatorView *connectingImageAnimatorInit(ImageAnimatorConfig &imageanimatorconfig);
UILabelExt *AiVoiceConnectingViewLabelInit(LabelConfig &labelconfig);
UIButton *AiVoiceConnectingViewButtonInit(ButtonConfig &buttonconfig);
+/***
+ * @Date: 2024-06-26 16:59:51
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 18:57:36
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceListeningView.h
+ */
/*
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-22 16:46:26
private:
void ClearAll(void);
- const char **CreateImagePathsArray(const char *basePath, const int numImages, const char *fileExtension = "bin");
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
UILabelExt *AivoiceListeningLabelInit(LabelConfig &labelconfig);
UIButton *AivoiceListeningButtonInit(ButtonConfig &buttonconfig);
UIImageAnimatorView *AivoiceListeningImageAnimatorInit(ImageAnimatorConfig &imageanimatorconfig);
private:
void ClearAll(void);
- const char **CreateImagePathsArray(const char *basePath, const int numImages, const char *fileExtension = "bin");
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
UILabelExt *AivoiceThinkingLabelInit(LabelConfig &labelconfig);
UIButton *AivoiceThinkingButtonInit(ButtonConfig &buttonconfig);
UIImageAnimatorView *AivoiceThinkingImageAnimatorInit(ImageAnimatorConfig &imageanimatorconfig);
#include "wearable_log.h"
#include "ui_resource_string.h"
#include "common/image_cache_manager.h"
+#include "uicomponents/UIComponents.h"
namespace OHOS
{
return button;
}
- const char **AiVoiceConnectingView::CreateImagePathsArray(const char *basePath, const int numImages, const char *fileExtension)
- {
- const char **imagePaths = new const char *[numImages];
- if (imagePaths == nullptr)
- {
- return nullptr;
- }
-
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
-
- void AiVoiceConnectingView::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- // ImageCacheManager::GetInstance().UnloadSingleRes(imagePaths[i]);
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
UIImageAnimatorView *AiVoiceConnectingView::connectingImageAnimatorInit(ImageAnimatorConfig &imageanimatorconfig)
{
UIImageAnimatorView *animatorView = new UIImageAnimatorView();
#include "wearable_log.h"
#include "ui_resource_string.h"
#include <UiConfig.h>
+#include "uicomponents/UIComponents.h"
// #include "common/image_cache_manager.h"
namespace OHOS
{
}
}
- const char **AivoiceListeningView::CreateImagePathsArray(const char *basePath, const int numImages, const char *fileExtension)
- {
- const char **imagePaths = new const char *[numImages];
- if (imagePaths == nullptr)
- {
- return nullptr;
- }
-
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
-
- void AivoiceListeningView::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- // ImageCacheManager::GetInstance().UnloadSingleRes(imagePaths[i]);
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
UILabelExt *AivoiceListeningView::AivoiceListeningLabelInit(LabelConfig &labelconfig)
{
UILabelExt *label = new UILabelExt();
#include "wearable_log.h"
#include "ui_resource_string.h"
#include <UiConfig.h>
+#include "uicomponents/UIComponents.h"
// #include "common/image_cache_manager.h"
namespace OHOS
{
}
}
- const char **AivoiceThinkingView::CreateImagePathsArray(const char *basePath, const int numImages, const char *fileExtension)
- {
- const char **imagePaths = new const char *[numImages];
- if (imagePaths == nullptr)
- {
- return nullptr;
- }
-
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
-
- void AivoiceThinkingView::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- // ImageCacheManager::GetInstance().UnloadSingleRes(imagePaths[i]);
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
UILabelExt *AivoiceThinkingView::AivoiceThinkingLabelInit(LabelConfig &labelconfig)
{
UILabelExt *label = new UILabelExt();
void FindPhoneViewInit_BlueToothConnected(void);
void FindPhoneViewInit_BlueToothDisConnected(void);
void ClearAll();
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
UIViewGroup *FindPhoneGroupView = nullptr;
UILabelExt *FindPhoneTitleLabel = nullptr;
UILabelExt *FindPhoneLabel = nullptr;
+/***
+ * @Date: 2024-06-19 19:25:22
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 19:23:15
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
+ */
/*
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-27 10:47:46
#include "bletest.h"
#include "bleEvent.h"
#include "ui_resource_string.h"
+#include "uicomponents/UIComponents.h"
namespace OHOS
{
}
}
- const char **FindPhoneView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
- {
- const char **imagePaths = new const char *[numImages];
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
-
- /*
- * @brief: 释放图片路径数组指针
- * @param {char} imagePaths 图片路径数组
- * @param {int} numImages 图片数量
- */
- void FindPhoneView::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
/*蓝牙如果是未连接状态*/
void FindPhoneView::FindPhoneViewInit_BlueToothDisConnected(void)
{
FindPhoneTitleLabel->SetPosition(133, 51, 200, 40);
FindPhoneTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
FindPhoneTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
- //FindPhoneTitleLabel->SetText("查找手机");
+ // FindPhoneTitleLabel->SetText("查找手机");
FindPhoneTitleLabel->SetTextId(STR_FIND_PHONE);
FindPhoneTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
FindPhoneTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
FindPhoneLabel->SetPosition(33, 270, 400, 40);
FindPhoneLabel->SetStyle(STYLE_TEXT_FONT, 30);
FindPhoneLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
- //FindPhoneLabel->SetText("蓝牙未连接");
+ // FindPhoneLabel->SetText("蓝牙未连接");
FindPhoneLabel->SetTextId(STR_BLUETOOTH_DISCONNECTED);
FindPhoneLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
FindPhoneLabel->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
FindPhoneLabelButton->SetPosition(0, 366, 466, 100);
FindPhoneLabelButton->SetViewId(FINDPHONE_LABELBUTTON);
FindPhoneLabelButton->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE);
- //FindPhoneLabelButton->SetText("关闭");
+ // FindPhoneLabelButton->SetText("关闭");
FindPhoneLabelButton->SetTextId(STR_CLOSE);
FindPhoneLabelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
FindPhoneLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
FindPhoneTitleLabel->SetPosition(133, 51, 200, 40);
FindPhoneTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
FindPhoneTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
- //FindPhoneTitleLabel->SetText("查找手机");
+ // FindPhoneTitleLabel->SetText("查找手机");
FindPhoneTitleLabel->SetTextId(STR_FIND_PHONE);
FindPhoneTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
FindPhoneTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
FindPhoneTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
/* ----------------------- FindPhoneImageAnimator ---------------------- */
- FindPhonePathsArray = CreateImagePathsArray("/user/res/findphone/", "bin", FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ FindPhonePathsArray = CreateImagePathsArray("/user/res/findphone/",FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
if (FindPhoneImageAnimator == nullptr)
{
FindPhoneImageAnimator = new UIImageAnimatorView();
FindPhoneLabel->SetPosition(33, 270, 400, 40);
FindPhoneLabel->SetStyle(STYLE_TEXT_FONT, 30);
FindPhoneLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
- //FindPhoneLabel->SetText("手机正在响铃/震动");
+ // FindPhoneLabel->SetText("手机正在响铃/震动");
FindPhoneLabel->SetTextId(STR_PHONE_RINGING_VIBRATING);
FindPhoneLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
FindPhoneLabel->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
FindPhoneLabelButton->SetPosition(0, 366, 466, 100);
FindPhoneLabelButton->SetViewId(FINDPHONE_LABELBUTTON);
FindPhoneLabelButton->SetImageSrc(PNG_466x100BUTTON_IMAGE, PNG_466x100BUTTON_IMAGE);
- //FindPhoneLabelButton->SetText("停止");
+ // FindPhoneLabelButton->SetText("停止");
FindPhoneLabelButton->SetTextId(STR_STOP);
FindPhoneLabelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
FindPhoneLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
HeartChartView::~HeartChartView()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartChartView::~HeartChartView");
- imageAnimator->Stop();
+
+ // imageAnimator->Stop();
/*
- UIViewGroup *tmpGroup = dynamic_cast<UIViewGroup *>(container_);
- UIViewGroup::RemoveAndDeleteAllRecursively(tmpGroup);
+ UIViewGroup *tmpGroup = dynamic_cast<UIViewGroup *>(container_);
+ UIViewGroup::RemoveAndDeleteAllRecursively(tmpGroup);
*/
delete CurrentHeartText;
delete imageAnimator;
imageAnimator = nullptr;
-
heartchart->ClearDataSerial();
delete heartSerial;
heartSerial = nullptr;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartChartView::InitHeartView fail");
}
- HeartImageAnimator();
+ // HeartImageAnimator();
InitChartView();
SetDataChart();
SetDataTopAndBottom();
void OnAnimatorStop(UIView &view) override;
void ClearAll(void);
bool ShowUpShutDownAnimatorView();
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
+
UIViewGroup *group{nullptr};
UIImageAnimatorView *shutDownImageAnimatorView{nullptr}; // 关机动画
ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
+/***
+ * @Date: 2024-08-29 11:02:07
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 19:24:04
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp
+ */
#include "rebootandshutdown/include/ShutDownImageAnimatorView.h"
#include "rebootandshutdown/include/RebootAndShutdownPresenter.h"
#include "wearable_log.h"
#include <custom_utils.h>
+#include "uicomponents/UIComponents.h"
namespace OHOS
{
return g_pShutDownAnimatorView;
}
- const char **ShutDownImageAnimatorView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
- {
- const char **imagePaths = new const char *[numImages];
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
-
- void ShutDownImageAnimatorView::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
void ShutDownImageAnimatorView::ClearAll(void)
{
if (group != nullptr)
isShutDownImageAnimatorStart = true;
}
- //获取开机动画是否已经开始
+ // 获取开机动画是否已经开始
bool ShutDownImageAnimatorView::GetShutDownImageAnimatorIsStart(void)
{
return isShutDownImageAnimatorStart;
bool ShutDownImageAnimatorView::ShowUpShutDownAnimatorView()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorView::ShowUpShutDownAnimatorView");
- ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, "bin", SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
if (shutDownImageAnimatorView == nullptr)
{
void RespiratoryTrainingViewInit(void);
void ClearAll(void);
#if 0
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
void InitializeRespiratoryTrainingImageInfo();
void SetAnimatorViewProperties();
void CreateRespiratoryTrainingAnimatorView();
}
}
- const char **RespiratoryTrainingView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
- {
- const char **imagePaths = new const char *[numImages];
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
- /*
- * @brief: 释放图片路径数组指针
- * @param {char} imagePaths 图片路径数组
- * @param {int} numImages 图片数量
- */
- void RespiratoryTrainingView::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
// 初始化呼吸训练动画图片信息
void RespiratoryTrainingView::InitializeRespiratoryTrainingImageInfo()
{
#include "common/key_code.h"\r
\r
#include "saveele/include/SaveElePresenter.h"\r
-\r
+#include "gfx_utils/mem_check.h"\r
namespace OHOS\r
{\r
\r
\r
SaveElePresenter::SaveElePresenter()\r
{\r
-\r
+#ifdef MEM_CHECK\r
+ MemCheck::GetInstance()->EnableLeakCheck(true);\r
+#endif\r
g_pSaveElePresenter = this;\r
}\r
\r
SaveElePresenter::~SaveElePresenter()\r
{\r
-\r
+#ifdef MEM_CHECK\r
+ MemCheck::GetInstance()->EnableLeakCheck(false);\r
+#endif\r
g_pSaveElePresenter = nullptr;\r
}\r
\r
void SleepDataRefresh();
private:
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
void DumpWeatherInfo();
private:
{
g_pSleepControlPresenter = nullptr;
#ifdef MEM_CHECK
- MemCheck::GetInstance()->EnableLeakCheck(true);
+ MemCheck::GetInstance()->EnableLeakCheck(false);
#endif
}
UIImageAnimatorView *smileAnimator{nullptr};
bool viewiInitStatus{false};
+
+ std::string creambasePath;
+ const char **creamimagePaths;
+ std::string smilebasePath;
+ const char **smileimagePaths;
};
} // namespace OHOS
#endif // Takephotos_PRESENTER_H
+/***
+ * @Date: 2024-08-29 19:34:29
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 19:46:48
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosView.cpp
+ */
#include "takephotos/include/TakephotosView.h"
#include "takephotos/include/TakephotosModel.h"
// DeInit();
creamAnimator->Stop();
- smileAnimator->Start();
+ smileAnimator->Stop();
+ FreeImagePathsArray(creamimagePaths, 50);
+ FreeImagePathsArray(smileimagePaths, 27);
UIViewGroup *tmpGroup = dynamic_cast<UIViewGroup *>(container_);
UIViewGroup::RemoveAndDeleteAllRecursively(tmpGroup);
buttongo->SetOnClickListener(static_cast<UIView::OnClickListener *>(TakephotosPresenter::GetInstance()));
// 初始化图片数组以及动画
- const char *basePath = "/user/res/takephotos/cream/";
- const char *fileExtension = "bin";
- const char **imagePaths = CreateImagePathsArray(basePath, fileExtension, 50);
- InitImageAnimatorSource(creamAnimator, imagePaths, 50, 163, 103, 140, 140, "imageAnimator", 100);
+ creambasePath = "/user/res/takephotos/cream/";
+ creamimagePaths = CreateImagePathsArray(creambasePath.c_str(), 50);
+ InitImageAnimatorSource(creamAnimator, creamimagePaths, 50, 163, 103, 140, 140, "imageAnimator", 100);
creamView->Add(creamAnimator);
creamView->Add(labeltitle_);
buttontake->SetOnClickListener(static_cast<UIView::OnClickListener *>(TakephotosPresenter::GetInstance()));
// 初始化图片数组以及动画 {修改为统一动画}
- const char *basePath = "/user/res/takephotos/cream/";
- const char *fileExtension = "bin";
- const char **imagePaths = CreateImagePathsArray(basePath, fileExtension, 27);
- InitImageAnimatorSource(smileAnimator, imagePaths, 27, 163, 140, 140, 140, "imageAnimator", 100);
+ smilebasePath = "/user/res/takephotos/cream/";
+ smileimagePaths = CreateImagePathsArray(smilebasePath.c_str(), 27);
+ InitImageAnimatorSource(smileAnimator, smileimagePaths, 27, 163, 140, 140, 140, "imageAnimator", 100);
takeView->Add(smileAnimator);
takeView->Add(labeltake_);
\r
bool viewiInitStatus{false};\r
bool momentumFlag{false};\r
+\r
+ std::string winbasePath;\r
+ const char **winimagePaths;\r
};\r
} // namespace OHOS\r
#endif // TraingCard_PRESENTER_H\r
\r
TraingCardView::~TraingCardView()\r
{\r
+ FreeImagePathsArray(winimagePaths, 94);\r
DeInit();\r
+\r
g_pTraingCardView = nullptr;\r
DisableTimer(); // 关闭计时器\r
TraingModel::GetInstance()->SetTimestamp();\r
getView->Add(labeltag);\r
\r
// 初始化图片数组以及动画\r
- const char *basePath = "/user/res/Training/training_GIF/win/";\r
- const char *fileExtension = "bin";\r
- const char **imagePaths = CreateImagePathsArray(basePath, fileExtension, 94);\r
- InitImageAnimatorSource(imageAnimator, imagePaths, 94, 173, 100, 120, 120, "imageAnimator1", 10);\r
+ winbasePath = "/user/res/Training/training_GIF/win/";\r
+ winimagePaths = CreateImagePathsArray(winbasePath.c_str(), 94);\r
+ InitImageAnimatorSource(imageAnimator, winimagePaths, 94, 173, 100, 120, 120, "imageAnimator1", 10);\r
getView->Add(imageAnimator);\r
}\r
\r
std::string WindSpeedData; // 风速数据\r
std::string HumidityData; // 湿度数据\r
private:\r
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);\r
- void FreeImagePathsArray(const char **imagePaths, const int numImages);\r
UILabelExt *SetUpLabel(LabelConfig &labelconfig); // 设置标签\r
UILabelExt *SetUpLabelExt(LabelConfig &labelconfig);\r
bool WeatherReportViewLabelInit(void);\r
+/***
+ * @Date: 2024-08-19 11:01:42
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 19:24:56
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherView.h
+ */
/*
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 09:14:38
private:
UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight);
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
-
private:
void DumpWeatherInfo();
bool SetImageSource(UIImageView *image, const std::string &source);
+/***\r
+ * @Date: 2024-08-19 11:01:42\r
+ * @LastEditors: Caisking 3449750381@qq.com\r
+ * @LastEditTime: 2024-08-30 19:25:11\r
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp\r
+ */\r
#include "weather/include/WeatherReportView.h"\r
#include "wearable_log.h"\r
#include "weather/include/WeatherModel.h"\r
#include "common/image_cache_manager.h"\r
+#include "uicomponents/UIComponents.h"\r
namespace OHOS\r
{\r
static constexpr int16_t UV_IMAGE_ANIMATOR_VIEW_X = 53;\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherReportView::WeatherReportViewImageAnimatorViewInit");\r
\r
/* ----------------------------- UVImageAnimatorView---------------------------- */\r
- UVPathsArray = CreateImagePathsArray(UVPaths, "bin", UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);\r
+ UVPathsArray = CreateImagePathsArray(UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);\r
if (UVImageAnimatorView == nullptr)\r
{\r
UVImageAnimatorView = new UIImageAnimatorView();\r
UVImageAnimatorView->Start();\r
}\r
/* ----------------------- WindSpeedImageAnimatorView ----------------------- */\r
- WindSpeedPathsArray = CreateImagePathsArray(WindSpeedPaths, "bin", WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);\r
+ WindSpeedPathsArray = CreateImagePathsArray(WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);\r
if (WindSpeedImageAnimatorView == nullptr)\r
{\r
WindSpeedImageAnimatorView = new UIImageAnimatorView();\r
WindSpeedImageAnimatorView->Start();\r
}\r
/* ------------------------ HumidityImageAnimatorView ----------------------- */\r
- HumidityPathsArray = CreateImagePathsArray(HumidityPaths, "bin", HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);\r
+ HumidityPathsArray = CreateImagePathsArray(HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);\r
if (HumidityImageAnimatorView == nullptr)\r
{\r
HumidityImageAnimatorView = new UIImageAnimatorView();\r
return true;\r
}\r
\r
- const char **WeatherReportView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)\r
- {\r
- const char **imagePaths = new const char *[numImages];\r
- char buffer[256];\r
- for (int i = 0; i < numImages; i++)\r
- {\r
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);\r
- imagePaths[i] = strdup(buffer);\r
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);\r
- }\r
- return imagePaths;\r
- }\r
-\r
- /*\r
- * @brief: 释放图片路径数组指针\r
- * @param {char} imagePaths 图片路径数组\r
- * @param {int} numImages 图片数量\r
- */\r
- void WeatherReportView::FreeImagePathsArray(const char **imagePaths, const int numImages)\r
- {\r
- for (int i = 0; i < numImages; i++)\r
- {\r
- delete imagePaths[i];\r
- imagePaths[i] = nullptr;\r
- }\r
- }\r
\r
// 设置文本标签的通用函数\r
bool WeatherReportView::SetTextLabel(UILabel *label, const std::string &text)\r
return true;
}
- const char **WeatherView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
- {
- const char **imagePaths = new const char *[numImages];
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
-
- /*
- * @brief: 释放图片路径数组指针
- * @param {char} imagePaths 图片路径数组
- * @param {int} numImages 图片数量
- */
- void WeatherView::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
+
// 设置文本标签的通用函数
bool WeatherView::SetTextLabel(UILabel *label, const std::string &text)
{
{
public:
static PairingViewEventListener &GetInstance(void);
- const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages);
- void FreeImagePathsArray(const char **imagePaths, const int numImages);
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
void SetDeviceName(char *Name);
char *GetDeviceName();
}
- static void FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- // ImageCacheManager::GetInstance().UnloadSingleRes(imagePaths[i]);
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
- static const char ** CreateImagePathsArray_(const char *basePath, const char *fileExtension, int numImages)
- {
- const char **imagePaths = new const char *[numImages];
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
-
void ShowUpShutDownAnimatorView()
{
group = new UIViewGroup();
group->SetPosition(0, 0, 466, 466);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownAnimatorView::ShowUpShutDownAnimatorView");
- ShutDownPathsArray = CreateImagePathsArray_(ShutDownPaths, "bin", SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
if (ShutDownImageAnimatorView == nullptr)
{
#endif
-
#include <cmsis_os2.h>
#include <cmsis_os.h>
#include <ohos_types.h>
#include "iostream"
#include <broadcast_feature.h>
#include <custom_utils.h>
+#include "uicomponents/UIComponents.h"
namespace OHOS
{
{
PairingViewEventListener::GetInstance().Pairing_StopTimer();
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceBindingButtonCancel OnClick");
- // 终止当前的绑定流程并关闭相关的通知界面。
- #ifdef SUPPORT_BLE_SERVICE
+// 终止当前的绑定流程并关闭相关的通知界面。
+#ifdef SUPPORT_BLE_SERVICE
comfirmPaire(0);
- #endif
+#endif
NotificationManager::GetInstance()->StopNotify();
}
else if (&view == DeviceBindingButtonOK) // 设备绑定确认按钮
* 3.发送绑定请求到设备或服务器等.
*/
PairingViewEventListener::GetInstance().Pairing_StopTimer();
- // 关闭通知界面
- #ifdef SUPPORT_BLE_SERVICE
+// 关闭通知界面
+#ifdef SUPPORT_BLE_SERVICE
comfirmPaire(1);
- #endif
+#endif
NotificationManager::GetInstance()->StopNotify();
}
else if (&view == DeviceUnBindingButtonCancel) // 设备解绑取消按钮
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnBindingButtonCancel OnClick");
- // 不想执行解绑动作,并关闭解绑的通知界面。
- #ifdef SUPPORT_BLE_SERVICE
- cleanUnbindInfor(0);
- #endif
+// 不想执行解绑动作,并关闭解绑的通知界面。
+#ifdef SUPPORT_BLE_SERVICE
+ cleanUnbindInfor(0);
+#endif
NotificationManager::GetInstance()->StopNotify();
}
else if (&view == DeviceUnBindingButtonOK) // 设备解绑确认按钮
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnBindingButtonOK OnClick");
- /*
- * 可能会执行的解绑流程:
- * 1.通知设备或服务器执行解绑操作.
- * 2.从绑定设备列表移除设备.
- * 3.更新UI状态.
- */
+/*
+ * 可能会执行的解绑流程:
+ * 1.通知设备或服务器执行解绑操作.
+ * 2.从绑定设备列表移除设备.
+ * 3.更新UI状态.
+ */
- // 关闭通知界面
- #ifdef SUPPORT_BLE_SERVICE
- cleanUnbindInfor(1);
- #endif
+// 关闭通知界面
+#ifdef SUPPORT_BLE_SERVICE
+ cleanUnbindInfor(1);
+#endif
NotificationManager::GetInstance()->StopNotify();
}
else if (&view == DeviceUnbindingRequestButtonOK) // 设备解除绑定请求(与新设备连接)确认
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnbindingRequestButtonOK OnClick");
-
-
+
NotificationManager::GetInstance()->StopNotify();
}
- else if (&view == DeviceUnbindingRequestButtonCancel) //设备解除绑定请求(与新设备连接)取消
+ else if (&view == DeviceUnbindingRequestButtonCancel) // 设备解除绑定请求(与新设备连接)取消
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PairingViewEventListener:: DeviceUnbindingRequestButtonCancel OnClick");
NotificationManager::GetInstance()->StopNotify();
return true;
}
- const char **PairingViewEventListener::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
- {
- const char **imagePaths = new const char *[numImages];
- char buffer[256];
- for (int i = 0; i < numImages; i++)
- {
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
- imagePaths[i] = strdup(buffer);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]);
- }
- return imagePaths;
- }
- /*
- * @brief: 释放图片路径数组指针
- * @param {char} imagePaths 图片路径数组
- * @param {int} numImages 图片数量
- */
- void PairingViewEventListener::FreeImagePathsArray(const char **imagePaths, const int numImages)
- {
- for (int i = 0; i < numImages; i++)
- {
- delete imagePaths[i];
- imagePaths[i] = nullptr;
- }
- }
-
static UIButton *CreateButton(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const char *imageSrc)
{
UIButton *button = new UIButton();
void PairingViewEventListener::SetDeviceName(char *Name)
{
// printf("Name:%s\r\n",Name);
- memset(DeviceName,0,sizeof(DeviceName));
- if(Name == NULL)
+ memset(DeviceName, 0, sizeof(DeviceName));
+ if (Name == NULL)
{
- strcpy(DeviceName,"phone");
+ strcpy(DeviceName, "phone");
return;
}
int len = strlen(Name);
- if(len > sizeof(DeviceName))
+ if (len > sizeof(DeviceName))
len = sizeof(DeviceName);
- Name[len]='\0';
-
- memcpy(DeviceName,Name,len);
+ Name[len] = '\0';
+
+ memcpy(DeviceName, Name, len);
}
/*获取设备名称*/
char *PairingViewEventListener::GetDeviceName(void)
{
- return DeviceName; //先用固定字符串测试
+ return DeviceName; // 先用固定字符串测试
}
/*
DeviceBindingName->SetStyle(STYLE_TEXT_FONT, 30);
DeviceBindingName->SetStyle(STYLE_LINE_HEIGHT, 35);
- if(strlen(devanme)){
+ if (strlen(devanme))
+ {
DeviceBindingName->SetText(devanme);
- }else
+ }
+ else
{
DeviceBindingName->SetText(" ");
}
-
+
DeviceBindingName->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
DeviceBindingName->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
DeviceBindingName->SetRollSpeed(60);
DeviceBindingView->Add(DeviceBindingViewLabel);
DeviceBindingView->Add(DeviceBindingButtonCancel);
DeviceBindingView->Add(DeviceBindingButtonOK);
- #if NO_LCD_TEST_CONNECT
+#if NO_LCD_TEST_CONNECT
PairingViewEventListener::GetInstance().Pairing_StartTimer();
- #endif
+#endif
}
NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceBindingView);
DeviceUnBindingView->SetDraggable(true);
DeviceUnBindingView->SetTouchable(true);
/* ----------------------- DeviceUnBindingAnimatorView ---------------------- */
- UnBindPathsArray = PairingViewEventListener::GetInstance().CreateImagePathsArray("/user/res/remind/unbind/", "bin", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ UnBindPathsArray = CreateImagePathsArray("/user/res/remind/unbind/", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
if (DeviceUnBindingAnimatorView == nullptr)
{
DeviceUnBindingAnimatorView = new UIImageAnimatorView();
DeviceUnBindingName->SetStyle(STYLE_TEXT_FONT, 30);
DeviceUnBindingName->SetStyle(STYLE_LINE_HEIGHT, 35);
-
char *devanme = PairingViewEventListener::GetInstance().GetDeviceName();
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingName devanme :%s",devanme);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingName devanme :%s", devanme);
- if(strlen(devanme)){
+ if (strlen(devanme))
+ {
DeviceUnBindingName->SetText(devanme);
- }else
+ }
+ else
{
DeviceUnBindingName->SetText(" ");
}
DeviceUnBindingView->Add(DeviceUnBindingViewLabel);
DeviceUnBindingView->Add(DeviceUnBindingButtonCancel);
DeviceUnBindingView->Add(DeviceUnBindingButtonOK);
-
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateDeviceUnBindingView] DeviceUnBindingView new success!!");
NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDeviceUnBindingView);
DeviceUnbindingRequestViewLabel[0]->SetStyle(STYLE_LINE_HEIGHT, 40);
char str[512];
memset(str, 0, 512);
-
+
sprintf(str, "当前设备已经与 %s 绑定", PairingViewEventListener::GetInstance().GetDeviceName());
DeviceUnbindingRequestViewLabel[0]->SetText(str);
DeviceUnbindingRequestViewLabel[0]->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
delete DeviceUnBindingViewTitleLabel;
DeviceUnBindingViewTitleLabel = nullptr;
- PairingViewEventListener::GetInstance().FreeImagePathsArray(UnBindPathsArray, UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
-
+ FreeImagePathsArray(UnBindPathsArray, UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+
DeviceUnBindingAnimatorView->Stop();
delete DeviceUnBindingAnimatorView;
DeviceUnBindingAnimatorView = nullptr;
-
delete DeviceUnBindingName;
DeviceUnBindingName = nullptr;
-
delete DeviceUnBindingViewLabel;
DeviceUnBindingViewLabel = nullptr;
-
delete DeviceUnBindingButtonCancel;
DeviceUnBindingButtonCancel = nullptr;
-
delete DeviceUnBindingButtonOK;
DeviceUnBindingButtonOK = nullptr;
}
/* -------------------------------------------------------------------------- */
-
+
// 声明定时器变量
static osTimerId_t g_timer = NULL;
static void Pairing_TimerCallbackProc(int data)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Pairing_TimerCallbackProc");
- #ifdef SUPPORT_BLE_SERVICE
- #if NO_LCD_TEST_CONNECT
+#ifdef SUPPORT_BLE_SERVICE
+#if NO_LCD_TEST_CONNECT
comfirmPaire(1);
- #else
+#else
comfirmPaire(0);
- #endif
- #endif
- if( NotificationManager::GetInstance()->GetShowingNotifyId() == TOPIC_EVENT_DEVICE_BIND &&
+#endif
+#endif
+ if (NotificationManager::GetInstance()->GetShowingNotifyId() == TOPIC_EVENT_DEVICE_BIND &&
NotificationManager::GetInstance()->HasNotifyShowing() == true)
{
NotificationManager::GetInstance()->StopNotify();
}
-
+
PairingViewEventListener::GetInstance().Pairing_StopTimer();
}
-
+
/*
* @brief 回调函数
*/