mcu_hi3321_watch/tjd/ui/app/lucky_clover/TjdUiAppLuckyCloverView.cpp
2025-05-26 20:15:20 +08:00

2008 lines
85 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description:
*
* Author: wuchangxin
*
* Create: 2024-7-3
*--------------------------------------------------------------------------*/
#include "TjdUiAppLuckyCloverView.h"
#include "TjdUiAppLuckyCloverModel.h"
#include "TjdUiImageIds.h"
#include "TjdUiMemManage.h"
#include "TjdUiMultiLanguageExt.h"
#include "ble_api.h"
#include "ble_port_protocol.h"
#include "common/image_cache_manager.h"
#include "dock/input_device.h"
#include "graphic_service.h"
#include "notification_manager.h"
#include "sql_fit.h"
#include "sys_config.h"
#include "wearable_log.h"
#include <sched.h>
#include <stdio.h>
#include <string>
using namespace OHOS;
#define ENABLE_PRINT_INFO 1
#if ENABLE_PRINT_INFO
#define static_print_info(...) sys_ui_log_i(__VA_ARGS__) // 一般信息打印宏控制
#define static_print_warn(...) sys_ui_log_w(__VA_ARGS__) // 警告信息打印一般常开
#define static_print_error(...) sys_ui_log_e(__VA_ARGS__) // 错误信息打印一般常开
#else
#define static_print_info(...)
#define static_print_warn(...)
#define static_print_error(...)
#endif
#define PIVOT_X 0 // 缩放中心点x
#define PIVOT_Y 0 // 缩放中心点y
#define IMAGE_WIDTH 157 // 背景图片宽度
#define IMAGE_HEIGHT 157 // 背景图片高度
namespace TJD {
#define IMAGE_LUCKY_CLOVER_BIN_PATH TJD_IMAGE_PATH "img_lucky_clover.bin"
#define NO_CONNECT_BIN_PATH TJD_IMAGE_PATH "img_no_connect.bin"
static TjdUiAppLuckyCloverView *g_pv_AppLuckyCloverView = nullptr;
static OHOS::GraphicTimer *dataSynchronizationTimer_ = nullptr; // 数据同步中定时器
static OHOS::GraphicTimer *luckyCloverPopupTimer_ = nullptr; // 弹窗定时器
static inline int16_t HorizontalCenter(int16_t width, int16_t parentWidth) { return (parentWidth - width) / 2; }
static void InitLabelHorCenter(OHOS::UILabel &label, uint8_t size, int16_t y, int16_t target, const char *text)
{
label.SetFont(TJD_VECTOR_FONT_FILENAME, size);
label.SetText(text);
label.SetLineBreakMode(OHOS::UILabel::LINE_BREAK_ADAPT);
label.SetAlign(OHOS::TEXT_ALIGNMENT_CENTER, OHOS::TEXT_ALIGNMENT_CENTER);
label.SetPosition(HorizontalCenter(label.GetWidth(), target), y);
}
static void InitLabel(OHOS::UILabel &label, uint8_t size, int16_t x, int16_t y, const char *text)
{
label.SetFont(TJD_VECTOR_FONT_FILENAME, size);
label.SetText(text);
label.SetLineBreakMode(OHOS::UILabel::LINE_BREAK_ADAPT);
label.SetAlign(OHOS::TEXT_ALIGNMENT_CENTER, OHOS::TEXT_ALIGNMENT_CENTER);
label.SetPosition(x, y);
}
static void LabelAutoAlignCenter(OHOS::UILabel &label) // default screen center/466
{
uint8_t x = HorizontalCenter(label.GetWidth(), OHOS::HORIZONTAL_RESOLUTION);
label.SetX(x);
}
static void AdjustLabelPosition(OHOS::UILabel *label1, OHOS::UILabel *label2)
{
uint16_t x1 = label1->GetX();
uint16_t width1 = label1->GetWidth();
label2->SetX(x1 + width1 + 3);
}
static void DataSynchronizationTimerCallBack(void *arg)
{
static_print_info("DataSynchronizationTimerCallBack\n");
GraphicService::GetInstance()->PostGraphicEvent(std::bind(
[](void *arg) {
TjdUiAppLuckyCloverView *luckyCloverView = static_cast<TjdUiAppLuckyCloverView *>(arg);
static uint8_t count = 0;
lucky_clover_t lucky_clover_info = TjdUiAppLuckyCloverModel::GetInstance()->get_lucky_clover_info();
if (count == 5) {
count = 0;
dataSynchronizationTimer_->Stop();
luckyCloverView->GetDataSynchronizationLabel()->SetVisible(false);
luckyCloverView->GetImageRefresh()->SetVisible(false);
luckyCloverView->DataRefresh(lucky_clover_info);
}
count++;
},
arg));
}
StandProgress::StandProgress(OHOS::ImageInfo *image)
{
Resize(320, 26);
for (int i = 0; i < STEP_PROGRESS_NUM; i++) {
image_[i].SetPosition(0 + i * 18, 0);
image_[i].SetSrc(image);
Add(&image_[i]);
}
}
void StandProgress::SetSrcImage(OHOS::ImageInfo *foregroundImage, OHOS::ImageInfo *backgroundImage)
{
OHOS::ImageInfo *foregroundImage_ = foregroundImage;
OHOS::ImageInfo *backgroundImage_ = backgroundImage;
}
void StandProgress::SetProgress(uint32_t currentValue, uint32_t totalValue)
{
float percent = 0;
auto foregroundImage_ =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_DARK, IMAGE_LUCKY_CLOVER_BIN_PATH);
auto backgroundImage_ =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_BRIGHT, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (totalValue) {
percent = (float)(currentValue) / (float)totalValue;
} else
percent = 0.0f;
for (int i = 0; i < STEP_PROGRESS_NUM; i++) {
if (i < STEP_PROGRESS_NUM * percent) {
image_[i].SetSrc(backgroundImage_);
} else {
image_[i].SetSrc(foregroundImage_);
}
}
Invalidate();
}
bool LuckyCloverUIScrollView::OnDragStartEvent(const OHOS::DragEvent &event)
{
// if (TjdUiAppPlayerView::GetInstance()->GetCurrentView() != PlayerViewIndex::PLAYER_VIEW) {
// return true;
// }
isOnStart_ = true;
return OHOS::UIScrollViewNested::OnDragStartEvent(event);
}
bool LuckyCloverUIScrollView::OnDragEvent(const OHOS::DragEvent &event)
{
if (!isOnStart_) {
return true;
}
// if (TjdUiAppPlayerView::GetInstance()->GetCurrentView() != PlayerViewIndex::PLAYER_VIEW) {
// return true;
// }
return OHOS::UIScrollViewNested::OnDragEvent(event);
}
bool LuckyCloverUIScrollView::OnDragEndEvent(const OHOS::DragEvent &event)
{
if (!isOnStart_) {
return true;
}
isOnStart_ = false;
// if (TjdUiAppPlayerView::GetInstance()->GetCurrentView() != PlayerViewIndex::PLAYER_VIEW) {
// return true;
// }
return OHOS::UIScrollViewNested::OnDragEndEvent(event);
}
TjdUiAppLuckyCloverView::TjdUiAppLuckyCloverView()
{
uint8_t pack_head = 0x5B;
tjd_ble_protocol_send_lefun_data(&pack_head, NULL, 0, REQUEST_LUCKY_CLOVER_DATA);
g_pv_AppLuckyCloverView = this;
}
TjdUiAppLuckyCloverView::~TjdUiAppLuckyCloverView()
{
g_pv_AppLuckyCloverView = nullptr;
ImageCacheManager::GetInstance().UnloadAllInMultiRes(IMAGE_LUCKY_CLOVER_BIN_PATH);
TjdUiMemManage::DeleteChildren(allContainer_);
}
TjdUiAppLuckyCloverView *TjdUiAppLuckyCloverView::GetInstance(void) { return g_pv_AppLuckyCloverView; }
void TjdUiAppLuckyCloverView::OnStart()
{
View<TjdUiAppLuckyCloverPresenter>::OnStart();
if (allContainer_ == nullptr) {
allContainer_ = new UIScrollView();
}
allContainer_->SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
allContainer_->SetViewId("allContainer_");
allContainer_->SetStyle(STYLE_BACKGROUND_OPA, 0);
allContainer_->SetOnDragListener(TjdUiAppLuckyCloverPresenter::GetInstance());
allContainer_->Add(MainPageInit());
allContainer_->Add(DataPageInit());
lucky_clover_t lucky_clover_info = TjdUiAppLuckyCloverModel::GetInstance()->get_lucky_clover_info();
DataRefresh(lucky_clover_info);
mainPage_->SetVisible(false);
dataPage_->SetVisible(false);
// allContainer_->Add(new GSensor_RemindWindow(TjdUiAppLuckyCloverModel::GetInstance()->get_lucky_clover_info()));
allContainer_->Add(BtNoConnectedViewInit());
BtNoConnectedView_->SetVisible(false);
if (tjd_get_ble_is_connect()) {
BtNoConnectedView_->SetVisible(false);
mainPage_->SetVisible(true);
if (dataSynchronizationTimer_ == nullptr) {
TjdUiAppLuckyCloverView *luckyCloverView = TjdUiAppLuckyCloverView::GetInstance();
dataSynchronizationTimer_ =
new OHOS::GraphicTimer(200, DataSynchronizationTimerCallBack, (void *)luckyCloverView, true);
}
dataSynchronizationTimer_->Start();
} else {
allContainer_->Remove(mainPage_);
allContainer_->Remove(dataPage_);
BtNoConnectedView_->SetVisible(true);
mainPage_->SetVisible(false);
TjdUiAppLuckyCloverPresenter::GetInstance()->StartJumpTimer();
}
AddViewToRootContainer(allContainer_);
}
void TjdUiAppLuckyCloverView::OnStop()
{
printf("TjdUiAppLuckyCloverView::OnStop\n");
if (dataSynchronizationTimer_ != nullptr) {
dataSynchronizationTimer_->Stop();
delete dataSynchronizationTimer_;
dataSynchronizationTimer_ = nullptr;
}
if (dataPage_ && standProgress_) {
dataPage_->Remove(standProgress_);
delete standProgress_;
standProgress_ = nullptr;
}
}
OHOS::UIViewGroup *TjdUiAppLuckyCloverView::BtNoConnectedViewInit(void)
{
if (BtNoConnectedView_ == nullptr) {
BtNoConnectedView_ = new UIViewGroup();
BtNoConnectedView_->SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
BtNoConnectedView_->SetViewId("BtNoConnectedView_");
BtNoConnectedView_->SetStyle(STYLE_BACKGROUND_OPA, 0);
}
/*-----------------------------Add imgNoConnected_ to App------------------------------*/
if (imgNoConnected_ == nullptr) {
imgNoConnected_ = new UIImageView();
}
imgNoConnected_->SetPosition(80, 145);
imgNoConnected_->SetViewId("imgNoConnected_");
ImageInfo *imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_NO_CONNECT_NO_CONNECT, NO_CONNECT_BIN_PATH);
if (imgInfo == nullptr) {
static_print_info("IMG_NO_CONNECT_NO_CONNECT load image error\n");
return nullptr;
}
imgNoConnected_->SetSrc(imgInfo);
BtNoConnectedView_->Add(imgNoConnected_);
/*-----------------------------Add labelNoConnected__ to App------------------------------*/
if (labelNoConnected__ == nullptr) {
labelNoConnected__ = new UILabelExt();
}
labelNoConnected__->SetViewId("labelNoConnected__"); // Set style
labelNoConnected__->SetStyle(STYLE_TEXT_FONT, 28);
// Set additional property
labelNoConnected__->SetPosition(80, 308, 291, 47);
labelNoConnected__->SetFont(TJD_VECTOR_FONT_FILENAME, 28);
// labelNoConnected__->SetText("请连接APP");
labelNoConnected__->SetTextId(STR_ID_557);
labelNoConnected__->SetLineBreakMode(OHOS::UILabel::LINE_BREAK_WRAP);
labelNoConnected__->SetAlign(OHOS::TEXT_ALIGNMENT_CENTER, OHOS::TEXT_ALIGNMENT_CENTER);
// Add to rootView
BtNoConnectedView_->Add(labelNoConnected__);
labelNoConnected__->SetVisible(true);
// allContainer_->Add(BtNoConnectedView_);
return BtNoConnectedView_;
}
OHOS::UIScrollView *TjdUiAppLuckyCloverView::MainPageInit(void)
{
if (mainPage_ == nullptr) {
mainPage_ = new UIScrollView();
mainPage_->SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
mainPage_->SetViewId("mainPage_");
mainPage_->SetStyle(STYLE_BACKGROUND_OPA, 0);
mainPage_->SetOnDragListener(TjdUiAppLuckyCloverPresenter::GetInstance());
}
/*-----------------------------Add imageStandBackgroud_ to App------------------------------*/
if (imageStandBackgroud_ == nullptr) {
imageStandBackgroud_ = new UIImageView();
}
imageStandBackgroud_->SetPosition(75, 56); // widget's left position and top position
imageStandBackgroud_->Resize(157, 157); // widget's width and height
imageStandBackgroud_->SetViewId("imageStandBackgroud_"); // Set style
// Set additional property
ImageInfo *imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_01_01, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("IMG_LUCKY_CLOVER_01_01 load image error ");
return nullptr;
}
imageStandBackgroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageStandBackgroud_);
imageStandBackgroud_->SetVisible(true);
/*-----------------------------Add imageStandForegroud_ to App------------------------------*/
if (imageStandForegroud_ == nullptr) {
imageStandForegroud_ = new UIImageView();
}
imageStandForegroud_->SetPosition(75, 56); // widget's left position and top position
imageStandForegroud_->Resize(157, 157); // widget's width and height
imageStandForegroud_->SetViewId("imageStandForegroud_"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_01_10, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("IMG_LUCKY_CLOVER_01_10 load image error ");
return nullptr;
}
imageStandForegroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageStandForegroud_);
imageStandForegroud_->SetVisible(true);
/*-----------------------------Add imageKcalBackgroud_ to App------------------------------*/
if (imageKcalBackgroud_ == nullptr) {
imageKcalBackgroud_ = new UIImageView();
}
imageKcalBackgroud_->SetPosition(236, 56); // widget's left position and top position
imageKcalBackgroud_->Resize(157, 157); // widget's width and height
imageKcalBackgroud_->SetViewId("imageKcalBackgroud_"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_02_01, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageKcalBackgroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageKcalBackgroud_);
imageKcalBackgroud_->SetVisible(true);
/*-----------------------------Add imageKcalForegroud_ to App------------------------------*/
if (imageKcalForegroud_ == nullptr) {
imageKcalForegroud_ = new UIImageView();
}
imageKcalForegroud_->SetPosition(236, 56); // widget's left position and top position
imageKcalForegroud_->Resize(157, 157); // widget's width and height
imageKcalForegroud_->SetViewId("imageKcalForegroud_"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_02_10, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageKcalForegroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageKcalForegroud_);
imageKcalForegroud_->SetVisible(true);
/*-----------------------------Add imageStrengthBackgroud_ to App------------------------------*/
if (imageStrengthBackgroud_ == nullptr) {
imageStrengthBackgroud_ = new UIImageView();
}
imageStrengthBackgroud_->SetPosition(75, 217); // widget's left position and top position
imageStrengthBackgroud_->Resize(157, 157); // widget's width and height
imageStrengthBackgroud_->SetViewId("imageStrengthBackgroud_"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_03_01, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStrengthBackgroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageStrengthBackgroud_);
imageStrengthBackgroud_->SetVisible(true);
/*-----------------------------Add imageStrengthForegroud_ to App------------------------------*/
if (imageStrengthForegroud_ == nullptr) {
imageStrengthForegroud_ = new UIImageView();
}
imageStrengthForegroud_->SetPosition(75, 217); // widget's left position and top position
imageStrengthForegroud_->Resize(157, 157); // widget's width and height
imageStrengthForegroud_->SetViewId("imageStrengthForegroud_"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_03_10, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStrengthForegroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageStrengthForegroud_);
imageStrengthForegroud_->SetVisible(true);
/*-----------------------------Add imageStepBackgroud_ to App------------------------------*/
if (imageStepBackgroud_ == nullptr) {
imageStepBackgroud_ = new UIImageView();
}
imageStepBackgroud_->SetPosition(236, 217); // widget's left position and top position
imageStepBackgroud_->Resize(157, 157); // widget's width and height
imageStepBackgroud_->SetViewId("image4"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_04_01, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStepBackgroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageStepBackgroud_);
imageStepBackgroud_->SetVisible(true);
/*-----------------------------Add imageStepForegroud_ to App------------------------------*/
if (imageStepForegroud_ == nullptr) {
imageStepForegroud_ = new UIImageView();
}
imageStepForegroud_->SetPosition(236, 217); // widget's left position and top position
imageStepForegroud_->Resize(157, 157); // widget's width and height
imageStepForegroud_->SetViewId("image4"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_04_10, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStepForegroud_->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(imageStepForegroud_);
imageStepForegroud_->SetVisible(true);
/*-----------------------------Add label1_ to App------------------------------*/
if (label1_ == nullptr) {
label1_ = new UILabelExt();
}
label1_->SetPosition(160, 14); // widget's left position and top position
label1_->Resize(122, 34); // widget's width and height
label1_->SetViewId("title"); // Set style
// Set additional property
// label1_->SetText("数据同步中");
label1_->SetTextId(STR_ID_341);
label1_->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
label1_->SetRollSpeed(0);
label1_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_24);
// Add to rootView
mainPage_->Add(label1_);
label1_->SetVisible(true);
/*-----------------------------Add label2_ to App------------------------------*/
if (label2_ == nullptr) {
label2_ = new UILabelExt();
}
label2_->SetPosition(141, 389); // widget's left position and top position
label2_->Resize(190, 40); // widget's width and height
label2_->SetViewId("label2_"); // Set style
label2_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_34);
label2_->SetTextId(STR_ID_360);
// Set additional property
std::string lbtext = std::string(FontGlobalManager::GetInstance()->GetText(STR_ID_360));
char text[100] = {0};
sprintf(text, "%s%d/%d", lbtext.c_str(), 0, 0);
label2_->SetText(text);
label2_->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
label2_->SetRollSpeed(0);
label2_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_28);
// Add to rootView
mainPage_->Add(label2_);
label2_->SetVisible(true);
/*-----------------------------Add image_refresh to App------------------------------*/
image_refresh = new UIImageView();
image_refresh->SetPosition(283, 20); // widget's left position and top position
image_refresh->Resize(20, 22); // widget's width and height
image_refresh->SetViewId("image_refresh"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_REFRESH, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
image_refresh->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(image_refresh);
image_refresh->SetVisible(true);
/*-----------------------------Add image_stand to App------------------------------*/
if (image_stand == nullptr) {
image_stand = new UIImageView();
}
image_stand->SetPosition(167, 148); // widget's left position and top position
image_stand->Resize(58, 58); // widget's width and height
image_stand->SetViewId("image_stand"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STAND, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
image_stand->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(image_stand);
image_stand->SetVisible(true);
/*-----------------------------Add image_kcal to App------------------------------*/
if (image_kcal == nullptr) {
image_kcal = new UIImageView();
}
image_kcal->SetPosition(243, 148); // widget's left position and top position
image_kcal->Resize(58, 58); // widget's width and height
image_kcal->SetViewId("image_kcal"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_KCAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
image_kcal->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(image_kcal);
image_kcal->SetVisible(true);
/*-----------------------------Add image_strength to App------------------------------*/
if (image_strength == nullptr) {
image_strength = new UIImageView();
}
image_strength->SetPosition(167, 224); // widget's left position and top position
image_strength->Resize(58, 58); // widget's width and height
image_strength->SetViewId("image_strength"); // Set style
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STRENGTH, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
image_strength->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(image_strength);
image_strength->SetVisible(true);
/*-----------------------------Add image_step to App------------------------------*/
if (image_step == nullptr) {
image_step = new UIImageView();
}
image_step->SetPosition(244, 224); // widget's left position and top position
image_step->Resize(58, 58); // widget's width and height
image_step->SetViewId("image_step"); // Set style
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STEP, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
image_step->SetSrc(imgInfo);
// Add to rootView
mainPage_->Add(image_step);
image_step->SetVisible(true);
return mainPage_;
}
OHOS::UIScrollView *TjdUiAppLuckyCloverView::DataPageInit(void)
{
if (dataPage_ == nullptr) {
dataPage_ = new UIScrollView();
}
dataPage_->SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, 2380);
dataPage_->SetViewId("dataPage_");
dataPage_->SetStyle(STYLE_BACKGROUND_OPA, 0);
dataPage_->SetOnDragListener(TjdUiAppLuckyCloverPresenter::GetInstance());
/*-----------------------------Add imageSuccess to App------------------------------*/
if (imageStandCal_ == nullptr) {
imageStandCal_ = new UIImageView();
}
imageStandCal_->SetPosition(162, 103); // widget's left position and top position
imageStandCal_->Resize(16, 38); // widget's width and height
imageStandCal_->SetViewId("imageStandCal_"); // Set style
// Set additional property
ImageInfo *imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STAND_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStandCal_->SetSrc(imgInfo);
// Add to rootView
dataPage_->Add(imageStandCal_);
imageStandCal_->SetVisible(true);
/*-----------------------------Add labelActivity to App------------------------------*/
if (labelActivityStand_ == nullptr) {
labelActivityStand_ = new UILabelExt();
}
labelActivityStand_->SetPosition(189, 105); // widget's left position and top position
labelActivityStand_->Resize(117, 28); // widget's width and height
labelActivityStand_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
labelActivityStand_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Set additional property
// labelActivityStand_->SetText("站立活动");
labelActivityStand_->SetTextId(STR_ID_342);
labelActivityStand_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityStand_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityStand_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelActivityStand_);
labelActivityStand_->SetVisible(true);
auto foregroundImage =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_DARK, IMAGE_LUCKY_CLOVER_BIN_PATH);
auto backgroundImage =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_BRIGHT, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (standProgress_ == nullptr) {
standProgress_ = new StandProgress(foregroundImage);
}
standProgress_->SetPosition(77, 160);
standProgress_->SetSrcImage(foregroundImage, backgroundImage);
dataPage_->Add(standProgress_);
/*-----------------------------Add labelGoals to App------------------------------*/
if (labelGoalsStand_ == nullptr) {
labelGoalsStand_ = new UILabel();
}
labelGoalsStand_->SetPosition(232, 207, 26, 27); // widget's left position and top position
// Set additional property
labelGoalsStand_->SetText("/6");
labelGoalsStand_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsStand_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelGoalsStand_->SetRollSpeed(0);
labelGoalsStand_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelGoalsStand_);
labelGoalsStand_->SetVisible(true);
if (labelCurStand_ == nullptr) {
labelCurStand_ = new UILabel();
}
labelCurStand_->SetPosition(202, 195, 24, 36); // widget's left position and top position
// Set additional property
labelCurStand_->SetText("4");
labelCurStand_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurStand_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
labelCurStand_->SetRollSpeed(0);
labelCurStand_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurStand_->SetStyle(STYLE_TEXT_COLOR, 0xFF00FB9D);
// Add to rootView
dataPage_->Add(labelCurStand_);
// /*-----------------------------Add imageSuccess to App------------------------------*/
if (imageCalCal_ == nullptr) {
imageCalCal_ = new UIImageView();
}
imageCalCal_->SetPosition(148, 297); // widget's left position and top position
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CAL_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageCalCal_->SetSrc(imgInfo);
// Add to rootView
dataPage_->Add(imageCalCal_);
imageCalCal_->SetVisible(true);
/*-----------------------------Add labelActivity to App------------------------------*/
if (labelActivityCal_ == nullptr) {
labelActivityCal_ = new UILabelExt();
}
labelActivityCal_->SetPosition(189, 291); // widget's left position and top position
labelActivityCal_->Resize(117, 28); // widget's width and height
labelActivityCal_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelActivityCal_->SetText("活动热量");
labelActivityCal_->SetTextId(STR_ID_343);
labelActivityCal_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityCal_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityCal_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityCal_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
dataPage_->Add(labelActivityCal_);
labelActivityCal_->SetVisible(true);
if (imageCalProgress_ == nullptr) {
imageCalProgress_ = new UIImageView();
}
imageCalProgress_->SetPosition(120, 341); // widget's left position and top position
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_PROGRESS_01, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageCalProgress_->SetSrc(imgInfo);
// Add to rootView
dataPage_->Add(imageCalProgress_);
imageCalProgress_->SetVisible(true);
/*-----------------------------Add labelGoals to App------------------------------*/
if (labelGoalsCal == nullptr) {
labelGoalsCal = new UILabelExt();
}
labelGoalsCal->SetPosition(213, 486, 119, 28); // widget's left position and top position
labelGoalsCal->Resize(154, 26); // widget's width and height
labelGoalsCal->SetViewId("labelGoalsCal"); // Set style
labelGoalsCal->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelGoalsCal->SetText("/200千卡");
labelGoalsCal->SetTextId(STR_ID_576);
labelGoalsCal->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsCal->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelGoalsCal->SetRollSpeed(0);
labelGoalsCal->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelGoalsCal);
labelGoalsCal->SetVisible(true);
if (labelCurCal_ == nullptr) {
labelCurCal_ = new UILabel();
}
labelCurCal_->SetPosition(134, 472, 74, 36); // widget's left position and top position
// Set additional property
labelCurCal_->SetText("200");
labelCurCal_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurCal_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
labelCurCal_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurCal_->SetStyle(STYLE_TEXT_COLOR, 0xFFFFD800);
// Add to rootView
dataPage_->Add(labelCurCal_);
/*-----------------------------Add imageSuccess to App------------------------------*/
if (imageStrengthCal_ == nullptr) {
imageStrengthCal_ = new UIImageView();
}
imageStrengthCal_->SetPosition(147, 562); // widget's left position and top position
imageStrengthCal_->Resize(33, 33); // widget's width and height
imageStrengthCal_->SetViewId("imageStrengthCal_"); // Set style
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STRENGTH_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStrengthCal_->SetSrc(imgInfo);
// Add to rootView
dataPage_->Add(imageStrengthCal_);
imageStrengthCal_->SetVisible(true);
/*-----------------------------Add labelActivity to App------------------------------*/
if (labelActivityStrength_ == nullptr) {
labelActivityStrength_ = new UILabelExt();
}
labelActivityStrength_->SetPosition(190, 556); // widget's left position and top position
labelActivityStrength_->Resize(130, 42); // widget's width and height
labelActivityStrength_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelActivityStrength_->SetText("中高强度");
labelActivityStrength_->SetTextId(STR_ID_231);
labelActivityStrength_->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
labelActivityStrength_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityStrength_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityStrength_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
dataPage_->Add(labelActivityStrength_);
labelActivityStrength_->SetVisible(true);
// Add CircleProgress to App
if (ProgressStrength_ == nullptr) {
ProgressStrength_ = new UICircleProgress();
}
ProgressStrength_->SetPosition(0, 550); // widget's left position and top position
ProgressStrength_->Resize(466, 466); // widget's width and height
ProgressStrength_->SetBackgroundStyle(STYLE_LINE_WIDTH, 326);
ProgressStrength_->SetForegroundStyle(STYLE_LINE_WIDTH, 326);
auto foreImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CAL_BAR_FG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
auto bgImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CAL_BAR_BG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
ProgressStrength_->SetImage(foreImage, bgImage);
ProgressStrength_->SetCenterPosition(233, 233);
ProgressStrength_->SetRadius(233);
ProgressStrength_->SetStartAngle(-60);
ProgressStrength_->SetEndAngle(60);
ProgressStrength_->SetProgressImagePosition(70, 70);
ProgressStrength_->SetBackgroundImagePosition(70, 70);
ProgressStrength_->SetValue(30);
dataPage_->Add(ProgressStrength_);
ProgressStrength_->SetVisible(true);
/*-----------------------------Add labelGoals to App------------------------------*/
if (labelGoalsStrength_ == nullptr) {
labelGoalsStrength_ = new UILabelExt();
}
labelGoalsStrength_->SetPosition(217, 683, 95, 26); // widget's left position and top position
labelGoalsStrength_->SetViewId("labelGoalsStrength_"); // Set style
labelGoalsStrength_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
labelGoalsStrength_->SetTextId(STR_ID_129);
// Set additional property
// labelGoalsStrength_->SetText("/35分钟");
labelGoalsStrength_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsStrength_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelGoalsStrength_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelGoalsStrength_);
labelGoalsStrength_->SetVisible(true);
if (labelCurStrgength_ == nullptr) {
labelCurStrgength_ = new UILabel();
}
labelCurStrgength_->SetPosition(164, 671, 48, 36); // widget's left position and top position
// Set additional property
labelCurStrgength_->SetText("20");
labelCurStrgength_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurStrgength_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
labelCurStrgength_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurStrgength_->SetStyle(STYLE_TEXT_COLOR, 0xFFFF584B);
// Add to rootView
dataPage_->Add(labelCurStrgength_);
/*-----------------------------Add imageSuccess to App------------------------------*/
if (imageStep_ == nullptr) {
imageStep_ = new UIImageView();
}
imageStep_->SetPosition(176, 794); // widget's left position and top position
imageStep_->SetViewId("imageStep_"); // Set style
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STEP_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStep_->SetSrc(imgInfo);
// Add to rootView
dataPage_->Add(imageStep_);
imageStep_->SetVisible(true);
/*-----------------------------Add labelActivity to App------------------------------*/
if (labelActivityStep_ == nullptr) {
labelActivityStep_ = new UILabelExt();
}
labelActivityStep_->SetPosition(215, 790); // widget's left position and top position
labelActivityStep_->Resize(58, 28); // widget's width and height
labelActivityStep_->SetViewId("labelActivityStep_"); // Set style
labelActivityStep_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
labelActivityStep_->SetTextId(STR_ID_204);
// labelActivityStep_->SetText("步数");
labelActivityStep_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityStep_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityStep_->SetRollSpeed(0);
labelActivityStep_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityStep_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
dataPage_->Add(labelActivityStep_);
labelActivityStep_->SetVisible(true);
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STEP_PROGRESS_BG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imageSliderBg_ == nullptr) {
imageSliderBg_ = new UIImageView();
}
imageSliderBg_->SetPosition(53, 846); // widget's left position and top position
imageSliderBg_->SetSrc(imgInfo); // widget's width and height
dataPage_->Add(imageSliderBg_);
if (sliderStep_ == nullptr) {
sliderStep_ = new UISlider();
}
sliderStep_->SetPosition(58, 850); // widget's left position and top position
sliderStep_->Resize(350, 10); // widget's width and height
sliderStep_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
sliderStep_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
// Set additional property
sliderStep_->SetValidWidth(350);
sliderStep_->SetValidHeight(10);
sliderStep_->SetValue(20);
sliderStep_->SetSliderColor(Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0xff),
Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0xff));
sliderStep_->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff);
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STEP_PROGRESS_FG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
sliderStep_->SetImage(nullptr, imgInfo);
// Add to rootView
dataPage_->Add(sliderStep_);
/*-----------------------------Add labelGoals to App------------------------------*/
if (labelGoalsStep_ == nullptr) {
labelGoalsStep_ = new UILabelExt();
}
labelGoalsStep_->SetPosition(240, 895); // widget's left position and top position
labelGoalsStep_->Resize(120, 29); // widget's width and height
labelGoalsStep_->SetViewId("labelGoalsStep_"); // Set style
labelGoalsStep_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
labelGoalsStep_->SetTextId(STR_ID_547);
// labelGoalsStep_->SetText("/2000步");
labelGoalsStep_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsStep_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelGoalsStep_->SetRollSpeed(0);
labelGoalsStep_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelGoalsStep_);
labelGoalsStep_->SetVisible(true);
if (labelCurStep_ == nullptr) {
labelCurStep_ = new UILabel();
}
labelCurStep_->SetPosition(107, 884, 125, 36); // widget's left position and top position
// Set additional property
labelCurStep_->SetText("18000");
labelCurStep_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurStep_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
labelCurStep_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurStep_->SetStyle(STYLE_TEXT_COLOR, 0xFF0084FF);
// Add to rootView
dataPage_->Add(labelCurStep_);
/*-----------------------------Add imageSuccess to App------------------------------*/
if (imageWater_ == nullptr) {
imageWater_ = new UIImageView();
}
imageWater_->SetPosition(162, 1021); // widget's left position and top position
imageWater_->SetViewId("imageWater_"); // Set style
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_WATER_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageWater_->SetSrc(imgInfo);
// Add to rootView
dataPage_->Add(imageWater_);
imageWater_->SetVisible(true);
/*-----------------------------Add labelActivity to App-*/
if (labelActivityWater_ == nullptr) {
labelActivityWater_ = new UILabelExt();
}
labelActivityWater_->SetPosition(190, 1015); // widget's left position and top position
labelActivityWater_->Resize(116, 29); // widget's width and height
labelActivityWater_->SetViewId("labelActivityWater_"); // Set style
labelActivityWater_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelActivityWater_->SetText("每日喝水");
labelActivityWater_->SetTextId(STR_ID_344);
labelActivityWater_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityWater_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityWater_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityWater_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
dataPage_->Add(labelActivityWater_);
labelActivityWater_->SetVisible(true);
if (sliderWater_ == nullptr) {
sliderWater_ = new UISlider();
}
sliderWater_->SetPosition(53, 1083); // widget's left position and top position
sliderWater_->Resize(360, 6); // widget's width and heighte
sliderWater_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
sliderWater_->SetStyle(STYLE_BORDER_RADIUS, 6);
sliderWater_->SetStyle(STYLE_LINE_CAP, CapType::CAP_ROUND);
sliderWater_->SetValidWidth(360);
sliderWater_->SetValidHeight(6);
sliderWater_->SetValue(20);
sliderWater_->SetSliderColor(Color::GetColorFromRGBA(0x4c, 0x4c, 0x4c, 0xff),
Color::GetColorFromRGBA(0x00, 0xfb, 0x9d, 0xff));
sliderWater_->SetKnobStyle(STYLE_BACKGROUND_COLOR, 0xff808080);
sliderWater_->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff);
dataPage_->Add(sliderWater_);
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_DARK_WATER, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (leftWater_ == nullptr) {
leftWater_ = new UIImageView();
}
leftWater_->SetPosition(53, 1075); // widget's left position and top position
leftWater_->SetSrc(imgInfo); // widget's width and height
dataPage_->Add(leftWater_);
if (rightWater_ == nullptr) {
rightWater_ = new UIImageView();
}
rightWater_->SetPosition(391, 1075); // widget's left position and top position
rightWater_->SetSrc(imgInfo); // widget's width and height
dataPage_->Add(rightWater_);
if (labelGoalsWater_ == nullptr) {
labelGoalsWater_ = new UILabelExt();
}
labelGoalsWater_->SetPosition(218, 1137); // widget's left position and top position
labelGoalsWater_->Resize(53, 26); // widget's width and height
labelGoalsWater_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelGoalsWater_->SetText("/6杯");
labelGoalsStep_->SetTextId(STR_ID_577);
labelGoalsWater_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsWater_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelGoalsWater_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelGoalsWater_);
if (labelCurWater_ == nullptr) {
labelCurWater_ = new UILabel();
}
labelCurWater_->SetPosition(191, 1124, 23, 36); // widget's left position and top position
// Set additional property
labelCurWater_->SetText("3");
labelCurWater_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurWater_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
labelCurWater_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurWater_->SetStyle(STYLE_TEXT_COLOR, 0xFF00FB9D);
// Add to rootView
dataPage_->Add(labelCurWater_);
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_SLEEP_EARLY_CAL,
IMAGE_LUCKY_CLOVER_BIN_PATH);
if (sleepEarlyIcon_ == nullptr) {
sleepEarlyIcon_ = new UIImageView();
}
sleepEarlyIcon_->SetPosition(217, 1304); // widget's left position and top position
sleepEarlyIcon_->SetSrc(imgInfo); // widget's width and height
dataPage_->Add(sleepEarlyIcon_);
if (labelActivitySleepEarly_ == nullptr) {
labelActivitySleepEarly_ = new UILabelExt();
}
labelActivitySleepEarly_->SetPosition(0, 1368); // widget's left position and top position
labelActivitySleepEarly_->Resize(466, 40); // widget's width and height
labelActivitySleepEarly_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelActivitySleepEarly_->SetText("早睡");
labelActivitySleepEarly_->SetTextId(STR_ID_345);
// labelActivitySleepEarly_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivitySleepEarly_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivitySleepEarly_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivitySleepEarly_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
dataPage_->Add(labelActivitySleepEarly_);
if (labelGoalsSleepEarly_ == nullptr) {
labelGoalsSleepEarly_ = new UILabelExt();
}
labelGoalsSleepEarly_->SetPosition(189, 1456,94,42); // widget's left position and top position
labelGoalsSleepEarly_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelGoalsSleepEarly_->SetText("未打卡");
labelGoalsSleepEarly_->SetTextId(STR_ID_348);
labelGoalsSleepEarly_->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
labelGoalsSleepEarly_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelGoalsSleepEarly_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelGoalsSleepEarly_);
if (ProgressSleepEarly_ == nullptr) {
ProgressSleepEarly_ = new UICircleProgress();
}
ProgressSleepEarly_->SetPosition(91, 1224); // widget's left position and top position
ProgressSleepEarly_->Resize(282, 282); // widget's width and height
ProgressSleepEarly_->SetBackgroundStyle(STYLE_LINE_WIDTH, 254);
ProgressSleepEarly_->SetForegroundStyle(STYLE_LINE_WIDTH, 254);
foreImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_SLEEP_PROGRESS_FG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
bgImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_SLEEP_PROGRESS_BG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
ProgressSleepEarly_->SetImage(foreImage, bgImage);
ProgressSleepEarly_->SetCenterPosition(141, 141);
ProgressSleepEarly_->SetRadius(141);
ProgressSleepEarly_->SetStartAngle(-150);
ProgressSleepEarly_->SetEndAngle(150);
ProgressSleepEarly_->SetValue(30);
dataPage_->Add(ProgressSleepEarly_);
ProgressSleepEarly_->SetVisible(true);
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_SLEEP_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (sleepIcon_ == nullptr) {
sleepIcon_ = new UIImageView();
}
sleepIcon_->SetPosition(218, 1661); // widget's left position and top position
sleepIcon_->SetSrc(imgInfo); // widget's width and height
dataPage_->Add(sleepIcon_);
// Add CircleProgress to App
if (ProgressSleep_ == nullptr) {
ProgressSleep_ = new UICircleProgress();
}
ProgressSleep_->SetPosition(91, 1572); // widget's left position and top position
ProgressSleep_->Resize(284, 284); // widget's width and height
ProgressSleep_->SetViewId("circleProgress1"); // Set style
// Set additional property
// Set BackgroundStyle
ProgressSleep_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
ProgressSleep_->SetBackgroundStyle(STYLE_LINE_COLOR, 0xff4c4c4c);
ProgressSleep_->SetBackgroundStyle(STYLE_LINE_WIDTH, 22);
ProgressSleep_->SetBackgroundStyle(STYLE_LINE_CAP, 1);
// Set ForegroundStyle
ProgressSleep_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff4c4c4c);
ProgressSleep_->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff000000);
ProgressSleep_->SetForegroundStyle(STYLE_LINE_COLOR, 0xff9377ff);
ProgressSleep_->SetForegroundStyle(STYLE_LINE_WIDTH, 22);
ProgressSleep_->SetForegroundStyle(STYLE_LINE_CAP, 1);
ProgressSleep_->SetCenterPosition(142, 145);
ProgressSleep_->SetRadius(141);
ProgressSleep_->SetStartAngle(-140);
ProgressSleep_->SetEndAngle(140);
ProgressSleep_->SetValue(20);
// Add to rootView
dataPage_->Add(ProgressSleep_);
if (labelActivitySleep_ == nullptr) {
labelActivitySleep_ = new UILabelExt();
}
labelActivitySleep_->SetPosition(0, 1721); // widget's left position and top position
labelActivitySleep_->Resize(466, 40); // widget's width and height
labelActivitySleep_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelActivitySleep_->SetText("睡眠时长");
labelActivitySleep_->SetTextId(STR_ID_346);
// labelActivitySleep_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivitySleep_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivitySleep_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivitySleep_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
dataPage_->Add(labelActivitySleep_);
if (labelSleepGoalsTime_ == nullptr) {
labelSleepGoalsTime_ = new UILabel();
}
labelSleepGoalsTime_->SetPosition(191, 1810); // widget's left position and top position
labelSleepGoalsTime_->Resize(81, 26); // widget's width and height
labelSleepGoalsTime_->SetViewId("labelSleepGoalsTime_"); // Set style (for style)
labelSleepGoalsTime_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_28);
// Set additional property
labelSleepGoalsTime_->SetText("/8h35m");
labelSleepGoalsTime_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelSleepGoalsTime_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelSleepGoalsTime_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelSleepGoalsTime_);
if (labelCurSleepTime_ == nullptr) {
labelCurSleepTime_ = new UILabel();
}
labelCurSleepTime_->SetPosition(159, 1750, 24, 36); // widget's left position and top position
// Set additional property
labelCurSleepTime_->SetText("4h20m");
labelCurSleepTime_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurSleepTime_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelCurSleepTime_->SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurSleepTime_->SetStyle(STYLE_TEXT_COLOR, 0xFF9377FF);
// Add to rootView
dataPage_->Add(labelCurSleepTime_);
//===================================================================
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CUSTOM, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (customIcon_ == nullptr) {
customIcon_ = new UIImageView();
}
customIcon_->SetPosition(218, 1979); // widget's left position and top position
customIcon_->SetSrc(imgInfo); // widget's width and height
dataPage_->Add(customIcon_);
if (labelActivityCustom_ == nullptr) {
labelActivityCustom_ = new UILabelExt();
}
labelActivityCustom_->SetPosition(0, 2023); // widget's left position and top position
labelActivityCustom_->Resize(466, 40); // widget's width and height
labelActivityCustom_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelActivityCustom_->SetText("自定义");
labelActivityCustom_->SetTextId(STR_ID_280);
// labelActivityCustom_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityCustom_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityCustom_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityCustom_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
dataPage_->Add(labelActivityCustom_);
if (labelGoalsCustom_ == nullptr) {
labelGoalsCustom_ = new UILabelExt();
}
labelGoalsCustom_->SetPosition(189, 2112,94,42); // widget's left position and top position
labelGoalsCustom_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelGoalsCustom_->SetText("未打卡");
labelGoalsCustom_->SetTextId(STR_ID_348);
labelGoalsCustom_->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
labelGoalsCustom_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelGoalsCustom_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
dataPage_->Add(labelGoalsCustom_);
if (progressCustom_ == nullptr) {
progressCustom_ = new UICircleProgress();
}
progressCustom_->SetPosition(100, 1899); // widget's left position and top position
progressCustom_->Resize(282, 282); // widget's width and height
progressCustom_->SetBackgroundStyle(STYLE_LINE_WIDTH, 254);
progressCustom_->SetForegroundStyle(STYLE_LINE_WIDTH, 254);
foreImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CUSTOM_PROGRESS_FG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
bgImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CUSTOM_PROGRESS_BG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
progressCustom_->SetImage(foreImage, bgImage);
progressCustom_->SetCenterPosition(141, 141);
progressCustom_->SetRadius(141);
progressCustom_->SetStartAngle(-150);
progressCustom_->SetEndAngle(150);
progressCustom_->SetValue(30);
dataPage_->Add(progressCustom_);
progressCustom_->SetVisible(true);
if (labelTips_ == nullptr) {
labelTips_ = new UILabelExt();
}
labelTips_->SetPosition(70, 2242, 326, 47); // widget's left position and top position
labelTips_->SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
// labelTips_->SetText("具体规则请移至APP查看");
labelTips_->SetTextId(STR_ID_351);
labelTips_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
labelTips_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelTips_->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelTips_->SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
dataPage_->Add(labelTips_);
return dataPage_;
}
void TjdUiAppLuckyCloverView::LabelRefresh(OHOS::UILabel *label, const char *temp_str)
{
label->SetText(temp_str);
label->Invalidate();
}
void TjdUiAppLuckyCloverView::ForeGroundRefresh(OHOS::UIView *view, uint32_t currentValue, uint32_t goalValue,
LuckyCloverFgIndex luckyCloverFgIndex)
{
float hightScale = (float)currentValue / (float)goalValue;
float widthScale = hightScale;
const Vector2<float> &scale = {hightScale, widthScale};
Vector2<float> pivot = {PIVOT_X, PIVOT_Y};
switch (luckyCloverFgIndex) {
case IMG_STAND_FG_INDEX:
pivot = {PIVOT_X + IMAGE_WIDTH, PIVOT_Y + IMAGE_HEIGHT};
view->Scale(scale, pivot);
view->Invalidate();
break;
case IMG_KCAL_FG_INDEX:
pivot = {PIVOT_X, PIVOT_Y + IMAGE_HEIGHT};
view->Scale(scale, pivot);
view->Invalidate();
break;
case IMG_STRENGTH_FG_INDEX:
pivot = {PIVOT_X + IMAGE_WIDTH, PIVOT_Y};
view->Scale(scale, pivot);
view->Invalidate();
break;
case IMG_STEP_FG_INDEX:
pivot = {PIVOT_X, PIVOT_Y};
view->Scale(scale, pivot);
view->Invalidate();
break;
default:
break;
}
}
void TjdUiAppLuckyCloverView::DataRefresh(lucky_clover_t lucky_clover_info)
{
char temp_str[100] = {0};
uint16_t temp_str_ptr[2] = {STR_ID_348, STR_ID_349};
const int CalProgressId[7] = {
IMG_LUCKY_CLOVER_PROGRESS_01, IMG_LUCKY_CLOVER_PROGRESS_02, IMG_LUCKY_CLOVER_PROGRESS_03,
IMG_LUCKY_CLOVER_PROGRESS_04, IMG_LUCKY_CLOVER_PROGRESS_05, IMG_LUCKY_CLOVER_PROGRESS_06,
IMG_LUCKY_CLOVER_PROGRESS_07,
};
ForeGroundRefresh(imageStandForegroud_, lucky_clover_info.currentStandNum, lucky_clover_info.goalStandNum,
IMG_STAND_FG_INDEX);
ForeGroundRefresh(imageKcalForegroud_, lucky_clover_info.currentCalorieNum, lucky_clover_info.goalCalorieNum,
IMG_KCAL_FG_INDEX);
ForeGroundRefresh(imageStrengthForegroud_, lucky_clover_info.currentStrengthTime,
lucky_clover_info.goalStrengthTime, IMG_STRENGTH_FG_INDEX);
ForeGroundRefresh(imageStepForegroud_, lucky_clover_info.currentStepNum, lucky_clover_info.goalStepNum,
IMG_STEP_FG_INDEX);
std::string lbtext = std::string(FontGlobalManager::GetInstance()->GetText(STR_ID_360));
sprintf(temp_str, "%s%d/%d", lbtext.c_str(), lucky_clover_info.currentTaskNum, lucky_clover_info.goalTaskNum);
LabelRefresh(label2_, temp_str);
// stand data update=================================
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "/%d", lucky_clover_info.goalStandNum);
LabelRefresh(labelGoalsStand_, temp_str);
labelGoalsStand_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelCurStand_->SetText(std::to_string(lucky_clover_info.currentStandNum).c_str());
labelCurStand_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
standProgress_->SetProgress(lucky_clover_info.currentStandNum, lucky_clover_info.goalStandNum);
// calorie data update=================================
memset(temp_str, 0, sizeof(temp_str));
lbtext.clear();
lbtext = std::string(FontGlobalManager::GetInstance()->GetText(STR_ID_576));
sprintf(temp_str, "/%d %s", lucky_clover_info.goalCalorieNum, lbtext.c_str());
LabelRefresh(labelGoalsCal, temp_str);
labelCurCal_->SetText(std::to_string(lucky_clover_info.currentCalorieNum).c_str());
uint8_t picIndex = 0;
if (lucky_clover_info.goalCalorieNum) {
picIndex = ((float)lucky_clover_info.currentCalorieNum / (float)lucky_clover_info.goalCalorieNum) * 7;
picIndex = (picIndex - 1) < 0 ? 0 : (picIndex - 1);
} else
picIndex = 0;
auto imgInfo =
OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(CalProgressId[picIndex], IMAGE_LUCKY_CLOVER_BIN_PATH);
imageCalProgress_->SetSrc(imgInfo);
// strength data update=================================
memset(temp_str, 0, sizeof(temp_str));
lbtext.clear();
lbtext = std::string(FontGlobalManager::GetInstance()->GetText(STR_ID_129));
sprintf(temp_str, "/%d %s", lucky_clover_info.goalStrengthTime, lbtext.c_str());
LabelRefresh(labelGoalsStrength_, temp_str);
int roundedResult = 0;
labelCurStrgength_->SetText(std::to_string(lucky_clover_info.currentStrengthTime).c_str());
if (lucky_clover_info.goalStrengthTime) {
roundedResult = static_cast<int>(std::round(
std::round((float)lucky_clover_info.currentStrengthTime / (float)lucky_clover_info.goalStrengthTime)));
} else
roundedResult = 0;
ProgressStrength_->SetValue(roundedResult);
// step data update=================================
memset(temp_str, 0, sizeof(temp_str));
lbtext.clear();
lbtext = std::string(FontGlobalManager::GetInstance()->GetText(STR_ID_547));
sprintf(temp_str, "/%d %s", lucky_clover_info.goalStepNum, lbtext.c_str());
LabelRefresh(labelGoalsStep_, temp_str);
labelGoalsStep_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelCurStep_->SetText(std::to_string(lucky_clover_info.currentStepNum).c_str());
labelCurStep_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
if (lucky_clover_info.goalStepNum) {
roundedResult = static_cast<int>(
std::round(std::round((float)lucky_clover_info.currentStepNum / (float)lucky_clover_info.goalStepNum)) *
100);
} else
roundedResult = 0;
printf("1378: roundedResult = %d\n", roundedResult);
sliderStep_->SetValue(roundedResult);
// water data update=================================
memset(temp_str, 0, sizeof(temp_str));
printf("lucky_clover_info.currentDrinkNum = %d, lucky_clover_info.goalDrinkNum = %d\n",
lucky_clover_info.currentDrinkNum, lucky_clover_info.goalDrinkNum);
lbtext.clear();
lbtext = std::string(FontGlobalManager::GetInstance()->GetText(STR_ID_577));
sprintf(temp_str, "/%d %s", lucky_clover_info.goalDrinkNum, lbtext.c_str());
LabelRefresh(labelGoalsWater_, temp_str);
labelCurWater_->SetText(std::to_string(lucky_clover_info.currentDrinkNum).c_str());
if (lucky_clover_info.goalDrinkNum) {
printf("line = %d \n", __LINE__);
roundedResult = static_cast<int>(
std::round(((float)lucky_clover_info.currentDrinkNum / (float)lucky_clover_info.goalDrinkNum) * 100));
} else
roundedResult = 0;
printf("1395: roundedResult = %d\n", roundedResult);
sliderWater_->SetValue(roundedResult);
sliderWater_->Invalidate();
if (lucky_clover_info.currentDrinkNum)
leftWater_->SetSrc(OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_BRIGHT_WATER,
IMAGE_LUCKY_CLOVER_BIN_PATH));
else
leftWater_->SetSrc(OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_DARK_WATER,
IMAGE_LUCKY_CLOVER_BIN_PATH));
if (lucky_clover_info.currentDrinkNum >= lucky_clover_info.goalDrinkNum)
rightWater_->SetSrc(OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_BRIGHT_WATER,
IMAGE_LUCKY_CLOVER_BIN_PATH));
else
leftWater_->SetSrc(OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_DARK_WATER,
IMAGE_LUCKY_CLOVER_BIN_PATH));
if (lucky_clover_info.sleepEarly) {
ProgressSleepEarly_->SetValue(100);
labelGoalsSleepEarly_->SetTextId(temp_str_ptr[1]);
}
else {
ProgressSleepEarly_->SetValue(0);
labelGoalsSleepEarly_->SetTextId(temp_str_ptr[0]);
}
if (!lucky_clover_info.currentSleepTime) {
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "/%dh%02dm", lucky_clover_info.goalSleepTime / 60, lucky_clover_info.goalSleepTime % 60);
labelCurSleepTime_->SetText("--");
LabelAutoAlignCenter(*labelCurSleepTime_);
}
else {
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "/%dh%02dm", lucky_clover_info.goalSleepTime / 60, lucky_clover_info.goalSleepTime % 60);
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "%dh%02dm", lucky_clover_info.currentSleepTime / 60, lucky_clover_info.currentSleepTime % 60);
labelCurSleepTime_->SetText(temp_str);
}
LabelRefresh(labelSleepGoalsTime_, temp_str);
if (lucky_clover_info.goalSleepTime) {
int sleepProgress = (float)lucky_clover_info.currentSleepTime / (float)lucky_clover_info.goalSleepTime * 100;
ProgressSleep_->SetValue(sleepProgress);
} else
ProgressSleep_->SetValue(0);
labelGoalsCustom_->SetTextId(temp_str_ptr[lucky_clover_info.custom123]);
progressCustom_->SetValue(lucky_clover_info.custom123 * 100);
}
#pragma region 消息弹窗
static void luckyCloverPopupTimerCallBack(void *data)
{
printf("luckyCloverPopupTimerCallBack\n");
if (luckyCloverPopupTimer_ != nullptr) {
luckyCloverPopupTimer_->Stop();
delete luckyCloverPopupTimer_;
luckyCloverPopupTimer_ = nullptr;
}
NotificationManager::GetInstance()->StopNotify();
// view.SetVisible(false);
}
bool LuckyCloverPopupWindowListener::OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event)
{
printf("LuckyCloverPopupWindowListener popup window click\n");
if (luckyCloverPopupTimer_ != nullptr) {
luckyCloverPopupTimer_->Stop();
delete luckyCloverPopupTimer_;
luckyCloverPopupTimer_ = nullptr;
}
NotificationManager::GetInstance()->StopNotify();
view.SetVisible(false);
return true;
}
bool LuckyCloverPopupWindowListener::OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event)
{
if (!TjdUiCommonOnKeyListener::CheckIsExitEvent(event)) {
return true;
}
NotificationManager::GetInstance()->StopNotify();
view.SetVisible(false);
return true;
}
LuckyCloverPopupWindow::LuckyCloverPopupWindow(LuckyCloverPopupWindowIndex type)
{
SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
SetStyle(STYLE_BACKGROUND_OPA, 255);
SetOnClickListener(&luckyCloverOnclickListener_);
if (type == LuckyCloverPopupWindowIndex::POPUP_WINDOW_ENERGETIC_CLOVER) {
imgEnergeticClover_.SetPosition(71, 44); // widget's left position and top position
ImageInfo *imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_VITALITY, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imgEnergeticClover_.SetSrc(imgInfo);
InitLabelHorCenter(labelEnergeticClover_, 28, 386, 466, "活力四叶草已达成!");
Add(&imgEnergeticClover_);
Add(&labelEnergeticClover_);
} else if (type == LuckyCloverPopupWindowIndex::POPUP_WINDOW_PERFECT_CLOVER) {
imgPerfectClover_.SetPosition(71, 44); // widget's left position and top position
ImageInfo *imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_PERFECT, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imgPerfectClover_.SetSrc(imgInfo);
InitLabelHorCenter(labelPerfectClover_, 28, 386, 466, "完美四叶草已达成!");
Add(&imgPerfectClover_);
Add(&labelPerfectClover_);
}
if (luckyCloverPopupTimer_ == nullptr) {
luckyCloverPopupTimer_ = new OHOS::GraphicTimer(5000, luckyCloverPopupTimerCallBack, nullptr, false);
}
luckyCloverPopupTimer_->Start();
}
LuckyCloverPopupWindow::~LuckyCloverPopupWindow()
{
printf("~LuckyCloverPopupWindow\n");
RemoveAll();
if (luckyCloverPopupTimer_ != nullptr) {
luckyCloverPopupTimer_->Stop();
delete luckyCloverPopupTimer_;
luckyCloverPopupTimer_ = nullptr;
}
};
LuckyCloverRemindWindow::LuckyCloverRemindWindow(uint16_t curProcess, uint16_t goalProcess, char *goal)
{
// TjdUiAppLuckyCloverModel::GetInstance()->SetRemindFlag(false);
char temp_str[50] = {0};
SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
SetStyle(STYLE_BACKGROUND_OPA, 255);
OHOS::RootView::GetInstance()->SetOnKeyActListener(&luckyCloverOnclickListener_);
SetTouchable(true);
SetOnClickListener(&luckyCloverOnclickListener_);
imgIcon_.SetPosition(165, 75); // widget's left position and top position
ImageInfo *imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_FOUR_LEAF_CLOVER_PROMPT,
IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imgIcon_.SetSrc(imgInfo);
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "%s", goal);
InitLabelHorCenter(labelTarget_, 34, 224, 466, temp_str);
memset(temp_str, 0, sizeof(temp_str));
if (curProcess != 0 && curProcess < goalProcess)
sprintf(temp_str, "今日目标已完成%d/%d\n 请继续努力", curProcess, goalProcess);
else
sprintf(temp_str, "太棒了!\n 今日%s目标已完成", goal);
InitLabelHorCenter(labelProgress_, 34, 293, 466, temp_str);
if (luckyCloverPopupTimer_ == nullptr) {
luckyCloverPopupTimer_ = new OHOS::GraphicTimer(5000, luckyCloverPopupTimerCallBack, nullptr, false);
}
luckyCloverPopupTimer_->Start();
Add(&imgIcon_);
Add(&labelTarget_);
Add(&labelProgress_);
}
LuckyCloverRemindWindow::~LuckyCloverRemindWindow()
{
RemoveAll();
if (luckyCloverPopupTimer_ != nullptr) {
luckyCloverPopupTimer_->Stop();
delete luckyCloverPopupTimer_;
luckyCloverPopupTimer_ = nullptr;
}
};
GSensor_RemindWindow::GSensor_RemindWindow(lucky_clover_t lucky_clover_info)
{
int roundedResult = 0;
char temp_str[20] = {0};
const int CalProgressId[7] = {
IMG_LUCKY_CLOVER_PROGRESS_01, IMG_LUCKY_CLOVER_PROGRESS_02, IMG_LUCKY_CLOVER_PROGRESS_03,
IMG_LUCKY_CLOVER_PROGRESS_04, IMG_LUCKY_CLOVER_PROGRESS_05, IMG_LUCKY_CLOVER_PROGRESS_06,
IMG_LUCKY_CLOVER_PROGRESS_07,
};
SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, 1000);
SetStyle(STYLE_BACKGROUND_OPA, 255);
imgIcon_.SetPosition(97, 47); // widget's left position and top position
ImageInfo *imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_FOUR_LEAF_CLOVER_ICON,
IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imgIcon_.SetSrc(imgInfo);
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "任务达成数%d/%d", lucky_clover_info.currentTaskNum, lucky_clover_info.goalTaskNum);
InitLabel(labelTaskProcess_, 28, 199, 75, temp_str);
imageStandCal_.SetPosition(162, 228); // widget's left position and top position
imageStandCal_.Resize(16, 38); // widget's width and height
imageStandCal_.SetViewId("imageStandCal_"); // Set style
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STAND_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStandCal_.SetSrc(imgInfo);
// Add to rootView
Add(&imageStandCal_);
/*-----------------------------Add labelActivity to App------------------------------*/
labelActivityStand_.SetPosition(189, 237); // widget's left position and top position
labelActivityStand_.Resize(117, 28); // widget's width and height
labelActivityStand_.SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
labelActivityStand_.SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Set additional property
labelActivityStand_.SetText("站立活动");
labelActivityStand_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityStand_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityStand_.SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
Add(&labelActivityStand_);
labelActivityStand_.SetVisible(true);
auto foregroundImage =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_DARK, IMAGE_LUCKY_CLOVER_BIN_PATH);
auto backgroundImage =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_BRIGHT, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (standProgress_ == nullptr) {
standProgress_ = new StandProgress(foregroundImage);
}
standProgress_->SetPosition(77, 285);
standProgress_->SetSrcImage(foregroundImage, backgroundImage);
standProgress_->SetProgress(lucky_clover_info.currentStandNum, lucky_clover_info.goalStandNum);
Add(standProgress_);
/*-----------------------------Add labelGoals to App------------------------------*/
labelGoalsStand_.SetPosition(232, 332, 26, 27); // widget's left position and top position
// Set additional property
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "/%d", lucky_clover_info.goalStandNum);
labelGoalsStand_.SetText(temp_str);
labelGoalsStand_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsStand_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelGoalsStand_.SetRollSpeed(0);
labelGoalsStand_.SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
Add(&labelGoalsStand_);
labelGoalsStand_.SetVisible(true);
labelCurStand_.SetPosition(202, 320, 24, 36); // widget's left position and top position
// Set additional property
labelCurStand_.SetText(std::to_string(lucky_clover_info.currentStandNum).c_str());
labelCurStand_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurStand_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelCurStand_.SetRollSpeed(0);
labelCurStand_.SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurStand_.SetStyle(STYLE_TEXT_COLOR, 0xFF00FB9D);
// Add to rootView
Add(&labelCurStand_);
// /*-----------------------------Add imageSuccess to App------------------------------*/
imageCalCal_.SetPosition(148, 430); // widget's left position and top position
// Set additional property
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CAL_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageCalCal_.SetSrc(imgInfo);
// Add to rootView
Add(&imageCalCal_);
imageCalCal_.SetVisible(true);
/*-----------------------------Add labelActivity to App------------------------------*/
labelActivityCal_.SetPosition(189, 433); // widget's left position and top position
labelActivityCal_.Resize(117, 28); // widget's width and height
labelActivityCal_.SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
labelActivityCal_.SetText("活动热量");
labelActivityCal_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityCal_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityCal_.SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityCal_.SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
Add(&labelActivityCal_);
labelActivityCal_.SetVisible(true);
imageCalProgress_.SetPosition(120, 486); // widget's left position and top position
// Set additional property
uint8_t picIndex = 0;
if (lucky_clover_info.goalCalorieNum) {
picIndex = ((float)lucky_clover_info.currentCalorieNum / (float)lucky_clover_info.goalCalorieNum) * 7;
picIndex = (picIndex - 1) < 0 ? 0 : (picIndex - 1);
} else
picIndex = 0;
imgInfo =
OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(CalProgressId[picIndex], IMAGE_LUCKY_CLOVER_BIN_PATH);
imageCalProgress_.SetSrc(imgInfo);
// Add to rootView
Add(&imageCalProgress_);
imageCalProgress_.SetVisible(true);
/*-----------------------------Add labelGoals to App------------------------------*/
labelGoalsCal.SetPosition(213, 623, 119, 28); // widget's left position and top position
labelGoalsCal.Resize(154, 26); // widget's width and height
labelGoalsCal.SetViewId("labelGoalsCal"); // Set style
labelGoalsCal.SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "/%d千卡", lucky_clover_info.goalCalorieNum);
labelGoalsCal.SetText(temp_str);
labelGoalsCal.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsCal.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
labelGoalsCal.SetRollSpeed(0);
labelGoalsCal.SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
Add(&labelGoalsCal);
labelGoalsCal.SetVisible(true);
labelCurCal_.SetPosition(134, 612, 74, 36); // widget's left position and top position
// Set additional property
labelCurCal_.SetText(std::to_string(lucky_clover_info.currentCalorieNum).c_str());
labelCurCal_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurCal_.SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
labelCurCal_.SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurCal_.SetStyle(STYLE_TEXT_COLOR, 0xFFFFD800);
// Add to rootView
Add(&labelCurCal_);
/*-----------------------------Add imageSuccess to App------------------------------*/
imageStrengthCal_.SetPosition(147, 749); // widget's left position and top position
imageStrengthCal_.Resize(33, 33); // widget's width and height
imageStrengthCal_.SetViewId("imageStrengthCal_"); // Set style
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STRENGTH_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStrengthCal_.SetSrc(imgInfo);
// Add to rootView
Add(&imageStrengthCal_);
imageStrengthCal_.SetVisible(true);
/*-----------------------------Add labelActivity to App------------------------------*/
labelActivityStrength_.SetPosition(190, 744); // widget's left position and top position
labelActivityStrength_.Resize(116, 29); // widget's width and height
labelActivityStrength_.SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
labelActivityStrength_.SetText("中高强度");
labelActivityStrength_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityStrength_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityStrength_.SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityStrength_.SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
Add(&labelActivityStrength_);
labelActivityStrength_.SetVisible(true);
// Add CircleProgress to App
ProgressStrength_.SetPosition(0, 724); // widget's left position and top position
ProgressStrength_.Resize(466, 466); // widget's width and height
ProgressStrength_.SetBackgroundStyle(STYLE_LINE_WIDTH, 326);
ProgressStrength_.SetForegroundStyle(STYLE_LINE_WIDTH, 326);
auto foreImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CAL_BAR_FG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
auto bgImage = OHOS::ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_CAL_BAR_BG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
ProgressStrength_.SetImage(foreImage, bgImage);
ProgressStrength_.SetCenterPosition(233, 233);
ProgressStrength_.SetRadius(233);
ProgressStrength_.SetStartAngle(-60);
ProgressStrength_.SetEndAngle(60);
ProgressStrength_.SetProgressImagePosition(70, 70);
ProgressStrength_.SetBackgroundImagePosition(70, 70);
if (lucky_clover_info.goalStrengthTime) {
roundedResult = static_cast<int>(std::round(
((float)lucky_clover_info.currentStrengthTime / (float)lucky_clover_info.goalStrengthTime) * 100));
} else
roundedResult = 0;
ProgressStrength_.SetValue(roundedResult);
Add(&ProgressStrength_);
ProgressStrength_.SetVisible(true);
/*-----------------------------Add labelGoals to App------------------------------*/
labelGoalsStrength_.SetPosition(217, 858, 95, 26); // widget's left position and top position
labelGoalsStrength_.SetViewId("labelGoalsStrength_"); // Set style
labelGoalsStrength_.SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "/%d分钟", lucky_clover_info.goalStrengthTime);
labelGoalsStrength_.SetText(temp_str);
labelGoalsStrength_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsStrength_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelGoalsStrength_.SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
Add(&labelGoalsStrength_);
labelGoalsStrength_.SetVisible(true);
labelCurStrgength_.SetPosition(164, 846, 48, 36); // widget's left position and top position
// Set additional property
labelCurStrgength_.SetText(std::to_string(lucky_clover_info.currentStrengthTime).c_str());
labelCurStrgength_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurStrgength_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelCurStrgength_.SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurStrgength_.SetStyle(STYLE_TEXT_COLOR, 0xFFFF584B);
// Add to rootView
Add(&labelCurStrgength_);
/*-----------------------------Add imageSuccess to App------------------------------*/
imageStep_.SetPosition(176, 963); // widget's left position and top position
imageStep_.SetViewId("imageStep_"); // Set style
// Set additional property
imgInfo =
ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STEP_CAL, IMAGE_LUCKY_CLOVER_BIN_PATH);
if (imgInfo == nullptr) {
static_print_error("load image error ");
}
imageStep_.SetSrc(imgInfo);
// Add to rootView
Add(&imageStep_);
imageStep_.SetVisible(true);
/*-----------------------------Add labelActivity to App------------------------------*/
labelActivityStep_.SetPosition(215, 958); // widget's left position and top position
labelActivityStep_.Resize(58, 28); // widget's width and height
labelActivityStep_.SetViewId("labelActivityStep_"); // Set style
labelActivityStep_.SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
labelActivityStep_.SetText("步数");
labelActivityStep_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelActivityStep_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelActivityStep_.SetRollSpeed(0);
labelActivityStep_.SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
labelActivityStep_.SetStyle(STYLE_TEXT_OPA, 0xff * 0.5);
// Add to rootView
Add(&labelActivityStep_);
labelActivityStep_.SetVisible(true);
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STEP_PROGRESS_BG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
imageSliderBg_.SetPosition(53, 1011); // widget's left position and top position
imageSliderBg_.SetSrc(imgInfo); // widget's width and height
Add(&imageSliderBg_);
sliderStep_.SetPosition(58, 1015); // widget's left position and top position
sliderStep_.Resize(350, 10); // widget's width and height
sliderStep_.SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
sliderStep_.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
// Set additional property
sliderStep_.SetValidWidth(350);
sliderStep_.SetValidHeight(10);
sliderStep_.SetSliderColor(Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0xff),
Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0xff));
sliderStep_.SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff);
imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(IMG_LUCKY_CLOVER_STEP_PROGRESS_FG,
IMAGE_LUCKY_CLOVER_BIN_PATH);
sliderStep_.SetImage(nullptr, imgInfo);
if (lucky_clover_info.goalStepNum) {
roundedResult = static_cast<int>(
std::round(((float)lucky_clover_info.currentStepNum / (float)lucky_clover_info.goalStepNum) * 100));
} else
roundedResult = 0;
printf("1378: roundedResult = %d\n", roundedResult);
sliderStep_.SetValue(roundedResult);
// Add to rootView
Add(&sliderStep_);
labelGoalsStep_.SetPosition(240, 1050); // widget's left position and top position
labelGoalsStep_.Resize(120, 29); // widget's width and height
labelGoalsStep_.SetViewId("labelGoalsStep_"); // Set style
labelGoalsStep_.SetStyle(STYLE_TEXT_FONT, TJD_FONT_SIZE_30);
// Set additional property
memset(temp_str, 0, sizeof(temp_str));
sprintf(temp_str, "/%d步", lucky_clover_info.goalStepNum);
labelGoalsStep_.SetText(temp_str);
labelGoalsStep_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelGoalsStep_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelGoalsStep_.SetRollSpeed(0);
labelGoalsStep_.SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_30);
// Add to rootView
Add(&labelGoalsStep_);
labelGoalsStep_.SetVisible(true);
labelCurStep_.SetPosition(107, 1039, 125, 36); // widget's left position and top position
// Set additional property
labelCurStep_.SetText(std::to_string(lucky_clover_info.currentStepNum).c_str());
labelCurStep_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
labelCurStep_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
labelCurStep_.SetFont(TJD_DIN_MEDIUM_FONT_FILENAME, TJD_FONT_SIZE_50);
labelCurStep_.SetStyle(STYLE_TEXT_COLOR, 0xFF0084FF);
// Add to rootView
Add(&labelCurStep_);
// Add to rootView
Add(&labelStepProcess_);
Add(&imgIcon_);
Add(&labelTaskProcess_);
}
GSensor_RemindWindow::~GSensor_RemindWindow()
{
if (standProgress_) {
Remove(standProgress_);
delete standProgress_;
standProgress_ = nullptr;
}
RemoveAll();
};
#pragma endregion
} // namespace TJD