录音界面实现声音调节功能
authorluozheng <1732036298@qq.com>
Wed, 13 Mar 2024 12:34:34 +0000 (20:34 +0800)
committerluozheng <1732036298@qq.com>
Wed, 13 Mar 2024 12:34:34 +0000 (20:34 +0800)
12 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingPresenter.h
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h
code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingVolumeSettingView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingView.cpp
code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingView.h
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumePresenter.h
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumeView.h
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingView.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp

index 1cf81a6..66a9a9f 100644 (file)
@@ -326,6 +326,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingModel.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/record/src/RecordingVolumeSettingView.cpp
 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessageAdapter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessageItemView.cpp
index 5bec3da..b7d718e 100644 (file)
@@ -11,11 +11,12 @@ namespace OHOS
 {\r
     typedef enum\r
     {\r
-        RECORDINGVIEW = 0,   // 录音视图(slice)\r
-        RECORDINGLISTVIEW,   // 录音列表视图(subView)\r
-        RECORDGOINGVIEW,     // 正在录音视图(subView)\r
-        RECORDINGPLAYERVIEW, // 录音播放视图(subView)\r
-        RECORDINGDELETEVIEW, // 录音删除视图(subView)\r
+        RECORDINGVIEW = 0,          // 录音视图(slice)\r
+        RECORDINGLISTVIEW,          // 录音列表视图(subView)\r
+        RECORDGOINGVIEW,            // 正在录音视图(subView)\r
+        RECORDINGPLAYERVIEW,        // 录音播放视图(subView)\r
+        RECORDINGDELETEVIEW,        // 录音删除视图(subView)\r
+        RECORDINGVOLUMESETTINGVIEW, // 声音设置视图(subView)\r
         MAX_RECORDINGVIEWID,\r
     } RECORDINGVIEWID;\r
 \r
index 846eb1a..99ea392 100644 (file)
@@ -15,6 +15,7 @@
 #include "record/include/RecordGoingView.h"\r
 #include "record/include/RecordingPlayerView.h"\r
 #include "record/include/RecordDeleteView.h"\r
+#include "record/include/RecordingVolumeSettingView.h"\r
 \r
 #define NUM_MAX_RECORDINGVIEWSCROLLVIEW 10\r
 namespace OHOS\r
@@ -37,11 +38,12 @@ namespace OHOS
         virtual ~RecordingView();\r
         static RecordingView *GetInstance(void);\r
 \r
-        bool ChangeRecordingView(int16_t thisView);       // 切换到“录音”视图slice\r
-        bool ChangeRecordListView(int16_t thisView);      // 切换到"录音列表"视图\r
-        bool ChangeRecordGoingView(int16_t thisView);     // 切换到“正在录音”视图\r
-        bool ChangeRecordingPlayerView(int16_t thisView); // 切换到“录音播放”视图\r
-        bool ChangeRecordDeleteView(int16_t thisView);    // 切换到“录音删除”视图\r
+        bool ChangeRecordingView(int16_t thisView);           // 切换到“录音”视图slice\r
+        bool ChangeRecordListView(int16_t thisView);          // 切换到"录音列表"视图\r
+        bool ChangeRecordGoingView(int16_t thisView);         // 切换到“正在录音”视图\r
+        bool ChangeRecordingPlayerView(int16_t thisView);     // 切换到“录音播放”视图\r
+        bool ChangeRecordDeleteView(int16_t thisView);        // 切换到“录音删除”视图\r
+        bool ChangeRecordVolumeSettingView(int16_t thisView); // 切换到“声音设置”视图\r
         bool ClickFunc(int16_t interface);\r
         void ChangeView(int16_t hideView, int16_t showView);\r
         UIScrollView *GetRecordingViewScrollView(int i);\r
@@ -57,6 +59,7 @@ namespace OHOS
         RecordGoingView *p_RecordGoingView{nullptr};\r
         RecordingPlayerView *p_RecordingPlayerView{nullptr};\r
         RecordDeleteView *p_RecordDeleteView{nullptr};\r
+        RecordingVolumeSettingView *p_RecordingVolumeSettingView{nullptr};\r
 \r
     private:\r
         void RecordingViewInit(void);\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingVolumeSettingView.h b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingVolumeSettingView.h
new file mode 100644 (file)
index 0000000..92e6421
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef RECORDING_VOLUME_SETTING_VIEW_H
+#define RECORDING_VOLUME_SETTING_VIEW_H
+
+#include "soundandvibration/include/SoundAndVibrationVolumeSettingView.h"
+#include "components/ui_scroll_view.h"
+namespace OHOS
+{
+    class RecordingVolumeSettingView
+    {
+    public:
+        RecordingVolumeSettingView();
+        ~RecordingVolumeSettingView();
+        static RecordingVolumeSettingView *GetInstance();
+        UIScrollView *RecordingVolumeSettingViewInit(void);
+        void ClearAll(void);
+    private:
+        SoundAndVibrationVolumeSettingView *p_SoundAndVibrationVolumeSettingView{nullptr};
+        UIScrollView *RecordingVolumeSettingViewScrollView{nullptr};
+        bool initViewStatus{false};
+    };
+
+}
+
+#endif
\ No newline at end of file
index 2b856c7..5145532 100644 (file)
@@ -94,6 +94,10 @@ namespace OHOS
                     {\r
                         p_RecordingView->ChangeView(i, RECORDINGLISTVIEW);\r
                     }\r
+                    else if(i == RECORDINGVOLUMESETTINGVIEW)\r
+                    {\r
+                        p_RecordingView->ChangeView(i, RECORDINGPLAYERVIEW);\r
+                    }\r
                     else\r
                     {\r
                         p_RecordingView->ChangeView(i, RECORDINGVIEW);\r
@@ -408,7 +412,7 @@ namespace OHOS
         else if (strcmp(view.GetViewId(), RECORD_PLAY_VOLUME_BUTTON_VIEWID) == 0)\r
         {\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recording player volume button being clicked!");\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_SYSTEM_VOLUME);\r
+            p_RecordingView->ChangeView(RECORDINGPLAYERVIEW, RECORDINGVOLUMESETTINGVIEW);\r
         }\r
         return true;\r
     }\r
index 681d47f..7893cc7 100644 (file)
@@ -74,6 +74,12 @@ namespace OHOS
                 p_RecordDeleteView = nullptr;\r
             }\r
 \r
