From: luozheng <1732036298@qq.com> Date: Mon, 28 Oct 2024 11:06:22 +0000 (+0800) Subject: #1121,解决,开启录音时录音按钮需点击几下才能停止录音bug X-Git-Tag: fd230_release_V1.3.102~171^2~1^2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1277%2F3;p=mirrors%2FFD230.git #1121,解决,开启录音时录音按钮需点击几下才能停止录音bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordGoingView.h b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordGoingView.h index 362811a2c..124256072 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordGoingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordGoingView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-13 14:32:55 + * @LastEditTime: 2024-10-28 18:56:01 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordGoingView.h */ #ifndef RECORD_GOING_VIEW_H @@ -56,6 +56,7 @@ namespace OHOS UILabel *Timer{nullptr}; // 显示录音时长 UIImageView *RECORD_GOING_IMAGE{nullptr}; UIButton *RECORD_GOING_BUTTON{nullptr}; + UIButton *STOP_RECORD_GOING_BUTTON{nullptr}; }; } // namespace OHOS #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp index 7a8a9739d..dcc249379 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp @@ -46,6 +46,9 @@ namespace OHOS delete RecordGoingLabel; RecordGoingLabel = nullptr; + delete STOP_RECORD_GOING_BUTTON; + STOP_RECORD_GOING_BUTTON = nullptr; + delete RecordGoingViewScrollView; RecordGoingViewScrollView = nullptr; } @@ -77,6 +80,7 @@ namespace OHOS RECORD_GOING_BUTTON, Timer, RecordGoingLabel, + STOP_RECORD_GOING_BUTTON, }; int numViews = sizeof(viewsToAdd) / sizeof(viewsToAdd[0]); @@ -225,13 +229,24 @@ namespace OHOS return false; } RECORD_GOING_BUTTON->SetPosition(210, 180, 60, 60); - RECORD_GOING_BUTTON->SetViewId(RECORD_GOING_BUTTON_VIEWID); RECORD_GOING_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36); RECORD_GOING_BUTTON->SetStyle(STYLE_BORDER_RADIUS, 20); RECORD_GOING_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffff5a36, UIButton::PRESSED); RECORD_GOING_BUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 20, UIButton::PRESSED); + /* -------------------------------------------------------------------------- */ + STOP_RECORD_GOING_BUTTON = new UIButton(); + if (STOP_RECORD_GOING_BUTTON == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordGoingView::STOP_RECORD_GOING_BUTTON new fail!"); + return false; + } + STOP_RECORD_GOING_BUTTON->SetPosition(158, 129, 150, 150); + STOP_RECORD_GOING_BUTTON->SetViewId(RECORD_GOING_BUTTON_VIEWID); + STOP_RECORD_GOING_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36); + STOP_RECORD_GOING_BUTTON->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + STOP_RECORD_GOING_BUTTON->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); UIView::OnClickListener *clickListener = static_cast(RecordingPresenter::GetInstance()); - RECORD_GOING_BUTTON->SetOnClickListener(clickListener); + STOP_RECORD_GOING_BUTTON->SetOnClickListener(clickListener); return true; } @@ -252,6 +267,7 @@ namespace OHOS RecordGoingViewScrollView->Add(RECORD_GOING_BUTTON); RecordGoingViewScrollView->Add(Timer); RecordGoingViewScrollView->Add(RecordGoingLabel); + RecordGoingViewScrollView->Add(STOP_RECORD_GOING_BUTTON); #endif return RecordGoingViewScrollView; }