+/*
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-01-02 11:23:34
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-01-11 10:08:21
+ * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp
+ * @Description:
+ *
+ * Copyright (c) 2024 by Caisking , All Rights Reserved.
+ */
#include "dial/include/Digital_clockView.h"
{
JosnfilePath = filePath;
}
+ /**
+ * @description: 加载json文件
+ * @param {string} &filePath
+ * @return {*}
+ */
bool loadJsonData(const std::string &filePath)
{
SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
g_pDigital_clockView = this;
}
-
Digital_clockView::~Digital_clockView()
{
DeInit();
g_pDigital_clockView = nullptr;
}
-
Digital_clockView *Digital_clockView::GetInstance()
{
return g_pDigital_clockView;
}
-
+ /**
+ * @description: 生成动画的资源路径数组
+ * @param {char} *basePath
+ * @param {char} *fileExtension
+ * @param {int} numImages
+ * @return {*}
+ */
const char **Digital_clockView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
{
const char **imagePaths = new const char *[numImages + 1]; // 多分配一个元素用于存储数组大小
imagePaths[numImages] = reinterpret_cast<const char *>(numImages); // 将数组大小信息存储在最后一个元素中
return imagePaths;
}
-
+ /**
+ * @description: 释放动画路径数组
+ * @param {char} *
+ * @return {*}
+ */
void Digital_clockView::FreeImagePathsArray(const char **imagePaths)
{
int numImages = reinterpret_cast<int>(imagePaths[-1]); // 从最后一个元素中获取数组大小
}
delete[] imagePaths;
}
-
+ /**
+ * @description: 判断路径是否为文件夹
+ * @param {string} &path
+ * @return {*}
+ */
bool isDirectory(const std::string &path)
{
if (!path.empty() && path.back() == '/')
}
return false; // 其他情况
}
-
+ /**
+ * @description: 初始化背景
+ * @return {*}
+ */
void Digital_clockView::Initbackground()
{
// 初始化背景
container_->Add(background);
background->SetVisible(true);
}
- /*初始化表盘时钟*/
- // Function to create and add an image view
+
+ /**
+ * @description: 初始化数字图片
+ * @param {int} left
+ * @param {int} top
+ * @param {char} *imagePath
+ * @param {char} *viewId
+ * @param {int} offsetX
+ * @param {int} offsetY
+ * @return {*}
+ */
void Digital_clockView::addImageView(int left, int top, const char *imagePath, const char *viewId, int offsetX, int offsetY)
{
UIImageView *imageView = new UIImageView();
container_->Add(imageView);
imageView->SetVisible(true);
}
+ /**
+ * @description: 初始化数字表盘
+ * @return {*}
+ */
void Digital_clockView ::Initdigit()
{
cJSON *background_cjson = cJSON_GetObjectItem(cjson_json, "background");
timeLableanimator_->Start();
}
}
+ /**
+ * @description: 初始化指针表盘
+ * @return {*}
+ */
void Digital_clockView::Initpointer()
{
cJSON *hands = cJSON_GetObjectItem(cjson_json, "hands");
container_->Add(sweepClock1_);
sweepClock1_->SetVisible(true);
}
-
+ /**
+ * @description: 获取格式化日期,根据不同的日期格式获取
+ * @param {string} &dateStr
+ * @param {string} &displayformat
+ * @return {*}
+ */
std::string FormatDate(const std::string &dateStr, const std::string &displayformat)
{
// 定义默认返回值
return formattedDate;
}
+ /**
+ * @description: 初始化日期
+ * @return {*}
+ */
void Digital_clockView ::Initdata()
{
// loadJsonData(JosnfilePath);
container_->Add(dateLable);
dateLable->SetVisible(true);
};
+ /**
+ * @description: 初始化星期
+ * @return {*}
+ */
void Digital_clockView ::Initweek()
{
// loadJsonData(JosnfilePath);
container_->Add(weekLable);
weekLable->SetVisible(true);
};
+ /**
+ * @description: 初始化电量
+ * @return {*}
+ */
void Digital_clockView ::Initbattery()
{
// loadJsonData(JosnfilePath);
progress1animator_ = new Animator(progress1callback_, progress, 10000, true);
progress1animator_->Start();
};
- /* InitView:初始化界面*/
+ /**
+ * @description: 初始化页面
+ * @return {*}
+ */
bool Digital_clockView ::InitView()
{
container_ = new UIViewGroup();