+            if (p_RecordingVolumeSettingView != nullptr)\r
+            {\r
+                delete p_RecordingVolumeSettingView;\r
+                p_RecordingVolumeSettingView = nullptr;\r
+            }\r
+\r
             delete RecordingViewScrollView[RECORDINGVIEW];\r
             RecordingViewScrollView[RECORDINGVIEW] = nullptr;\r
         }\r
@@ -309,6 +315,26 @@ namespace OHOS
         }\r
         return true;\r
     }\r
+\r
+    /*\r
+     * @brief  切换到“声音设置”视图\r
+     */\r
+    bool RecordingView::ChangeRecordVolumeSettingView(int16_t thisView) // 切换到“声音设置”视图\r
+    {\r
+        if (RecordingViewScrollView[thisView] == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingView::ChangeRecordVolumeSettingView");\r
+            p_RecordingVolumeSettingView = new RecordingVolumeSettingView();\r
+            if (p_RecordingVolumeSettingView == nullptr)\r
+            {\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingView:: new scrollView[%d] fail", thisView);\r
+                return false;\r
+            }\r
+            RecordingViewScrollView[thisView] = p_RecordingVolumeSettingView->RecordingVolumeSettingViewInit();\r
+            RootView::GetInstance()->Add(RecordingViewScrollView[thisView]);\r
+        }\r
+        return true;\r
+    }\r
     /* -------------------------------------------------------------------------- */\r
     // 1.RecordingViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。\r
     struct RecordingViewMapper\r
@@ -324,6 +350,7 @@ namespace OHOS
         {RECORDGOINGVIEW, &RecordingView::ChangeRecordGoingView},\r
         {RECORDINGPLAYERVIEW, &RecordingView::ChangeRecordingPlayerView},\r
         {RECORDINGDELETEVIEW, &RecordingView::ChangeRecordDeleteView},\r
