运动识别界面添加提醒标签,#192,解决,运动识别界面单一bug
authorluozheng <1732036298@qq.com>
Sat, 14 Sep 2024 08:18:35 +0000 (16:18 +0800)
committerluozheng <1732036298@qq.com>
Sat, 14 Sep 2024 08:18:35 +0000 (16:18 +0800)
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp

index 58cb3e3..8e80dda 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 17:29:18
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-24 18:03:56
+ * @LastEditTime: 2024-09-14 15:56:07
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h
  */
 #ifndef MOTION_RECOGNITION_VIEW_H
@@ -39,6 +39,7 @@ namespace OHOS
         UIImageView *MotionRecognitionImage = nullptr;
         UILabelExt *MotionRecognitionLabel = nullptr;
         UIToggleButton *MotionRecognitionToggleButton = nullptr;
+        UILabelExt *note{nullptr};
         bool viewInitStatus{false};
     };
 }
index 8d77801..6382323 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 17:28:52
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-24 18:16:10
+ * @LastEditTime: 2024-09-14 16:14:37
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
  */
 #include "motionrecognition/include/MotionRecognitionPresenter.h"
@@ -62,6 +62,11 @@ namespace OHOS
                 delete MotionRecognitionToggleButton;
                 MotionRecognitionToggleButton = nullptr;
             }
+            if (note != nullptr)
+            {
+                delete note;
+                note = nullptr;
+            }
 
             delete scrollView;
             scrollView = nullptr;
@@ -133,6 +138,24 @@ namespace OHOS
             /* ----------------------------- onclickListener ---------------------------- */
             // MotionRecognitionToggleButton->SetOnClickListener(presenter_);
             MotionRecognitionToggleButton->SetOnChangeListener(presenter_);
+            /* -------------------------------------------------------------------------- */
+            if (note == nullptr)
+            {
+                note = new UILabelExt();
+                if (note == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::note can not be nullptr!");
+                    return;
+                }
+            }
+            note->SetPosition(63, MotionRecognitionImage->GetY() + MotionRecognitionImage->GetHeight() + 20, 340, 80);
+            note->SetStyle(STYLE_TEXT_FONT, 26);
+            note->SetStyle(STYLE_LINE_HEIGHT, 40);
+            note->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
+            note->SetText("开启后,手表会在检测到你处于运动状态时发出提醒。支持的运动包括:走路、跑步、骑车、划船机、椭圆机。"); /*自动识别*/
+            note->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
+            /* -------------------------------------------------------------------------- */
 
             viewInitStatus = true;
             /* -------------------------------------------------------------------------- */
@@ -170,6 +193,7 @@ namespace OHOS
         scrollView->Add(MotionRecognitionImage);
         scrollView->Add(MotionRecognitionLabel);
         scrollView->Add(MotionRecognitionToggleButton);
+        scrollView->Add(note);
         container_->Add(scrollView);
         Draw();
     }