From: luozheng <1732036298@qq.com> Date: Thu, 14 Mar 2024 03:28:40 +0000 (+0800) Subject: 录音界面优化 X-Git-Tag: release_V1.2.70_20241020_135402~1274^2~8^2~12 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=09bf51fc5d105beae9e93f168a9d58602691c033;p=mirrors%2FFD230.git 录音界面优化 --- 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 b7d718e6c..6b4a047a2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h @@ -111,6 +111,15 @@ namespace OHOS bool OnDrag(UIView &view, const DragEvent &event) override; }; + class RecordingVolumeSettingViewDragLister : public UIView::OnDragListener + { + public: + RecordingVolumeSettingViewDragLister() {} + ~RecordingVolumeSettingViewDragLister(){} + bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView &view, const DragEvent &event) override; + }; + class RecordingModel; class RecordingView; class RecordingPresenter : public Presenter, diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingVolumeSettingView.h b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingVolumeSettingView.h index 92e6421ee..e35bd1626 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingVolumeSettingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingVolumeSettingView.h @@ -16,6 +16,7 @@ namespace OHOS private: SoundAndVibrationVolumeSettingView *p_SoundAndVibrationVolumeSettingView{nullptr}; UIScrollView *RecordingVolumeSettingViewScrollView{nullptr}; + UIView::OnDragListener *volumeDragListener{nullptr}; bool initViewStatus{false}; }; 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 73cf1f2da..4dc917977 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp @@ -11,15 +11,6 @@ #include namespace OHOS { - // 声明定时器变量 - osTimerId_t g_timer = NULL; - static int g_RecordingTimes = {0}; - static constexpr int32 NUM_TEN = 10; - static constexpr int16 ERROR = 0; - static constexpr int16 SUCCESS = 1; - static constexpr int16 NUM_TIME_MIN = 60; - static constexpr int16 NUM_TIME_HOUR = 3600; - static constexpr int32 NUM_TIME_DAY = 86400; static MutexId g_mutex; RecordingModel::RecordingModel() @@ -615,7 +606,16 @@ namespace OHOS } /* ----------------------------------- 定时器 ---------------------------------- */ - + // 声明定时器变量 + osTimerId_t g_timer = NULL; + static int g_RecordingTimes = {0}; + static constexpr int32 NUM_TEN = 10; + static constexpr int16 ERROR = 0; + static constexpr int16 SUCCESS = 1; + static constexpr int16 NUM_TIME_MIN = 60; + static constexpr int16 NUM_TIME_HOUR = 3600; + static constexpr int32 NUM_TIME_DAY = 86400; + /* * @brief 显示录音时长 */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp index e70e20f76..06d87ff7d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp @@ -389,7 +389,12 @@ namespace OHOS } if (GetPlayerButton() != nullptr) { - SetPlayerButtonState(UICheckBox::UICheckBoxState::UNSELECTED); + RecordingModel *p_RecordingModel = RecordingModel::GetInstance(); + int32_t playerState = p_RecordingModel->GetRecordingPlayerState(); + if (playerState != PlayerStates::PLAYER_STARTED) + { + SetPlayerButtonState(UICheckBox::UICheckBoxState::UNSELECTED); + } } } 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 51455329f..92f0f2c06 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -57,10 +57,11 @@ namespace OHOS Presenter::OnStop(); if (p_RecordingModel->GetPlayerCtr() != nullptr) { - p_RecordingModel->GetPlayerCtr()->Stop(); + // p_RecordingModel->GetPlayerCtr()->Stop(); p_RecordingModel->GetPlayerCtr()->Reset(); p_RecordingModel->GetPlayerCtr()->Release(); p_RecordingModel->SetAudioInitStatus(false); + p_RecordingModel->ClearActivateAudioInterrupt(); p_RecordingModel->GetPlayerCtr().reset(); } ScreenAlwaysOnCtr(0); @@ -89,18 +90,17 @@ namespace OHOS if (i == RECORDINGVIEW) { NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + return true; } else if (i == RECORDINGPLAYERVIEW) { p_RecordingView->ChangeView(i, RECORDINGLISTVIEW); - } - else if(i == RECORDINGVOLUMESETTINGVIEW) - { - p_RecordingView->ChangeView(i, RECORDINGPLAYERVIEW); + return true; } else { p_RecordingView->ChangeView(i, RECORDINGVIEW); + return true; } break; } @@ -306,6 +306,27 @@ namespace OHOS return true; } + bool RecordingVolumeSettingViewDragLister::OnDrag(UIView &view, const DragEvent &event) + { + return true; + } + + bool RecordingVolumeSettingViewDragLister::OnDragEnd(UIView &view, const DragEvent &event) + { + UNUSED(view); + RecordingView *p_RecordingView = RecordingView::GetInstance(); + if (p_RecordingView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingView GetInstance fail"); + return false; + } + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) + { + p_RecordingView->ChangeView(RECORDINGVOLUMESETTINGVIEW, RECORDINGPLAYERVIEW); + } + return true; + } + /* * @brief 播放按钮被点击 */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp index 32f5edfad..5c08bd8d9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp @@ -15,7 +15,7 @@ namespace OHOS RecordingVolumeSettingView::~RecordingVolumeSettingView() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingVolumeSettingView::~RecordingVolumeSettingView"); - + ClearAll(); g_pRecordingVolumeSettingView = nullptr; } @@ -28,6 +28,9 @@ namespace OHOS { if (initViewStatus == true) { + delete volumeDragListener; + volumeDragListener = nullptr; + delete p_SoundAndVibrationVolumeSettingView; p_SoundAndVibrationVolumeSettingView = nullptr; } @@ -43,7 +46,7 @@ namespace OHOS return nullptr; } RecordingVolumeSettingViewScrollView = p_SoundAndVibrationVolumeSettingView->SetUpVolumeProcess(); - UIView::OnDragListener *volumeDragListener = (UIView::OnDragListener *)OHOS::RecordingPresenter::GetInstance(); + volumeDragListener = static_cast(new RecordingVolumeSettingViewDragLister()); if (volumeDragListener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPresenter GetInstance fail"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp index 63f6517ce..31d1ee375 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp @@ -160,7 +160,7 @@ namespace OHOS */ void VoumeProcessSliderEventListener::LocalVolumeSet(int16_t sounding) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BtAndLocalVolumeSet %d", sounding); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "LocalVolumeSet %d", sounding); Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 本地音量设置 }