+        {RECORDINGVOLUMESETTINGVIEW, &RecordingView::ChangeRecordVolumeSettingView},\r
     };\r
 \r
     // 3.根据传入的interface参数执行相应视图ID关联的成员函数。\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp
new file mode 100644 (file)
index 0000000..32f5edf
--- /dev/null
@@ -0,0 +1,65 @@
+#include "record/include/RecordingVolumeSettingView.h"
+#include "record/include/RecordingPresenter.h"
+
+namespace OHOS
+{
+
+    static RecordingVolumeSettingView *g_pRecordingVolumeSettingView{nullptr};
+    RecordingVolumeSettingView::RecordingVolumeSettingView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingVolumeSettingView::RecordingVolumeSettingView");
+
+        g_pRecordingVolumeSettingView = this;
+    }
+
+    RecordingVolumeSettingView::~RecordingVolumeSettingView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingVolumeSettingView::~RecordingVolumeSettingView");
+
+        g_pRecordingVolumeSettingView = nullptr;
+    }
+
+    RecordingVolumeSettingView *RecordingVolumeSettingView::GetInstance()
+    {
+        return g_pRecordingVolumeSettingView;
+    }
+
+    void RecordingVolumeSettingView::ClearAll(void)
+    {
+        if (initViewStatus == true)
+        {
+            delete p_SoundAndVibrationVolumeSettingView;
+            p_SoundAndVibrationVolumeSettingView = nullptr;
+        }
+    }
+
+    UIScrollView *RecordingVolumeSettingView::RecordingVolumeSettingViewInit(void)
+    {
+
+        p_SoundAndVibrationVolumeSettingView = new SoundAndVibrationVolumeSettingView();
+        if (p_SoundAndVibrationVolumeSettingView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_SoundAndVibrationVolumeSettingView nullptr err");
+            return nullptr;
+        }
+        RecordingVolumeSettingViewScrollView = p_SoundAndVibrationVolumeSettingView->SetUpVolumeProcess();
+        UIView::OnDragListener *volumeDragListener = (UIView::OnDragListener *)OHOS::RecordingPresenter::GetInstance();
+        if (volumeDragListener == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPresenter GetInstance fail");
+            return nullptr;
+        }
+        RecordingVolumeSettingViewScrollView->SetOnDragListener(volumeDragListener);
+        if (RecordingVolumeSettingViewScrollView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_SoundAndVibrationVolumeSettingView->SetUpVolumeProcess fail!!");
+            return nullptr;
+        }
+
+        p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC));
+
+        initViewStatus = true;
+        return RecordingVolumeSettingViewScrollView;
+    }
+
+}
\ No newline at end of file
index 7aa75ea..0dbc176 100644 (file)
@@ -6,6 +6,7 @@
 #include "components/ui_scroll_view.h"
 #include "components/ui_slider.h"
 #include "components/ui_image_view.h"
