static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y = 0;
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_W = 466;
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 466;
- const char **ShutDownPathsArray{nullptr}; // 关机图片路径数组
+ const ImageInfo **ShutDownInfoArray{nullptr}; // 关机图片路径数组
ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
#define LOW_POWER_BUTTON "LOW_POWER_BUTTON"
#define CHARGE_GROUP "UIViewGroup_charge"
group->SetPosition(0, 0, 466, 466);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownAnimatorView::ShowUpShutDownAnimatorView");
- ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ ShutDownInfoArray = CreateImageInfoArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
if (ShutDownImageAnimatorView == nullptr)
{
for (uint8_t i = 0; i < SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
{
- ShutDownImageInfo[i].imagePath = (ShutDownPathsArray[i]);
- ShutDownImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ ShutDownImageInfo[i].imageInfo = (ShutDownInfoArray[i]);
+ ShutDownImageInfo[i].imageType = IMG_SRC_IMAGE_INFO;
ShutDownImageInfo[i].pos.x = SHUTDOWN_IMAGE_ANIMATOR_VIEW_X;
ShutDownImageInfo[i].pos.y = SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y;
ShutDownImageInfo[i].width = SHUTDOWN_IMAGE_ANIMATOR_VIEW_W;
delete ShutDownImageAnimatorView;
ShutDownImageAnimatorView = nullptr;
}
+ FreeImageInfoArray(ShutDownInfoArray,ShutDownPaths,SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
delete group;
group = nullptr;
}
- FreeImagePathsArray(ShutDownPathsArray,SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ //FreeImagePathsArray(ShutDownPathsArray,SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
RootView::GetInstance()->Remove(UIViewGroup_lowpower);
delete UIViewGroup_lowpower;
// #include "UiConfig.h"
#include "bleEvent.h"
#include "power_display_service.h"
+#include "uicomponents/UIComponents.h"
namespace OHOS
{
static UIImageView *imageCharge = nullptr;
static UIImageAnimatorView *downImageAnimatorView=nullptr;
- static constexpr char *ShutDownPaths = "/user/res/down/"; //关机图片路径
+ static constexpr char *ShutDownPaths = "/user/res/down/";
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 24; // 图片帧数
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔
- static ImageAnimatorInfo ImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
+ static ImageAnimatorInfo ImageInfo_animator[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_X = 183;
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y = 140;
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_W = 100;
static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 100;
- static const char **PathsArray{nullptr}; // 关机图片路径数组
+
+ const ImageInfo **imageInfo_dwon{nullptr}; // 关机图片路径数组
#define TRANSMITTING_SUCC_PATH PNG_SUCC_IMAGE;
#define TRANSMITTING_FAIL_PATH PNG_ATTENTION_IMAGE;
#define LOW_POWER_BUTTON "LOW_POWER_BUTTON"
- 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;
- }
+
static void CreatetransmittingAnimator(void)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownAnimatorView::ShowUpShutDownAnimatorView");
- PathsArray = CreateImagePathsArray(ShutDownPaths, "bin", SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ imageInfo_dwon = CreateImageInfoArray(ShutDownPaths,SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, "bin");
if (downImageAnimatorView == nullptr)
{
}
for (uint8_t i = 0; i < SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
{
- ImageInfo[i].imagePath = (PathsArray[i]);
- ImageInfo[i].imageType = IMG_SRC_FILE_PATH;
- ImageInfo[i].pos.x = SHUTDOWN_IMAGE_ANIMATOR_VIEW_X;
- ImageInfo[i].pos.y = SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y;
- ImageInfo[i].width = SHUTDOWN_IMAGE_ANIMATOR_VIEW_W;
- ImageInfo[i].height = SHUTDOWN_IMAGE_ANIMATOR_VIEW_H;
+ ImageInfo_animator[i].imageInfo = (imageInfo_dwon[i]);
+ ImageInfo_animator[i].imageType = IMG_SRC_IMAGE_INFO;
+ ImageInfo_animator[i].pos.x = SHUTDOWN_IMAGE_ANIMATOR_VIEW_X;
+ ImageInfo_animator[i].pos.y = SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y;
+ ImageInfo_animator[i].width = SHUTDOWN_IMAGE_ANIMATOR_VIEW_W;
+ ImageInfo_animator[i].height = SHUTDOWN_IMAGE_ANIMATOR_VIEW_H;
}
downImageAnimatorView->SetPosition(SHUTDOWN_IMAGE_ANIMATOR_VIEW_X, SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y, SHUTDOWN_IMAGE_ANIMATOR_VIEW_W, SHUTDOWN_IMAGE_ANIMATOR_VIEW_H);
downImageAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
downImageAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- downImageAnimatorView->SetImageAnimatorSrc(ImageInfo, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, 100);
+ downImageAnimatorView->SetImageAnimatorSrc(ImageInfo_animator, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, 100);
downImageAnimatorView->SetRepeat(true);
downImageAnimatorView->SetRepeatTimes(1);
}
if(downImageAnimatorView)
{
+ FreeImageInfoArray(imageInfo_dwon,ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES,"bin");
delete downImageAnimatorView;
downImageAnimatorView = nullptr;
}