增加电量百分比,日期,星期静态显示
authorCaisking <3449750381@qq.com>
Tue, 19 Dec 2023 03:24:01 +0000 (11:24 +0800)
committerCaisking <3449750381@qq.com>
Tue, 19 Dec 2023 03:24:01 +0000 (11:24 +0800)
code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp

index f4114b0..a02a39c 100755 (executable)
@@ -69,9 +69,6 @@ static constexpr uint16_t HOUR_POINT_CENTER_Y = 146;
 
 
 
-
-
-
 MainClockView::MainClockView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainClockView::MainClockView");
@@ -88,6 +85,14 @@ MainClockView::~MainClockView()
         clockAnimator = nullptr;
     }
     mainSweepClock->RemoveAll();
+     
+    delete batteryLabel;
+    batteryLabel = nullptr;
+    delete weekLabel;
+    weekLabel = nullptr;
+    delete dataLabel;
+    dataLabel = nullptr;
+
  #if 0
     delete curFace;
     curFace = nullptr;
@@ -206,7 +211,7 @@ bool MainClockView::InitLabelView(void)
     weekLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_TEXT_SIZE);
     weekLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
 #endif
-#if 1
+#if 0
     printf("lable init\n");
     batteryLabel = new UILabel();
     if (batteryLabel == nullptr) {
@@ -368,7 +373,7 @@ bool MainClockView::InitSweepClock(void)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "curFace LoadClockImage CLOCK_MAIN_FACE_IMAGE fail");
         return false;
     }
-    InitLabelView();
+    //InitLabelView();
 #if 0
     if (InitLabelView() == false) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabelView() fail");
@@ -401,6 +406,49 @@ bool MainClockView::InitSweepClock(void)
     }
 #endif
     InitHandView();
+    /**************************************************************/
+    printf("lable init\n");
+    batteryLabel = new UILabel();
+    if (batteryLabel == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryLabel new fail");
+        return false;
+    }
+    batteryLabel->SetPosition(228, 52);         // widget's left position and top position
+    batteryLabel->Resize(66, 33); 
+    batteryLabel->SetText("2%");
+    batteryLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    batteryLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
+    batteryLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+    //mainSweepClock->Add(batteryLabel);
+    if (dataLabel == nullptr) {
+        dataLabel = new UILabel();
+    }
+    dataLabel->SetPosition(177, 358);         // widget's left position and top position
+    dataLabel->Resize(200, 60);          // widget's width and height
+    dataLabel->SetViewId("data");// Set style
+    dataLabel->SetStyle(STYLE_TEXT_FONT, 30);
+    dataLabel->SetStyle(STYLE_LINE_HEIGHT, 30);
+    dataLabel->SetText("12月22号");
+    dataLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+    dataLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    dataLabel->SetRollSpeed(0);
+    dataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+    //mainSweepClock->Add(dataLabel);
+    if (weekLabel == nullptr) {
+        weekLabel = new UILabel();
+    }
+    weekLabel->SetPosition(194, 395);         // widget's left position and top position
+    //weekLabel->Resize(200, 60);          // widget's width and height
+    weekLabel->SetViewId("weekday");// Set style
+    weekLabel->SetStyle(STYLE_TEXT_FONT, 30);
+    weekLabel->SetStyle(STYLE_LINE_HEIGHT, 30);
+    weekLabel->SetText("星期五");
+    weekLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+    weekLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+    weekLabel->SetRollSpeed(0);
+    weekLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
+    /**************************************************************/
+    //InitLabelView();
 #if 0
     weekDay = new UIImageView();
     if (weekDay == nullptr) {