161 lines
7.0 KiB
C++
161 lines
7.0 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description:
|
|
*
|
|
* Author: huangshuyi
|
|
*
|
|
* Create: 2024-8
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
#include "TjdUiFemaleConnectNoDataPage.h"
|
|
#include "components/ui_label.h"
|
|
#include "wearable_log.h"
|
|
#include "common/image_cache_manager.h"
|
|
#include <time.h>
|
|
#include <unordered_map>
|
|
#include "gfx_utils/image_info.h"
|
|
#include "gfx_utils/heap_base.h"
|
|
#include "TjdUiImageIds.h"
|
|
#include "ui_label.h"
|
|
#include "ui_label_ext.h"
|
|
#include "components/ui_label_ext.h"
|
|
#include "TjdUiMultiLanguageExt.h"
|
|
#include "sys_config.h"
|
|
#include "components/ui_view.h"
|
|
#include "TjdUiMemManage.h"
|
|
#include <ctime>
|
|
#include "sql_message.h"
|
|
#include "TjdUiFemaleHealthView.h"
|
|
|
|
using namespace OHOS;
|
|
|
|
namespace TJD {
|
|
|
|
#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__) //错误信息打印一般常开
|
|
#define static_print_debug(...) sys_ui_log_d(__VA_ARGS__)
|
|
#else
|
|
#define static_print_info(...)
|
|
#define static_print_warn(...)
|
|
#define static_print_error(...)
|
|
#define static_print_debug(...)
|
|
#endif
|
|
|
|
#define IMAGE_BIN_PATH TJD_IMAGE_PATH"img_female.bin"
|
|
|
|
|
|
static TjdUiFemaleConnectNoDataPage *g_pFemaleConnectNoData = nullptr;
|
|
|
|
|
|
TjdUiFemaleConnectNoDataPage::TjdUiFemaleConnectNoDataPage()
|
|
{
|
|
//SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
|
|
g_pFemaleConnectNoData = this;
|
|
}
|
|
|
|
TjdUiFemaleConnectNoDataPage::~TjdUiFemaleConnectNoDataPage()
|
|
{
|
|
g_pFemaleConnectNoData = nullptr;
|
|
}
|
|
|
|
TjdUiFemaleConnectNoDataPage *TjdUiFemaleConnectNoDataPage::GetInstance(void)
|
|
{
|
|
return g_pFemaleConnectNoData;
|
|
}
|
|
|
|
void TjdUiFemaleConnectNoDataPage::HideView(void)
|
|
{
|
|
static_print_debug("TjdUiFemaleConnectNoDataPage::HideView\n");
|
|
pageGroup_->SetVisible(false);
|
|
}
|
|
|
|
void TjdUiFemaleConnectNoDataPage::ShowView(void)
|
|
{
|
|
static_print_debug("TjdUiFemaleConnectNoDataPage::ShowView\n");
|
|
pageGroup_->SetVisible(true);
|
|
}
|
|
|
|
static UIView* healthDisplayViewArray[7];
|
|
UIViewGroup *TjdUiFemaleConnectNoDataPage::PageInit(void)
|
|
{
|
|
UIViewGroup *container = (UIViewGroup *)TjdUiFemaleHealthView::GetInstance()->GetContainer();
|
|
pageGroup_ = new UIViewGroup();
|
|
pageGroup_->SetTouchable(true);
|
|
pageGroup_->SetOnDragListener(this);
|
|
pageGroup_->SetDraggable(true);
|
|
|
|
container->Add(pageGroup_);
|
|
pageGroup_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
|
|
//pageGroup_->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full);
|
|
UILabel *labelFemale = new UILabel();
|
|
labelFemale->SetFont(TJD_VECTOR_FONT_FILENAME, 30);
|
|
pageGroup_->Add(labelFemale);
|
|
labelFemale->SetText("经期跟踪");
|
|
//labelFemale->SetPosition(0, 0, Screen::GetInstance().GetWidth(), 50);
|
|
//labelFemale->SetFont(TJD_VECTOR_FONT_FILENAME, TJD_FONT_SIZE_28);
|
|
labelFemale->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
|
|
labelFemale->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
|
|
labelFemale->LayoutLeftOfParent((pageGroup_->GetWidth() - labelFemale->GetWidth()) / 2);
|
|
labelFemale->LayoutTopOfParent(20);
|
|
|
|
for (uint8_t i = 0; i < 7; i++) {
|
|
UIView* healthDisplayView = new UIView();
|
|
pageGroup_->Add(healthDisplayView);
|
|
healthDisplayView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full);
|
|
healthDisplayView->SetStyle(STYLE_BORDER_RADIUS, 50);
|
|
healthDisplayViewArray[i] = healthDisplayView;
|
|
}
|
|
healthDisplayViewArray[3]->SetWidth(100);
|
|
healthDisplayViewArray[3]->SetHeight(160);
|
|
healthDisplayViewArray[3]->LayoutTopOfParent(110);
|
|
healthDisplayViewArray[3]->LayoutLeftOfParent((pageGroup_->GetWidth() - healthDisplayViewArray[3]->GetWidth()) / 2);
|
|
healthDisplayViewArray[3]->SetViewId("View3");
|
|
healthDisplayViewArray[2]->SetWidth(healthDisplayViewArray[3]->GetWidth()*0.7);
|
|
healthDisplayViewArray[2]->SetHeight(healthDisplayViewArray[3]->GetHeight()*0.7);
|
|
healthDisplayViewArray[2]->AlignVerCenterToSibling(healthDisplayViewArray[3]->GetViewId(), 0);
|
|
healthDisplayViewArray[2]->LayoutLeftToSibling(healthDisplayViewArray[3]->GetViewId(), 5);
|
|
healthDisplayViewArray[2]->SetViewId("View2");
|
|
healthDisplayViewArray[1]->SetWidth(healthDisplayViewArray[2]->GetWidth()*0.6);
|
|
healthDisplayViewArray[1]->SetHeight(healthDisplayViewArray[2]->GetHeight()*0.6);
|
|
healthDisplayViewArray[1]->AlignVerCenterToSibling(healthDisplayViewArray[2]->GetViewId(), 0);
|
|
healthDisplayViewArray[1]->LayoutLeftToSibling(healthDisplayViewArray[2]->GetViewId(), 5);
|
|
healthDisplayViewArray[1]->SetViewId("View1");
|
|
healthDisplayViewArray[0]->SetWidth(healthDisplayViewArray[1]->GetWidth()*0.4);
|
|
healthDisplayViewArray[0]->SetHeight(healthDisplayViewArray[1]->GetHeight()*0.4);
|
|
healthDisplayViewArray[0]->AlignVerCenterToSibling(healthDisplayViewArray[1]->GetViewId(), 0);
|
|
healthDisplayViewArray[0]->LayoutLeftToSibling(healthDisplayViewArray[1]->GetViewId(), 5);
|
|
healthDisplayViewArray[0]->SetViewId("View0");
|
|
healthDisplayViewArray[4]->SetWidth(healthDisplayViewArray[3]->GetWidth()*0.7);
|
|
healthDisplayViewArray[4]->SetHeight(healthDisplayViewArray[3]->GetHeight()*0.7);
|
|
healthDisplayViewArray[4]->AlignVerCenterToSibling(healthDisplayViewArray[3]->GetViewId(), 0);
|
|
healthDisplayViewArray[4]->LayoutRightToSibling(healthDisplayViewArray[3]->GetViewId(), 5);
|
|
healthDisplayViewArray[4]->SetViewId("View4");
|
|
healthDisplayViewArray[5]->SetWidth(healthDisplayViewArray[4]->GetWidth()*0.6);
|
|
healthDisplayViewArray[5]->SetHeight(healthDisplayViewArray[4]->GetHeight()*0.6);
|
|
healthDisplayViewArray[5]->AlignVerCenterToSibling(healthDisplayViewArray[4]->GetViewId(), 0);
|
|
healthDisplayViewArray[5]->LayoutRightToSibling(healthDisplayViewArray[4]->GetViewId(), 5);
|
|
healthDisplayViewArray[5]->SetViewId("View5");
|
|
healthDisplayViewArray[6]->SetWidth(healthDisplayViewArray[5]->GetWidth()*0.4);
|
|
healthDisplayViewArray[6]->SetHeight(healthDisplayViewArray[5]->GetHeight()*0.4);
|
|
healthDisplayViewArray[6]->AlignVerCenterToSibling(healthDisplayViewArray[5]->GetViewId(), 0);
|
|
healthDisplayViewArray[6]->LayoutRightToSibling(healthDisplayViewArray[5]->GetViewId(), 5);
|
|
healthDisplayViewArray[6]->SetViewId("View6");
|
|
|
|
UILabel *labelNoData = new UILabel();
|
|
labelNoData->SetFont(TJD_VECTOR_FONT_FILENAME, 30);
|
|
pageGroup_->Add(labelNoData);
|
|
labelNoData->SetText("当前无数据,请移至APP设置");
|
|
labelNoData->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
|
|
labelNoData->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
|
|
labelNoData->LayoutLeftOfParent((pageGroup_->GetWidth() - labelNoData->GetWidth()) / 2);
|
|
labelNoData->SetY(340);
|
|
static_print_debug("TjdUiFemaleConnectNoDataPage::PageInit end\n");
|
|
return pageGroup_;
|
|
}
|
|
|
|
}
|