From c45a1783eeb3ee4d1b44a0a8cf76c32b7acd6695 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sun, 20 Oct 2024 18:53:41 +0800 Subject: [PATCH] =?utf8?q?=E5=BD=95=E9=9F=B3=E5=88=B7=E6=96=B0=E9=87=87?= =?utf8?q?=E7=94=A8Notify=E5=88=B7=E6=96=B0UI=E8=80=8C=E4=B8=8D=E5=86=8D?= =?utf8?q?=E4=BD=BF=E7=94=A8timer=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/record/include/RecordingPresenter.h | 7 +++++-- .../nativeui/record/src/RecordingModel.cpp | 6 +++++- .../nativeui/record/src/RecordingPresenter.cpp | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h index 80b6fe24e..5d29727b1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-27 09:16:51 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-28 15:44:25 + * @LastEditTime: 2024-10-20 17:08:05 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h */ @@ -16,6 +16,7 @@ #include "common/key_code.h" #include "record/include/RecordingModel.h" #include +#include "ModelListenerSample.h" namespace OHOS { /*正在录音视图*/ @@ -115,7 +116,8 @@ namespace OHOS class RecordingPresenter : public Presenter, public UIView::OnClickListener, public RootView::OnKeyActListener, - public UIView::OnDragListener + public UIView::OnDragListener, + public ModelListenerSample { public: RecordingPresenter(); @@ -136,6 +138,7 @@ namespace OHOS bool OnDrag(UIView &view, const DragEvent &event) override; bool OnDragEnd(UIView &view, const DragEvent &event) override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; + void Notify() override; void SetCircleProgress(); void StartRecord(void); void StopRecord(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp index a1bf8d5a0..bbabf12f2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp @@ -980,6 +980,7 @@ namespace OHOS */ static void Recording_TimerCallbackProc(int data) { + #if 0 g_RecordingTimes++; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "g_RecordingTimes:%d\n", g_RecordingTimes); @@ -1002,6 +1003,7 @@ namespace OHOS } RecordGoingView::GetInstance()->GetRecordingDurationLabel()->SetText(RecordingModel::GetInstance()->DisplayRecordDuration()); + #endif } /* @@ -1009,7 +1011,9 @@ namespace OHOS */ static void Recording_TimerCallback(int data) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(Recording_TimerCallbackProc, data)); + g_RecordingTimes++; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "g_RecordingTimes:%d\n", g_RecordingTimes); + // GraphicService::GetInstance()->PostGraphicEvent(std::bind(Recording_TimerCallbackProc, data)); } /* diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp index 46f71344a..d6a1544b3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-14 19:26:52 + * @LastEditTime: 2024-10-20 17:14:02 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp */ @@ -300,6 +300,19 @@ namespace OHOS return true; } + void RecordingPresenter::Notify() + { + //如果是在正在录音视图且正在录音视图为可见 + if(view_->GetRecordingViewScrollView(RECORDGOINGVIEW) && view_->GetRecordingViewScrollView(RECORDGOINGVIEW)->IsVisible()) + { + if(RecordGoingView::GetInstance()->GetRecordingDurationLabel()) + { + RecordGoingView::GetInstance()->GetRecordingDurationLabel()->SetText(RecordingModel::GetInstance()->DisplayRecordDuration()); + } + } + } + + void RecordingPresenter::SetCircleProgress() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPresenter::SetCircleProgress"); -- 2.17.1