#define WATCH_FONT_VALUE_TOP (WATCH_FONT_TOP + WATCH_ABOUT_TITLE_HEIGHT)\r
#define WATCH_CYWEEVER_TOP (WATCH_FONT_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT)\r
#define WATCH_CYWEEVER_TOP_VALUE_TOP (WATCH_CYWEEVER_TOP + WATCH_ABOUT_TITLE_HEIGHT)\r
+#define WATCH_SUPERVISIONINFO_TOP (WATCH_CYWEEVER_TOP_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT)\r
\r
namespace OHOS\r
{\r
delete APNprotocol;\r
APNprotocol = nullptr;\r
\r
+ delete SupervisionInfoTitleButton;\r
+ SupervisionInfoTitleButton = nullptr;\r
+ delete SupervisionInfoTitle;\r
+ SupervisionInfoTitle = nullptr;\r
+\r
delete SystemAboutTheWatchScrollView;\r
SystemAboutTheWatchScrollView = nullptr;\r
}\r
SystemAboutTheWatchScrollView->SetSwipeACCLevel(200); /*设置手指抬起屏幕后的补偿距离。*/\r
SystemAboutTheWatchScrollView->RequestFocus();\r
SystemAboutTheWatchScrollView->SetRotateFactor(1.0);\r
+ SystemAboutTheWatchScrollView->SetScrollBlankSize(75, OHOS::UIAbstractScroll::Direction::BOTTOM);\r
UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());\r
if (draglistener == nullptr)\r
{\r
CyweeVersion->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87));\r
SystemAboutTheWatchScrollView->Add(CyweeVersion);\r
\r
+ /* -------------------------------------------------------------------------- */\r
+ SupervisionInfoTitleButton = new UILabelButton();\r
+ if (SupervisionInfoTitleButton == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SupervisionInfoTitleButton new fail!");\r
+ return nullptr;\r
+ }\r
+ SupervisionInfoTitleButton->SetPosition((HORIZONTAL_RESOLUTION-380)/2, WATCH_SUPERVISIONINFO_TOP, 380, 100);\r
+ SupervisionInfoTitleButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+ SupervisionInfoTitleButton->SetViewId(VIEW_ID_SUPERVISIONINFO_TITLE_BUTTON);\r
+ SupervisionInfoTitleButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);\r
+ SupervisionInfoTitleButton->SetOnClickListener(SystemPresenter::GetInstance());\r
+ SystemAboutTheWatchScrollView->Add(SupervisionInfoTitleButton);\r
+ /* -------------------------------------------------------------------------- */\r
+ Config = {\r
+ .left = TITLE_LABEL_X,\r
+ .top = (int16_t)(SupervisionInfoTitleButton->GetY() + (SupervisionInfoTitleButton->GetHeight()-TITLE_LABEL_H) / 2),\r
+ .width = TITLE_LABEL_W,\r
+ .height = TITLE_LABEL_H,\r
+ .fontSize = TITLE_LABEL_FONTSIZE,\r
+ .lineHeigh = TITLE_LABEL_LINEHEIGHT,\r
+ .text = "监管信息",\r
+ .textId = 0,\r
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,\r
+ };\r
+ SupervisionInfoTitle = InitLabel(Config);\r
+ if (SupervisionInfoTitle == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SupervisionInfoTitle new fail!");\r
+ return nullptr;\r
+ }\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SupervisionInfoTitle:(%d,%d,%d,%d)",\r
+ SupervisionInfoTitle->GetX(),\r
+ SupervisionInfoTitle->GetY(),\r
+ SupervisionInfoTitle->GetWidth(),\r
+ SupervisionInfoTitle->GetHeight());\r
+ SystemAboutTheWatchScrollView->Add(SupervisionInfoTitle);\r
/* -------------------------------------------------------------------------- */\r
initViewStatus = true;\r
return SystemAboutTheWatchScrollView;\r
--- /dev/null
+#include "system/include/SystemSuperVisionInfoView.h"
+#include "system/include/SystemPresenter.h"
+#include "wearable_log.h"
+#include "common/screen.h"
+
+#define SUPERVISIONINFO_TITLE_HEIGHT 165
+#define SUPERVISIONINFO_VALUE_HEIGHT 55
+#define WatchModelTitle_POS_TOP 160
+#define WatchModel_POS_TOP (WatchModelTitle_POS_TOP + SUPERVISIONINFO_VALUE_HEIGHT)
+#define inputInfoTitle_POS_TOP (WatchModelTitle_POS_TOP + SUPERVISIONINFO_TITLE_HEIGHT)
+#define inputInfo1_POS_TOP (inputInfoTitle_POS_TOP + SUPERVISIONINFO_VALUE_HEIGHT)
+#define inputInfo2_POS_TOP (inputInfo1_POS_TOP + SUPERVISIONINFO_VALUE_HEIGHT)
+#define productNameTitle_POS_TOP (inputInfoTitle_POS_TOP + SUPERVISIONINFO_TITLE_HEIGHT)
+#define productName_POS_TOP (productNameTitle_POS_TOP + SUPERVISIONINFO_VALUE_HEIGHT)
+#define cmitTitle_POS_TOP (productNameTitle_POS_TOP + SUPERVISIONINFO_TITLE_HEIGHT)
+#define cmit_POS_TOP (cmitTitle_POS_TOP + SUPERVISIONINFO_VALUE_HEIGHT)
+#define companyNameTitle_POS_TOP (cmitTitle_POS_TOP + SUPERVISIONINFO_TITLE_HEIGHT)
+#define companyName_POS_TOP (companyNameTitle_POS_TOP + SUPERVISIONINFO_VALUE_HEIGHT)
+
+namespace OHOS
+{
+
+ static constexpr uint16_t TITLE_LABEL_X = 53;
+ static constexpr uint16_t TITLE_LABEL_W = 360;
+ static constexpr uint16_t TITLE_LABEL_H = 35;
+ static constexpr uint16_t TITLE_LABEL_FONTSIZE = 30;
+ static constexpr uint16_t TITLE_LABEL_LINEHEIGHT = 35;
+
+ static constexpr uint16_t LABEL_X = 33;
+ static constexpr uint16_t LABEL_W = 400;
+ static constexpr uint16_t LABEL_H = 35;
+ static constexpr uint16_t LABEL_FONTSIZE = 30;
+ static constexpr uint16_t LABEL_LINEHEIGHT = 35;
+
+ SystemSuperVisionInfoView::SystemSuperVisionInfoView()
+ {
+ }
+ SystemSuperVisionInfoView::~SystemSuperVisionInfoView()
+ {
+ ClearAll();
+ }
+
+ void SystemSuperVisionInfoView::ClearAll(void)
+ {
+ if (SystemSuperVisionInfoScrollView != nullptr)
+ {
+ SystemSuperVisionInfoScrollView->RemoveAll();
+ delete SystemSuperVisionInfoScrollView;
+ SystemSuperVisionInfoScrollView = nullptr;
+
+ if (title != nullptr)
+ {
+ delete title;
+ title = nullptr;
+ }
+ // 型号
+ if (watchModelTitle != nullptr)
+ {
+ delete watchModelTitle;
+ watchModelTitle = nullptr;
+ }
+ if (watchModel != nullptr)
+ {
+ delete watchModel;
+ watchModel = nullptr;
+ }
+ // 输入信息
+ if (inputInfoTitle != nullptr)
+ {
+ delete inputInfoTitle;
+ inputInfoTitle = nullptr;
+ }
+ if (inputInfo1 != nullptr)
+ {
+ delete inputInfo1;
+ inputInfo1 = nullptr;
+ }
+ if (inputInfo2 != nullptr)
+ {
+ delete inputInfo2;
+ inputInfo2 = nullptr;
+ }
+ // 产品名称
+ if (productNameTitle != nullptr)
+ {
+ delete productNameTitle;
+ productNameTitle = nullptr;
+ }
+ if (productName != nullptr)
+ {
+ delete productName;
+ productName = nullptr;
+ }
+ // CMIT ID
+ if (cmitTitle != nullptr)
+ {
+ delete cmitTitle;
+ cmitTitle = nullptr;
+ }
+ if (cmit != nullptr)
+ {
+ delete cmit;
+ cmit = nullptr;
+ }
+ // 公司名称
+ if (companyNameTitle != nullptr)
+ {
+ delete companyNameTitle;
+ companyNameTitle = nullptr;
+ }
+ if (companyName != nullptr)
+ {
+ delete companyName;
+ companyName = nullptr;
+ }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::ClearAll");
+ }
+ }
+
+ UILabelExt *SystemSuperVisionInfoView::InitLabel_Ext(LabelConfig &labelConfig)
+ {
+ UILabelExt *label = new UILabelExt();
+ if (label == nullptr)
+ {
+ return nullptr;
+ }
+ label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小
+ label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize); // 字体大小
+ label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh); // 字体行高
+ // label->SetText(labelConfig.text.c_str()); // 内容
+ label->SetTextId(labelConfig.textId);
+ label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP);
+ label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelConfig.fontSize);
+ return label;
+ }
+
+ UILabel *SystemSuperVisionInfoView::InitLabel(LabelConfig &labelConfig)
+ {
+ UILabel *label = new UILabel();
+ if (label == nullptr)
+ {
+ return nullptr;
+ }
+ label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小
+ label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize); // 字体大小
+ label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh); // 字体行高
+ label->SetText(labelConfig.text.c_str()); // 内容
+ label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。
+ label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP);
+ label->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, labelConfig.fontSize);
+ return label;
+ }
+
+ UIScrollView *SystemSuperVisionInfoView::SystemSuperVisionInfoViewInit(void)
+ {
+ SystemSuperVisionInfoScrollView = new UIScrollView();
+ if (SystemSuperVisionInfoScrollView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemSuperVisionInfoScrollView new fail!");
+ return nullptr;
+ }
+ SystemSuperVisionInfoScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ SystemSuperVisionInfoScrollView->SetViewId(SYSTEMSUPERVISIONINFOVIEWID);
+ SystemSuperVisionInfoScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ SystemSuperVisionInfoScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294);
+ SystemSuperVisionInfoScrollView->SetScrollBlankSize(30);
+ SystemSuperVisionInfoScrollView->SetReboundSize(30);
+ SystemSuperVisionInfoScrollView->SetDirection(1);
+ SystemSuperVisionInfoScrollView->SetThrowDrag(true);
+ SystemSuperVisionInfoScrollView->SetMaxScrollDistance(1000);
+ SystemSuperVisionInfoScrollView->SetSwipeACCLevel(200); /*设置手指抬起屏幕后的补偿距离。*/
+ SystemSuperVisionInfoScrollView->RequestFocus();
+ SystemSuperVisionInfoScrollView->SetRotateFactor(1.0);
+ SystemSuperVisionInfoScrollView->SetScrollBlankSize(30, OHOS::UIAbstractScroll::Direction::BOTTOM);
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::draglistener can not be nullptr!");
+ return nullptr;
+ }
+ SystemSuperVisionInfoScrollView->SetOnDragListener(draglistener);
+ /* -------------------------------------------------------------------------- */
+ LabelConfig Config = {
+ .left = 83,
+ .top = 50,
+ .width = 300,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .text = "监管信息",
+ .textId = 0,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+ };
+ title = InitLabel(Config);
+ if (title == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::title new fail!");
+ return nullptr;
+ }
+ SystemSuperVisionInfoScrollView->Add(title);
+ /* -------------------------------------------------------------------------- */
+ // 型号
+ Config = {
+ .left = TITLE_LABEL_X,
+ .top = WatchModelTitle_POS_TOP,
+ .width = TITLE_LABEL_W,
+ .height = TITLE_LABEL_H,
+ .fontSize = TITLE_LABEL_FONTSIZE,
+ .lineHeigh = TITLE_LABEL_LINEHEIGHT,
+ .text = "型号",
+ .textId = 0,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+ };
+ watchModelTitle = InitLabel(Config);
+ if (watchModelTitle == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::watchModelTitle new fail!");
+ return nullptr;
+ }
+ SystemSuperVisionInfoScrollView->Add(watchModelTitle);
+ /* -------------------------------------------------------------------------- */
+ Config = {
+ .left = LABEL_X,
+ .top = WatchModel_POS_TOP,
+ .width = LABEL_W,
+ .height = LABEL_H,
+ .fontSize = LABEL_FONTSIZE,
+ .lineHeigh = LABEL_LINEHEIGHT,
+ .text = "VITA",
+ .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+ };
+ watchModel = InitLabel(Config);
+ if (watchModel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::watchModel new fail!");
+ return nullptr;
+ }
+ watchModel->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff));
+ SystemSuperVisionInfoScrollView->Add(watchModel);
+ /* -------------------------------------------------------------------------- */
+ // 输入信息
+ Config = {
+ .left = TITLE_LABEL_X,
+ .top = inputInfoTitle_POS_TOP,
+ .width = TITLE_LABEL_W,
+ .height = TITLE_LABEL_H,
+ .fontSize = TITLE_LABEL_FONTSIZE,
+ .lineHeigh = TITLE_LABEL_LINEHEIGHT,
+ .text = "输入信息",
+ .textId = 0,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+ };
+ inputInfoTitle = InitLabel(Config);
+ if (inputInfoTitle == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::inputInfoTitle new fail!");
+ return nullptr;
+ }
+ SystemSuperVisionInfoScrollView->Add(inputInfoTitle);
+ /* -------------------------------------------------------------------------- */
+ Config = {
+ .left = LABEL_X,
+ .top = inputInfo1_POS_TOP,
+ .width = LABEL_W,
+ .height = LABEL_H,
+ .fontSize = LABEL_FONTSIZE,
+ .lineHeigh = LABEL_LINEHEIGHT,
+ .text = "5.0 V DC",
+ .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+ };
+ inputInfo1 = InitLabel(Config);
+ if (inputInfo1 == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::inputInfo1 new fail!");
+ return nullptr;
+ }
+ inputInfo1->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff));
+ SystemSuperVisionInfoScrollView->Add(inputInfo1);
+ /* -------------------------------------------------------------------------- */
+ Config = {
+ .left = LABEL_X,
+ .top = (int16_t)(inputInfo1->GetY() + inputInfo1->GetHeight() + 10),
+ .width = LABEL_W,
+ .height = LABEL_H,
+ .fontSize = LABEL_FONTSIZE,
+ .lineHeigh = LABEL_LINEHEIGHT,
+ .text = "500mA Max",
+ .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+ };
+ inputInfo2 = InitLabel(Config);
+ if (inputInfo2 == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::inputInfo2 new fail!");
+ return nullptr;
+ }
+ inputInfo2->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff));
+ SystemSuperVisionInfoScrollView->Add(inputInfo2);
+ /* -------------------------------------------------------------------------- */
+ // 产品名称
+ Config = {
+ .left = TITLE_LABEL_X,
+ .top = productNameTitle_POS_TOP,
+ .width = TITLE_LABEL_W,
+ .height = TITLE_LABEL_H,
+ .fontSize = TITLE_LABEL_FONTSIZE,
+ .lineHeigh = TITLE_LABEL_LINEHEIGHT,
+ .text = "产品名称",
+ .textId = 0,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+ };
+ productNameTitle = InitLabel(Config);
+ if (productNameTitle == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::productNameTitle new fail!");
+ return nullptr;
+ }
+ SystemSuperVisionInfoScrollView->Add(productNameTitle);
+ /* -------------------------------------------------------------------------- */
+ Config = {
+ .left = LABEL_X,
+ .top = productName_POS_TOP,
+ .width = LABEL_W,
+ .height = LABEL_H,
+ .fontSize = LABEL_FONTSIZE,
+ .lineHeigh = LABEL_LINEHEIGHT,
+ .text = "智能手表",
+ .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+ };
+ productName = InitLabel(Config);
+ if (productName == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::productName new fail!");
+ return nullptr;
+ }
+ productName->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff));
+ SystemSuperVisionInfoScrollView->Add(productName);
+ /* -------------------------------------------------------------------------- */
+ // CMIT ID
+ Config = {
+ .left = TITLE_LABEL_X,
+ .top = cmitTitle_POS_TOP,
+ .width = TITLE_LABEL_W,
+ .height = TITLE_LABEL_H,
+ .fontSize = TITLE_LABEL_FONTSIZE,
+ .lineHeigh = TITLE_LABEL_LINEHEIGHT,
+ .text = "CMIT ID",
+ .textId = 0,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+ };
+ cmitTitle = InitLabel(Config);
+ if (cmitTitle == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::cmitTitle new fail!");
+ return nullptr;
+ }
+ SystemSuperVisionInfoScrollView->Add(cmitTitle);
+ /* -------------------------------------------------------------------------- */
+ Config = {
+ .left = LABEL_X,
+ .top = cmit_POS_TOP,
+ .width = LABEL_W,
+ .height = LABEL_H,
+ .fontSize = LABEL_FONTSIZE,
+ .lineHeigh = LABEL_LINEHEIGHT,
+ .text = "XXXXXXXXXXX",
+ .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+ };
+ cmit = InitLabel(Config);
+ if (cmit == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::cmit new fail!");
+ return nullptr;
+ }
+ cmit->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff));
+ SystemSuperVisionInfoScrollView->Add(cmit);
+ /* -------------------------------------------------------------------------- */
+ // 公司名称
+ Config = {
+ .left = TITLE_LABEL_X,
+ .top = companyNameTitle_POS_TOP,
+ .width = TITLE_LABEL_W,
+ .height = TITLE_LABEL_H,
+ .fontSize = TITLE_LABEL_FONTSIZE,
+ .lineHeigh = TITLE_LABEL_LINEHEIGHT,
+ .text = "杭州扶鹰健康\n科技有限公司",
+ .textId = 0,
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,
+ };
+ companyNameTitle = InitLabel(Config);
+ if (companyNameTitle == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::companyNameTitle new fail!");
+ return nullptr;
+ }
+ companyNameTitle->SetX((HORIZONTAL_RESOLUTION - companyNameTitle->GetWidth()) / 2);
+ SystemSuperVisionInfoScrollView->Add(companyNameTitle);
+ /* -------------------------------------------------------------------------- */
+ Config = {
+ .left = LABEL_X,
+ .top = (int16_t)(companyNameTitle->GetY() + companyNameTitle->GetHeight() + 35),
+ .width = LABEL_W,
+ .height = LABEL_H,
+ .fontSize = LABEL_FONTSIZE,
+ .lineHeigh = LABEL_LINEHEIGHT,
+ .text = "中国制造",
+ .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+ };
+ companyName = InitLabel(Config);
+ if (companyName == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemSuperVisionInfoView::companyName new fail!");
+ return nullptr;
+ }
+ companyName->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff));
+ SystemSuperVisionInfoScrollView->Add(companyName);
+ /* -------------------------------------------------------------------------- */
+ return SystemSuperVisionInfoScrollView;
+ }
+}
\ No newline at end of file