+#include "soundandvibration/include/SystemVolumePresenter.h"
 
 /*
     声音与震动的声音设置视图
@@ -17,18 +18,22 @@ namespace OHOS
 #define VOLUME_MAX 100
 #define VOLUME_PROGRESS "progress"
 
-    class SoundAndVibrationVolumeSettingView 
+    class VoumeProcessSliderEventListener;
+    class SoundAndVibrationVolumeSettingView
     {
     public:
         SoundAndVibrationVolumeSettingView();
         ~SoundAndVibrationVolumeSettingView();
         static SoundAndVibrationVolumeSettingView *GetInstance(void);
-        UIScrollView * SetUpVolumeProcess(void);
+        UIScrollView *SetUpVolumeProcess(void);
         void ClearAll(void);
+        UISlider *GetVolumeProcess(void);
+        int CurrentVolumeValue{0};
     private:
         UIScrollView *ScrollView{nullptr};
         UISlider *VolumeProcess{nullptr};
         UIImageView *VolumeVetor{nullptr};
+        VoumeProcessSliderEventListener *listener = nullptr;
         bool initViewStatus{false};
     };
 
index 0d77621..85810c0 100644 (file)
@@ -2,16 +2,44 @@
 #define SYSTEM_VOLUME_PRESENTER_H\r
 \r
 #include "Presenter.h"\r
-\r
 #include "SystemVolumeView.h"\r
+#include "wearable_log.h"\r
 \r
 namespace OHOS\r
 {\r
-    class SystemVolumeView;\r
+    typedef enum : uint8_t\r
+    {\r
+        VOLUMEREDUCE = 0, // 声音降低\r
+        VOLUMEADD = 1,    // 声音增加\r
+        OTHER = 2,  // 其他\r
+    } VolumeStatusChange;\r
+\r
+    /*\r
+     * @brief 声音进度条的事件监听类\r
+     */\r
+    class VoumeProcessSliderEventListener : public UISlider::UISliderEventListener,\r
+                                            public UIView::OnClickListener,\r
+                                            public UIView::OnDragListener\r
+    {\r
+    public:\r
+        VoumeProcessSliderEventListener();\r
+        ~VoumeProcessSliderEventListener();\r
+        static VoumeProcessSliderEventListener *GetInstance(void);\r
+        void ChangeVolumeValue(uint8_t status, uint8_t value);\r
+        void LocalVolumeSet(int16_t sounding);\r
+        void OnChange(int32_t value) override;\r
+        void OnRelease(int32_t value) override;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
 \r
+    private:\r
+        int32_t VolumeValue; // 声音值\r
+    };\r
+\r
+    class SystemVolumeView;\r
     class SystemVolumePresenter : public Presenter<SystemVolumeView>,\r
