From ce9a8a68f8b9ead42e9dfcf9c0f3083b5a37c022 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 10 Aug 2024 16:53:40 +0800 Subject: [PATCH] =?utf8?q?=E9=9F=B3=E4=B9=90=E6=92=AD=E6=94=BE=E5=99=A8?= =?utf8?q?=E5=A3=B0=E9=9F=B3=E8=B0=83=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/main/include/VolumeSettingPresenter.h | 6 +++--- .../fd230app/nativeui/main/include/VolumeSettingView.h | 4 ++-- .../fd230app/nativeui/main/src/VolumeSettingPresenter.cpp | 5 ++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingPresenter.h index 063bf6855..5bdd51a5e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:02 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-06 16:30:51 + * @LastEditTime: 2024-08-10 14:31:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingPresenter.h */ @@ -24,8 +24,8 @@ namespace OHOS { #define VOLUME_VIEW "volumeview" typedef enum : uint16_t { - VOLUMEPHONE = 1, - VOLUMEPLAYERS = 3, + VOLUMEPHONE = 1, //声音系数为:手机 + VOLUMEPLAYERS = 3,//声音系数为音乐播放器 VOLUMEPHONENOTIFY = 4, } VolumeFactor; diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h index bccd376ed..893074cb1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:02 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-07 15:25:29 + * @LastEditTime: 2024-08-10 14:29:29 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h */ @@ -26,7 +26,7 @@ class VolumeSettingView : public UIViewGroup { public: VolumeSettingView(); ~VolumeSettingView(); - int16_t sounding{0}; + int16_t sounding{0}; //音量值 UISlider *GetProgress(void); bool SetUpVolume(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingPresenter.cpp index b19428c21..022e16e8c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingPresenter.cpp @@ -18,6 +18,7 @@ #include "notification_manager.h" #include "BluetoothHeadsetEvent.h" #include "bts_avrcp_controller.h" +#include "ConfigModel.h" namespace OHOS { @@ -119,10 +120,12 @@ void VolumeSliderEventListener::ChangeVolume(VolumeChangeStatus status) if (playerCoefficients == VOLUMEPLAYERS) { BtAndLocalVolumeSet(volumeSettingView->sounding); + ConfigModel::GetInstance()->SetSystemVolume(volumeSettingView->sounding);/*将设置的音量保存到系统音量*/ } if (playerCoefficients == VOLUMEPHONE || playerCoefficients == VOLUMEPHONENOTIFY) { unsigned char volumeValue = (unsigned char) ((double) (volumeSettingView->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换 SetSpeakerVolume(volumeValue); + ConfigModel::GetInstance()->SetCallVolume(volumeSettingView->sounding);/*将设置的音量保存到通话音量*/ } } @@ -152,7 +155,7 @@ void VolumeSliderEventListener::SetPlayerCoefficients(int16_t value) void VolumeSliderEventListener::OnChange(int32_t value) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnChange %d", value); - ChangeVolume(VOLUMEDRAG); + // ChangeVolume(VOLUMEDRAG); } bool VolumeSliderEventListener::OnDrag(UIView& view, const DragEvent& event) -- 2.17.1