// 增加背景
container_->Add(background);
background->SetVisible(true);
- PRINT_DEBUG_INFO
}
/*初始化表盘时钟*/
// Function to create and add an image view
cJSON *minute_coordinates = cJSON_GetObjectItem(minuteHand, "coordinates");
cJSON *second_coordinates = cJSON_GetObjectItem(secondHand, "coordinates");
const char *handspath = cJSON_GetObjectItem(cjson_json, "handspath")->valuestring;
- PRINT_DEBUG_INFO
+
signed short HOUR_POINT_POSITION_X = static_cast<signed short>(cJSON_GetObjectItem(hour_coordinates, "HOUR_POINT_POSITION_X")->valueint);
signed short HOUR_POINT_POSITION_Y = static_cast<signed short>(cJSON_GetObjectItem(hour_coordinates, "HOUR_POINT_POSITION_Y")->valueint);
signed short HOUR_POINT_CENTER_X = static_cast<signed short>(cJSON_GetObjectItem(hour_coordinates, "HOUR_POINT_CENTER_X")->valueint);
signed short SECOND_POINT_POSITION_Y = static_cast<signed short>(cJSON_GetObjectItem(second_coordinates, "SECOND_POINT_POSITION_Y")->valueint);
signed short SECOND_POINT_CENTER_X = static_cast<signed short>(cJSON_GetObjectItem(second_coordinates, "SECOND_POINT_CENTER_X")->valueint);
signed short SECOND_POINT_CENTER_Y = static_cast<signed short>(cJSON_GetObjectItem(second_coordinates, "SECOND_POINT_CENTER_Y")->valueint);
- PRINT_DEBUG_INFO
+
// Add SweepClock to App
if (sweepClock1_ == nullptr)
{
sweepClock1_->SetWorkMode(UISweepClock::WorkMode::NORMAL);
Image *sweepClock1HourImage = new Image();
std::string HourImagePath = std::string(handspath) + "hour.bin";
- PRINT_DEBUG_INFO
+
sweepClock1HourImage->SetSrc(HourImagePath.c_str());
- PRINT_DEBUG_INFO
+
sweepClock1_->SetHandImage(UISweepClock::HandType::HOUR_HAND, *sweepClock1HourImage, {HOUR_POINT_POSITION_X, HOUR_POINT_POSITION_Y}, {HOUR_POINT_CENTER_X, HOUR_POINT_CENTER_Y});
Image *sweepClock1MinuteImage = new Image();
{
formattedDate = (day < 10 ? "0" : "") + std::to_string(day);
}
- PRINT_DEBUG_INFO
+
// 添加其他显示格式的处理逻辑
return formattedDate;
cJSON *date = cJSON_GetObjectItem(cjson_json, "date");
cJSON *textdisplay = cJSON_GetObjectItem(date, "textdisplay");
cJSON *coordinates = cJSON_GetObjectItem(textdisplay, "coordinates");
- PRINT_DEBUG_INFO
+
// const char *font = cJSON_GetObjectItem(textdisplay, "font")->valuestring;
int fontsize = cJSON_GetObjectItem(textdisplay, "fontsize")->valueint;
int date_left = cJSON_GetObjectItem(coordinates, "left")->valueint;
int date_top = cJSON_GetObjectItem(coordinates, "top")->valueint;
- PRINT_DEBUG_INFO
+
// Add Label to App
if (dateLable == nullptr)
{
dateLable->SetPosition(date_left, date_top); // widget's left position and top position
dateLable->SetViewId("label1"); // Set style
dateLable->SetStyle(STYLE_TEXT_FONT, fontsize);
- PRINT_DEBUG_INFO
+
std::string dateStr = "2024-02-09";
std::string displayformat = cJSON_GetObjectItem(textdisplay, "displayformat")->valuestring;
// 调用日期格式化函数
std::string formattedDate = FormatDate(dateStr, displayformat);
- PRINT_DEBUG_INFO
+
dateLable->SetText(formattedDate.c_str());
dateLable->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
dateLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
// Add to rootView
container_->Add(dateLable);
dateLable->SetVisible(true);
- PRINT_DEBUG_INFO
};
void Digital_clockView ::Initweek()
{
// Add to rootView
container_->Add(weekLable);
weekLable->SetVisible(true);
- PRINT_DEBUG_INFO
};
void Digital_clockView ::Initbattery()
{
progress1callback_ = new myProgressCallback(progress, batteryLable);
progress1animator_ = new Animator(progress1callback_, progress, 10000, true);
progress1animator_->Start();
- PRINT_DEBUG_INFO
};
/* InitView:初始化界面*/
bool Digital_clockView ::InitView()
{
std::string Dialtype = cJSON_GetObjectItem(cjson_json, "Dialtype")->valuestring;
Initbackground();
- PRINT_DEBUG_INFO
+
if (Dialtype == "pointer")
{
Initpointer();
Initbattery();
cJSON_Delete(cjson_json);
}
- PRINT_DEBUG_INFO
Add(container_);
- PRINT_DEBUG_INFO
+
SetCoverable(true);
PRINT_DEBUG_INFO
return true;
UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
while (view != nullptr)
{
- PRINT_DEBUG_INFO
+
UIView *tempView = view;
view = view->GetNextSibling();
if (tempView->GetParent())
}
delete container_;
container_ = nullptr;
- PRINT_DEBUG_INFO
}
void Digital_clockView::PreLoad(void)
}
}
- void Digital_clockView::UnLoad(void)
+ void Digital_clockView::UnLoad(void)
{
-
}
}
\r
UICardPage *MainViewSample::InitWatchFacePage(void)\r
{\r
-printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+\r
mainClockView = new MainClockView();\r
if (mainClockView == nullptr) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView new fail");\r
\r
UICardPage *MainViewSample::InitHeartRatePage(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
heartRateView = new HeartRateView();\r
if (heartRateView == nullptr) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "heartRateView new fail");\r
\r
UICardPage *MainViewSample::InitActivityPage(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
activityWeekView = new ActivityWeekView();\r
if (activityWeekView == nullptr) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "activityWeekView new fail");\r
\r
UICardPage *MainViewSample::InitCompassPage(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
compassControlView = new CompassControlView();\r
if (compassControlView == nullptr) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "compassControlView new fail");\r
\r
UICardPage *MainViewSample::InitMusicPlayerPage(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
playersView = new PlayersView();\r
if (playersView == nullptr) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView new fail");\r
\r
UICardPage *MainViewSample::InitNewDialPage(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
dialView = new Digital_clockView();\r
if (dialView == nullptr) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dialView new fail");\r
\r
UICardPage *MainViewSample::CreatePage(int32_t StreamId)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
uint16_t i;\r
UICardPage *view = nullptr;\r
int32_t cardId = ScreenModels::GetInstance()->GetCardPage(StreamId);\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CreatePage cardId:%d", cardId);\r
for (i = 0; i < sizeof(PageMapper) / sizeof(PageMapper[0]); i++) {\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::CreatePage PageMapper[i].id=%d, cardId=%d, StreamId=%d", PageMapper[i].id, cardId, StreamId);\r
- printf("MainViewSample::CreatePage PageMapper[i].id=%d, cardId=%d, StreamId=%d\n", PageMapper[i].id, cardId, StreamId);\r
+ \r
if (PageMapper[i].id == cardId) {\r
- printf("--%d--\n",PageMapper[i].id);\r
+ \r
view = (this->*(PageMapper[i].func))();\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CreatePage view:%p", view);\r
return view;\r
\r
void MainViewSample::AnimatorStart(int pageIndex)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
if (heartRateView != nullptr && pageIndex == ScreenModels::GetInstance()->GetCardPage(HEART_RATE)) {\r
heartRateView->HeartbeatImageAnimatorStart();\r
}\r
if ((mainClockView != nullptr && pageIndex == ScreenModels::GetInstance()->GetCardPage(WATCH_FACE)) &&\r
- mainSwipeGroup->GetCurrentPageId(UISwipeView::VERTICAL) == 1) {\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ mainSwipeGroup->GetCurrentPageId(UISwipeView::VERTICAL) == 2) {\r
mainClockView->ClockAnimatorStart();\r
}\r
- // if (dialView != nullptr && pageIndex == ScreenModels::GetInstance()->GetCardPage(NEW_DAIL)) {\r
- // printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
- // dialView->PreLoad();\r
- // }\r
+ if ((dialView != nullptr && pageIndex == ScreenModels::GetInstance()->GetCardPage(NEW_DAIL)) &&\r
+ mainSwipeGroup->GetCurrentPageId(UISwipeView::VERTICAL) == 1) {\r
+ dialView->PreLoad();\r
+ }\r
}\r
\r
void MainViewSample::AnimatorStop(void)\r
\r
bool MainViewSample::IsMainView(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
if (mainSwipeGroup->GetCurrentPageId(0) == ScreenModels::GetInstance()->GetCardPage(WATCH_FACE) &&\r
mainSwipeGroup->GetCurrentPageId(1) == 1) { // 0: horizontal; 1: vertical\r
return true;\r
\r
bool ScreenModels::InitCardConfig(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
if (SetUpListCase() == false) {\r
return false;\r
}\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "InitCardConfig2");\r
struct CardInfo cardInfoData;\r
if (fd < 0) {\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "InitCardConfig open fail");\r
fd = open(CARD_CONFIG_PATH, O_RDWR | O_CREAT, S_IRWXU);\r
if (fd < 0) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Init Read GlobalHealthToFile fail");\r
}\r
listMainView->PushBack(cardInfoData);\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
}\r
close(fd);\r
return true;\r
\r
bool ScreenModels::SaveCardConfig(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
int32_t fd = open(CARD_CONFIG_PATH, O_RDWR | O_CREAT, S_IRWXU);\r
if (fd < 0) {\r
close(fd);\r
\r
void ScreenModels::SetCardConfigDefault(void)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
int16_t i;\r
struct CardInfo cardInfoData;\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardConfigDefault");\r
for (i = 0; i < MAX_CARD; i++) {\r
cardInfoData.cardId = i;\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
listMainView->PushBack(cardInfoData);\r
}\r
}\r
\r
int16_t ScreenModels::GetCardPage(uint16_t page)\r
{\r
- printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+ \r
ListNode<CardInfo> *node = listMainView->Begin();\r
for (uint8_t i = 0; i < page; i++) {\r
if (node->next_ != NULL) {\r