-                                       public UIView::OnClickListener,\r
-                                       public UIView::OnDragListener\r
+                                  public UIView::OnClickListener,\r
+                                  public UIView::OnDragListener\r
     {\r
     public:\r
         SystemVolumePresenter();\r
index af35921..4a72e8f 100644 (file)
@@ -9,6 +9,7 @@ namespace OHOS
 {\r
     static const char *SYSTEM_VOLUME_SLIDER = "SystemVolumeSlider";\r
 \r
+    class SoundAndVibrationVolumeSettingView;\r
     class SystemVolumePresenter;\r
     class SystemVolumeView : public View<SystemVolumePresenter>\r
     {\r
index dc16bb2..65c436a 100644 (file)
@@ -1,6 +1,5 @@
 #include "soundandvibration/include/SoundAndVibrationVolumeSettingView.h"
 #include "soundandvibration/include/SoundAndVibrationPresenter.h"
-#include "soundandvibration/include/SystemVolumePresenter.h"
 #include "wearable_log.h"
 
 namespace OHOS
@@ -31,15 +30,29 @@ namespace OHOS
         if (initViewStatus == true)
         {
             ScrollView->RemoveAll();
+
             delete VolumeProcess;
             VolumeProcess = nullptr;
+
             delete VolumeVetor;
             VolumeVetor = nullptr;
+
+            delete listener;
+            listener = nullptr;
+
             delete ScrollView;
             ScrollView = nullptr;
         }
     }
 
+    /*
+     * @brief 获取声音进度条
+     */
+    UISlider *SoundAndVibrationVolumeSettingView::GetVolumeProcess(void)
+    {
+        return VolumeProcess;
+    }
+
     UIScrollView *SoundAndVibrationVolumeSettingView::SetUpVolumeProcess(void)
     {
         ScrollView = new UIScrollView();
@@ -49,13 +62,6 @@ namespace OHOS
             return nullptr;
         }
         ScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
-        UIView::OnDragListener *volumeDragListener = (UIView::OnDragListener *)OHOS::SystemVolumePresenter::GetInstance();
-        if (volumeDragListener == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolumePresenter GetInstance fail");
-            return nullptr;
-        }
-        ScrollView->SetOnDragListener(volumeDragListener);
         ScrollView->SetDraggable(true);
         ScrollView->SetTouchable(true);
         /* ------------------------------ VolumeProcess ----------------------------- */
@@ -88,21 +94,20 @@ namespace OHOS
         const char *image = "/user/res/VolumeControlVector.bin";
         VolumeVetor->SetSrc(image);
 
-        // if (listener == nullptr)
-        // {
-        //     listener = new VolumeSliderEventListener();
-        //     if (listener == nullptr)
-        //     {
-        //         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener new fail");
-        //         return false;
-        //     }
-        // }
-        // progress->SetSliderEventListener(listener);
-        // progress->SetOnClickListener(listener);
-        // progress->SetOnDragListener(listener);
-        // progress->SetKnobStyle(StyleDefault::GetSliderKnobStyle());
-        //
-        // SetViewId(VOLUME_VIEW);
+        if (listener == nullptr)
+        {
+            listener = new VoumeProcessSliderEventListener();
+            if (listener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Listener new fail!");
+                return nullptr;
+            }
+        }
+        VolumeProcess->SetSliderEventListener(listener);
+        VolumeProcess->SetOnClickListener(listener);
+        VolumeProcess->SetOnDragListener(listener);
+        VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle());
+
         ScrollView->Add(VolumeProcess);
         ScrollView->Add(VolumeVetor);
         initViewStatus = true;
index e688e1b..63f6517 100644 (file)
 #include "graphic_math.h"\r
 #include "string.h"\r
 #include "soundandvibration/include/SystemVolumePresenter.h"\r
-//系统音量\r
-namespace OHOS{\r
- \r
-    //当前Presenter属性实例化的内存指针\r
-    static SystemVolumePresenter *g_pSystemVolumePresenter = nullptr; \r
-    \r
-    SystemVolumePresenter::SystemVolumePresenter(){\r
-               \r
+\r
+#include <audio_manager.h>\r
+// 系统音量\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static SystemVolumePresenter *g_pSystemVolumePresenter = nullptr;\r
+\r
+    SystemVolumePresenter::SystemVolumePresenter()\r
+    {\r
+\r
         g_pSystemVolumePresenter = this;\r
     }\r
- \r
-    SystemVolumePresenter::~SystemVolumePresenter(){\r
-    \r
+\r
+    SystemVolumePresenter::~SystemVolumePresenter()\r
+    {\r
+\r
         g_pSystemVolumePresenter = nullptr;\r
     }\r
- \r
-    SystemVolumePresenter *SystemVolumePresenter::GetInstance(){\r
-    \r
+\r
+    SystemVolumePresenter *SystemVolumePresenter::GetInstance()\r
+    {\r
+\r
         return g_pSystemVolumePresenter;\r
     }\r
- \r
-    void SystemVolumePresenter::OnStart(){\r
-    \r
-        Presenter<SystemVolumeView>::OnStart(); \r
+\r
+    void SystemVolumePresenter::OnStart()\r
+    {\r
+\r
+        Presenter<SystemVolumeView>::OnStart();\r
     }\r
- \r
-    void SystemVolumePresenter::OnPause(void){\r
-    \r
+\r
+    void SystemVolumePresenter::OnPause(void)\r
+    {\r
+\r
         Presenter<SystemVolumeView>::OnPause();\r
     }\r
- \r
-    void SystemVolumePresenter::OnResume(void){\r
-    \r
+\r
+    void SystemVolumePresenter::OnResume(void)\r
+    {\r
+\r
         Presenter<SystemVolumeView>::OnResume();\r
     }\r
- \r
-    void SystemVolumePresenter::OnStop(void){\r
-    \r
-        Presenter<SystemVolumeView>::OnStop(); \r
+\r
+    void SystemVolumePresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<SystemVolumeView>::OnStop();\r
     }\r
- \r
-    bool SystemVolumePresenter::OnDrag(UIView &view, const DragEvent &event){\r
-    \r
+\r
+    bool SystemVolumePresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
         if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
             (event.GetDeltaX() > 30) && (event.GetDeltaX() > (3 * MATH_ABS(event.GetDeltaY()))))\r
         {\r
-            //NativeAbility::GetInstance().ChangeSlice(VIEW_SOUND_VIBRATION);\r
+            // NativeAbility::GetInstance().ChangeSlice(VIEW_SOUND_VIBRATION);\r
             uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
             NativeAbility::GetInstance().ChangeSlice(preSlice);\r
         }\r
         return true;\r
     }\r
- \r
-    bool SystemVolumePresenter::OnClick(UIView &view, const ClickEvent &event){\r
-    \r
+\r
+    bool SystemVolumePresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+\r
         // 根据控件id查找是哪个控件触发了点击回调\r
         // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
         // if(strcmp(view.GetViewId(), BRIGHTNESS_CONTROL_SLIDER))\r
         // {\r
-            \r
+\r
         // }\r
         return true;\r
     }\r
-}\r
 \r
+    /* --------------------- VoumeProcessSliderEventListener -------------------- */\r
 \r
+    constexpr int16_t VOLUMEVALUE_CHANGE = 10;\r
 \r
+    static VoumeProcessSliderEventListener *g_pVoumeProcessSliderEventListener{nullptr};\r
+    VoumeProcessSliderEventListener::VoumeProcessSliderEventListener()\r
+    {\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::VoumeProcessSliderEventListener");\r
+        g_pVoumeProcessSliderEventListener = this;\r
+    }\r
 \r
+    VoumeProcessSliderEventListener::~VoumeProcessSliderEventListener()\r
+    {\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::~VoumeProcessSliderEventListener");\r
+        g_pVoumeProcessSliderEventListener = nullptr;\r
+    }\r
 \r
+    VoumeProcessSliderEventListener *VoumeProcessSliderEventListener::GetInstance(void)\r
+    {\r
+        return g_pVoumeProcessSliderEventListener;\r
+    }\r
 \r
+    void VoumeProcessSliderEventListener::ChangeVolumeValue(uint8_t status, uint8_t value)\r
+    {\r
+\r
+        SoundAndVibrationVolumeSettingView *p_SoundAndVibrationVolumeSettingView = SoundAndVibrationVolumeSettingView::GetInstance();\r
+        if (p_SoundAndVibrationVolumeSettingView == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationVolumeSettingView GetInstance fail!!");\r
+            return;\r
+        }\r
+        UISlider *progress = p_SoundAndVibrationVolumeSettingView->GetVolumeProcess();\r
+        if (progress == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_SoundAndVibrationVolumeSettingView->GetVolumeProcess() fail");\r
+            return;\r
+        }\r
+\r
+        VolumeValue = p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue;\r
+\r
+        switch (status)\r
+        {\r
+        case VOLUMEREDUCE:\r
+            /* code */\r
+            p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue = progress->GetValue() - VOLUMEVALUE_CHANGE;\r
+            if (p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue < VOLUME_MIN)\r
+            {\r
+                p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue = VOLUME_MIN;\r
+            }\r
+            break;\r
+        case VOLUMEADD:\r
+            p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue = progress->GetValue() + VOLUMEVALUE_CHANGE;\r
+            if (p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue > VOLUME_MAX)\r
+            {\r
+                p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue = VOLUME_MAX;\r
+            }\r
+            break;\r
+        case OTHER:\r
+            p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue = value;\r
+            if (p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue < VOLUME_MIN)\r
+            {\r
+                p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue = VOLUME_MIN;\r
+            }\r
+            else if (p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue > VOLUME_MAX)\r
+            {\r
+                p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue = VOLUME_MAX;\r
+            }\r
+            break;\r
+        default:\r
+            break;\r
+        }\r
+\r
+        progress->SetValue(p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue);\r
+        LocalVolumeSet(p_SoundAndVibrationVolumeSettingView->CurrentVolumeValue);\r
+    }\r
+\r
+    /*\r
+     * @brief 本地音量设置\r
+     */\r
+    void VoumeProcessSliderEventListener::LocalVolumeSet(int16_t sounding)\r
+    {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BtAndLocalVolumeSet %d", sounding);\r
+        Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 本地音量设置\r
+    }\r
+\r
+    void VoumeProcessSliderEventListener::OnChange(int32_t value)\r
+    {\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnChange %d", value);\r
+        ChangeVolumeValue(OTHER, value);\r
+    }\r
+\r
+    void VoumeProcessSliderEventListener::OnRelease(int32_t value)\r
+    {\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnRelease %d", value);\r
+        ChangeVolumeValue(OTHER, value);\r
+    }\r
+\r
+    bool VoumeProcessSliderEventListener::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        UNUSED(event);\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool VoumeProcessSliderEventListener::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+        UNUSED(event);\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+}\r