From: luozheng <1732036298@qq.com> Date: Sat, 14 Sep 2024 08:18:35 +0000 (+0800) Subject: 运动识别界面添加提醒标签,#192,解决,运动识别界面单一bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=80eb6b7ba8b38cc70df4e637a1d761e72b9390e8;p=mirrors%2FFD230.git 运动识别界面添加提醒标签,#192,解决,运动识别界面单一bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h index 58cb3e3db..8e80ddada 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h @@ -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}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp index 8d7780107..638232318 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp @@ -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(); }