Merge #581 into sdk602patch0626 from refs/changes/581/head 584/target/1
author罗正 <1732036298@qq.com>
Thu, 25 Jul 2024 03:33:56 +0000 (03:33 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Thu, 25 Jul 2024 03:33:56 +0000 (03:33 +0000)
Code review from 罗正

* refs/changes/581/head: (23 commits squashed)

  - 修改恢复出厂设置适配多国语言

  - 1.优化设置视图:添加了表冠控制但效果不佳
    2.滑动关机和重启视图添加按键注册功能
    3.现在设置视图进入关机和重启为“滑动关机重启Slice”

  - 优化屏幕与亮度Slice:
    1.添加了scrollview的表冠控制,
    2.标签断行模式为LINE_BREAK_OSCILLATION改为LINE_BREAK_OSCILLATION
    3.亮屏时长视图实现点击按钮该变亮屏时长单选按钮选中状态

  - 解决手表解绑后恢复出厂设置,如果手机是直接与手表配对成功未选择语言,进入主界面后发现手表缺少字体问题。
    1.如果手机与手表先绑定成功,未选择语言,需选择语言才进入主界面。
    2.如果已选择语言,这时手机与手表绑定成功将自动进入主界面。

  - 传统蓝牙Slice优化修改

  -  喝水提醒尾部括号字符移除(原因:特殊字符不显示故删除)

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - 设置视图优化表冠控制

  - 解决天气界面没有时间显示的bug,并优化时间刷新
    1.目前主界面天气刷新:如果在天气卡片,天气数据有效,就刷新时间
    2.如果是Slice天气:滑到第一个界面,时间就会更新

  - 解决左滑进入指南针卡片,手持手表,左上角度数被遮挡bug

  - 解决左滑进入指南针卡片,与预览图不一致问题q

  - 解决手表第一次启动:如果选择完语言后重启未配对会直接进入到主界面bug

  - 通过下拉,刷新蓝牙连接状态,解决手机关闭蓝牙后手机还显示已连接问题需要等待一会才会显示断开连接

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - 注释KeyInputListener中power键长按进入开关机界面(该界面已经弃用)

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - QRcode界面取消设置常亮屏

  - 声音与震动Slice优化:
    1.解决如果是点击设置音量退出Slice未将音量值保存的问题
    2.优化了如果是拖拽设置致使多次调用OnChange,实际上我们只要我们手指离开屏幕最后设置的值。

  - 运动识别优化修改

  - 增加蓝牙耳机连接状态显示

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - 显示方式界面优化:适配多国语言和表冠

Signed-off-by: 罗正 <1732036298@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/581
19 files changed:
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp
code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionPresenter.h
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumeView.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingView.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/VibrationModeView.cpp
code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleView.h
code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleView.cpp
code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp

index 2969417..fde11f3 100644 (file)
@@ -394,7 +394,7 @@ namespace OHOS
         {VIEW_CONNECT_PHONE, "ConnectPhoneView"},
         //{VIEW_PHONE, "phoneview"},
         {VIEW_INDOORWALK, "IndoorWalkView"},
-        {VIEW_SHUTDOWN_OR_REBOOT, "RebootView"},
+        // {VIEW_SHUTDOWN_OR_REBOOT, "RebootView"},
         {VIEW_TEST, "testView"}};
 
     NativeLauncher::NativeLauncher() {}
index 7916973..896ca21 100644 (file)
@@ -36,7 +36,7 @@
 #include "custom_runtime.h"\r
 #include "bleService.h"\r
 //#include "hfp_hf_service.h"\r
-#include "ui_service.h"\r
+#include "uiservice/include/ui_service.h"\r
 #include "PhoneService.h"\r
 #ifdef SUPPORT_AT_OHOSFWK\r
 #include "BluetoothWrapper.h"\r
@@ -1023,18 +1023,20 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState)
         bdAddr->addr[5], bdAddr->addr[4], bdAddr->addr[3], /* 5 4 3 idx */\r
         bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0], connState); /* 2 1 0 idx */\r
     if ((gap_get_device_class(bdAddr) & 0x200) != 0) {\r
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "a2dp_src_connectstateChangedCb: Mobile Phone Device");\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "a2dp_src_connectstateChangedCb: Mobile Phone Device");\r
         return;\r
     }\r
     if (connState == PROFILE_STATE_CONNECTED) {\r
         avrcp_ct_connect(bdAddr);\r
         PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_CONNECTED);\r
         GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionSuss, *bdAddr));\r
+        SendMsgToUIService(EARPHONE_CONNECTED_TO_UI, 0, nullptr, 0);\r
     }\r
 \r
     if (connState == PROFILE_STATE_DISCONNECTED) {\r
         PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_DISCONNECTED);\r
         GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionFail, *bdAddr));\r
+        SendMsgToUIService(EARPHONE_DISCONNECTED_TO_UI, 0, nullptr, 0);\r
     }\r
 }\r
 \r
index 5566ec8..8f29363 100644 (file)
@@ -63,7 +63,7 @@ namespace OHOS
         if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER))
         { // 电源按键
             // 切换到关机/重启卡片
-            NativeAbility::GetInstance().ChangeSlice(VIEW_SHUTDOWN_OR_REBOOT);
+            // NativeAbility::GetInstance().ChangeSlice(VIEW_SHUTDOWN_OR_REBOOT);
         }
         else if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC))
         { // 功能按键
index c976098..a7b6e63 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 17:32:20
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-23 17:42:37
+ * @LastEditTime: 2024-07-24 18:13:52
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionPresenter.h
  */
 #ifndef MOTION_RECOGNITION_PRESENTER_H
@@ -10,6 +10,7 @@
 
 #include "Presenter.h"
 #include "View.h"
+#include "components/ui_toggle_button.h"
 
 namespace OHOS
 {
@@ -17,6 +18,7 @@ namespace OHOS
     class MotionRecognitionPresenter : public Presenter<MotionRecognitionView>,
                                        public UIView::OnClickListener,
                                        public RootView::OnKeyActListener,
+                                       public UICheckBox::OnChangeListener,
                                        public UIView::OnDragListener
     {
     public:
@@ -32,9 +34,11 @@ namespace OHOS
 
     private:
         bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnChange(UICheckBox::UICheckBoxState state);
         bool OnDrag(UIView &view, const DragEvent &event) override;
         bool OnDragEnd(UIView &view, const DragEvent &event) override;
         bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+        bool X_DRAG_FLAG{false};
     };
 }
 
index de1ee91..58cb3e3 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 17:29:18
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-06 17:48:35
+ * @LastEditTime: 2024-07-24 18:03:56
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/include/MotionRecognitionView.h
  */
 #ifndef MOTION_RECOGNITION_VIEW_H
@@ -39,6 +39,7 @@ namespace OHOS
         UIImageView *MotionRecognitionImage = nullptr;
         UILabelExt *MotionRecognitionLabel = nullptr;
         UIToggleButton *MotionRecognitionToggleButton = nullptr;
+        bool viewInitStatus{false};
     };
 }
 #endif
\ No newline at end of file
index 46cf3c7..de578f7 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-28 14:17:43
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-24 14:26:22
+ * @LastEditTime: 2024-07-24 18:16:48
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/language/src/MotionRecognitionPresenter.cpp
  */
 #include "AppViewIDs.h"
@@ -12,6 +12,7 @@
 #include "common/key_code.h"
 #include <custom_utils.h>
 #include "ConfigModel.h"
+#include <UiConfig.h>
 
 namespace OHOS
 {
@@ -36,68 +37,98 @@ namespace OHOS
 
     void MotionRecognitionPresenter::OnStart()
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnStart");
         Presenter<MotionRecognitionView>::OnStart();
     }
 
     void MotionRecognitionPresenter::OnPause(void)
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnPause");
         Presenter<MotionRecognitionView>::OnPause();
     }
 
     void MotionRecognitionPresenter::OnResume(void)
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnResume");
         Presenter<MotionRecognitionView>::OnResume();
     }
 
     void MotionRecognitionPresenter::OnStop(void)
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnStop");
         Presenter<MotionRecognitionView>::OnStop();
     }
 
     bool MotionRecognitionPresenter::OnClick(UIView &view, const ClickEvent &event)
     {
+        UNUSED(view);
         UNUSED(event);
-        MotionRecognitionView *p_MotionRecognitionView = MotionRecognitionView::GetInstance();
-        if (p_MotionRecognitionView == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " MotionRecognitionView::GetInstance() fail!");
-            return false;
-        }
+        // MotionRecognitionView *p_MotionRecognitionView = MotionRecognitionView::GetInstance();
+        // if (p_MotionRecognitionView == nullptr)
+        // {
+        //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " MotionRecognitionView::GetInstance() fail!");
+        //     return false;
+        // }
+
+        // UIToggleButton *toggleButton = dynamic_cast<UIToggleButton *>(&view);
+        // if (p_MotionRecognitionView->GetMotionRecognitionToggleButton() == toggleButton)
+        // {
+        //     if (toggleButton != nullptr)
+        //     {
+        //         if (toggleButton->GetState() == true)
+        //         {
+        //             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is enable!");
+        //             ConfigModel::GetInstance()->SetMotionRecognition(true);
+        //         }
+        //         else
+        //         {
+        //             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is disable!");
+        //             ConfigModel::GetInstance()->SetMotionRecognition(false);
+        //         }
+        //     }
+        // }
+
+        return true;
+    }
 
-        UIToggleButton *toggleButton = dynamic_cast<UIToggleButton *>(&view);
-        if (p_MotionRecognitionView->GetMotionRecognitionToggleButton() == toggleButton)
+    bool MotionRecognitionPresenter::OnChange(UICheckBox::UICheckBoxState state)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionPresenter::OnChange");
+        switch (state)
         {
-            if (toggleButton != nullptr)
-            {
-                if (toggleButton->GetState() == true)
-                {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is enable!");
-                    ConfigModel::GetInstance()->SetMotionRecognition(true);
-                }
-                else
-                {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is disable!");
-                    ConfigModel::GetInstance()->SetMotionRecognition(false);
-                }
-            }
+        case UICheckBox::SELECTED:
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is enable!");
+            ConfigModel::GetInstance()->SetMotionRecognition(true);
+            break;
+        case UICheckBox::UNSELECTED:
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is disable!");
+            ConfigModel::GetInstance()->SetMotionRecognition(false);
+            break;
+        default:
+            break;
         }
-
         return true;
     }
 
     bool MotionRecognitionPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         UNUSED(view);
-        UNUSED(event);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionPresenter::OnDrag");
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+        {
+            X_DRAG_FLAG = true;
+        }
         return true;
     }
 
     bool MotionRecognitionPresenter::OnDragEnd(UIView &view, const DragEvent &event)
     {
         UNUSED(view);
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionPresenter::OnDragEnd");
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && X_DRAG_FLAG)
         {
             NativeAbility::GetInstance().Back();
+            X_DRAG_FLAG = false;
         }
         return true;
     }
index a618084..8d77801 100644 (file)
@@ -2,13 +2,15 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 17:28:52
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-06 17:52:26
+ * @LastEditTime: 2024-07-24 18:16:10
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
  */
 #include "motionrecognition/include/MotionRecognitionPresenter.h"
 #include "motionrecognition/include/MotionRecognitionView.h"
 #include "wearable_log.h"
 #include "ConfigModel.h"
+#include <ui_resource_string.h>
+#include <UiConfig.h>
 namespace OHOS
 {
 
@@ -23,7 +25,7 @@ namespace OHOS
     MotionRecognitionView::~MotionRecognitionView()
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::~MotionRecognitionView");
-        ClearAll();
+
         g_pMotionRecognitionView = nullptr;
     }
 
@@ -68,7 +70,7 @@ namespace OHOS
 
     void MotionRecognitionView::MotionRecognitionViewInit(void)
     {
-
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::MotionRecognitionViewInit");
         if (scrollView == nullptr)
         {
             scrollView = new UIScrollView();
@@ -77,13 +79,7 @@ namespace OHOS
             scrollView->SetScrollBlankSize(50);
             scrollView->SetHorizontalScrollState(false);
             scrollView->SetReboundSize(35);
-            UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(MotionRecognitionPresenter::GetInstance());
-            if (draglistener == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::draglistener can not be nullptr!");
-                return;
-            }
-            scrollView->SetOnDragListener(draglistener);
+            scrollView->SetOnDragListener(presenter_);
             /* -------------------------------------------------------------------------- */
             Title = new UILabelExt();
             if (Title == nullptr)
@@ -94,11 +90,10 @@ namespace OHOS
             Title->SetPosition(83, 50, 300, 40);
             Title->SetStyle(STYLE_TEXT_FONT, 30);
             Title->SetStyle(STYLE_LINE_HEIGHT, 35);
-            //Title->SetText("运动识别");
-            Title->SetTextId(STR_MOTION_RECOGNITION);
-            Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+            Title->SetTextId(STR_MOTION_RECOGNITION); /*运动识别*/
+            Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
             Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-            //Title->SetRollSpeed(40);
+            Title->SetRollSpeed(70);
             Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             Title->SetVisible(true);
             /* -------------------------------------------------------------------------- */
@@ -120,10 +115,9 @@ namespace OHOS
             MotionRecognitionLabel->SetPosition(90, 153, 180, 40);
             MotionRecognitionLabel->SetStyle(STYLE_TEXT_FONT, 30);
             MotionRecognitionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
-            //MotionRecognitionLabel->SetText("自动识别");
-            MotionRecognitionLabel->SetTextId(STR_AUTO_DETECT);
+            MotionRecognitionLabel->SetTextId(STR_AUTO_DETECT); /*自动识别*/
             MotionRecognitionLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
-            //MotionRecognitionLabel->SetRollSpeed(40);
+            MotionRecognitionLabel->SetRollSpeed(70);
             MotionRecognitionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             /* -------------------------------------------------------------------------- */
             MotionRecognitionToggleButton = new UIToggleButton();
@@ -135,48 +129,70 @@ namespace OHOS
             MotionRecognitionToggleButton->SetPosition(298, 145, 100, 50);
             MotionRecognitionToggleButton->SetState(ConfigModel::GetInstance()->GetMotionRecognition());
             MotionRecognitionToggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
-            const char *selectedImg = "/user/res/TOGGLEBUTTON_ON.bin";
-            const char *unSelectedImg = "/user/res/TOGGLEBUTTON_OFF.bin";
-            MotionRecognitionToggleButton->SetImages(selectedImg, unSelectedImg);
+            MotionRecognitionToggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
             /* ----------------------------- onclickListener ---------------------------- */
-            UIView::OnClickListener *toggleButtonClick = static_cast<UIView::OnClickListener *>(MotionRecognitionPresenter::GetInstance());
-            MotionRecognitionToggleButton->SetOnClickListener(toggleButtonClick);
+            // MotionRecognitionToggleButton->SetOnClickListener(presenter_);
+            MotionRecognitionToggleButton->SetOnChangeListener(presenter_);
+
+            viewInitStatus = true;
+            /* -------------------------------------------------------------------------- */
         }
     }
 
     void MotionRecognitionView::OnStart()
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnStart");
         View<MotionRecognitionPresenter>::OnStart();
-        MotionRecognitionViewInit();
+        SetContainerView(new UIViewGroup());
+        if (GetContainer() == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetContainerView fail!!");
+            return;
+        }
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        if (!viewInitStatus)
+        {
+            MotionRecognitionViewInit();
+        }
+
         // 增加按键监听
-        RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MotionRecognitionPresenter::GetInstance();
-        RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 
     void MotionRecognitionView::OnSetUpView()
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnSetUpView");
         View<MotionRecognitionPresenter>::OnSetUpView();
         scrollView->Add(Title);
         scrollView->Add(MotionRecognitionImage);
         scrollView->Add(MotionRecognitionLabel);
         scrollView->Add(MotionRecognitionToggleButton);
-        RootView::GetInstance()->Add(scrollView);
+        container_->Add(scrollView);
         Draw();
     }
 
     void MotionRecognitionView::OnTearDownView()
     {
-
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnTearDownView");
         View<MotionRecognitionPresenter>::OnTearDownView();
         return;
     }
 
     void MotionRecognitionView::OnStop()
     {
-
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnStop");
         View<MotionRecognitionPresenter>::OnStop();
-        RootView::GetInstance()->RemoveAll();
+        if (container_ != nullptr)
+        {
+            container_->RemoveAll();
+            delete container_;
+            container_ = nullptr;
+        }
         RootView::GetInstance()->ClearOnKeyActListener();
+        ClearAll();
         return;
     }
 
index 19caa95..f7cea52 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-07-18 14:26:08
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-20 15:09:36
+ * @LastEditTime: 2024-07-24 17:35:57
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp
  */
 
@@ -498,13 +498,13 @@ namespace OHOS
     {
         if (showView < 0 || showView >= REBOOTANDSHUTDOWN_MAX)
         {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "REBOOTANDSHUTDOWN_MAX::CheckViewParam showView err.");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::CheckViewParam showView err.");
             return false;
         }
 
         if (hideView < 0 || hideView > REBOOTANDSHUTDOWN_MAX)
         {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "REBOOTANDSHUTDOWN_MAX::CheckViewParam hideView err.");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::CheckViewParam hideView err.");
             return false;
         }
 
index b8c021b..44ec1d1 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-04-19 21:03:26\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-06-19 17:44:40\r
+ * @LastEditTime: 2024-07-24 17:33:52\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h\r
  */\r
 #ifndef SOUND_AND_VIBRATION_VIEW_H\r
@@ -43,15 +43,26 @@ namespace OHOS
             int16_t w;\r
             int16_t h;\r
             const char *ViewId;\r
-            // std::string Text;\r
             int16_t TextId;\r
         };\r
+        struct LabelConfig\r
+        {\r
+            int16_t left;\r
+            int16_t top;\r
+            int16_t width;\r
+            int16_t height;\r
+            int16_t fontSize;\r
+            int16_t lineHeigh;\r
+            int16_t textId;\r
+            uint8_t lineBreakMode;\r
+        };\r
         SoundAndVibrationView();\r
         virtual ~SoundAndVibrationView();\r
         static SoundAndVibrationView *GetInstance(void);\r
         bool ChangeSoundAndVibrationView(int16_t thisView);\r
         bool ChangeVibrationModeView(int16_t thisView);\r
         bool ClickFunc(int16_t interface);\r
+        bool CheckViewParam(int16_t hideView, int16_t showView);\r
         void ChangeView(int16_t hideView, int16_t showView);\r
         VibrationModeView *GetVibrationModeView(void);\r
         bool UpdateSilentModeSwitchStatus(void);\r
@@ -68,6 +79,7 @@ namespace OHOS
         void CreateSoundAndVibrationView(void);\r
         void ClearAll(void);\r
         UILabelButtonExt *SetUpButton_Ext(ButtonConfig &buttonconfig, bool nextImgVisible);\r
+        UILabelExt *SetUpLabel_Ext(LabelConfig &labelConfig);\r
         bool InitSoundAndVibrationScrollView(void);\r
         bool InitSoundAndVibrationViewTitleLabel(void);\r
         bool InitSoundAndVibrationButtonView(void);\r
@@ -80,7 +92,12 @@ namespace OHOS
         UILabelButtonExt *CallVolumeButton{nullptr};        // 通话音量按钮\r
         UILabelButtonExt *VibrationReminderButton{nullptr}; // 震动提醒按钮\r
         UILabelButtonExt *SilentModeButton{nullptr};        // 静音模式按钮\r
+        UILabelExt *SystemVolumeLabel{nullptr};             // 系统音量标签\r
+        UILabelExt *CallVolumeLabel{nullptr};               // 通话音量标签\r
+        UILabelExt *VibrationReminderLabel{nullptr};        // 震动提醒标签\r
+        UILabelExt *SilentModeLabel{nullptr};               // 静音模式标签\r
         UIToggleButton *SilentModeToggleButton{nullptr};    // 静音模式切换按钮\r
+        bool initViewStatus{false};\r
     };\r
 } // namespace OHOS\r
 \r
index 30eb50f..f3f398e 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-19 10:08:21
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-19 19:01:46
+ * @LastEditTime: 2024-07-24 16:35:52
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h
  */
 #ifndef SOUND_AND_VIBRATION_VOLUME_SETTING_PRESENTER_H
@@ -35,20 +35,26 @@ namespace OHOS
      */
     class VoumeProcessSliderEventListener : public UISlider::UISliderEventListener,
                                             public UIView::OnClickListener,
-                                            public UIView::OnDragListener
+                                            public UIView::OnDragListener,
+                                            public UIView::OnRotateListener
     {
     public:
         VoumeProcessSliderEventListener();
         ~VoumeProcessSliderEventListener();
         static VoumeProcessSliderEventListener *GetInstance(void);
+        void FindAndApplyStrategy(uint8_t status, uint8_t value);
         void ChangeVolumeValue(uint8_t status, uint8_t value);
         void OnChange(int32_t value) override;
         void OnRelease(int32_t value) override;
         bool OnClick(UIView &view, const ClickEvent &event) override;
         bool OnDrag(UIView &view, const DragEvent &event) override;
+        bool OnRotateEnd(UIView& view, const RotateEvent& event);
 
     private:
         std::map<uint8_t, std::shared_ptr<VolumeChangeStrategy>> strategyMap;
+        bool isOnClickSlider{true};
+        bool isDragSlider{false};
+        bool isRotateSlider{false};
     };
 }
 
index bc93bc8..d05d2ed 100644 (file)
@@ -67,6 +67,11 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumeView::OnStart");\r
         View<CallVolumePresenter>::OnStart();\r
         SetContainerView(new UIViewGroup());\r
+        if (GetContainer() == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetContainerView fail!!");\r
+            return;\r
+        }\r
         container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
         container_->SetTouchable(true);\r
         container_->SetDraggable(true);\r
index 251303e..54c3c6d 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-02-19 10:39:14\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-06-20 18:03:01\r
+ * @LastEditTime: 2024-07-24 17:48:13\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp\r
  */\r
 #include "soundandvibration/include/SoundAndVibrationView.h"\r
@@ -56,30 +56,45 @@ namespace OHOS
             container_ = nullptr;\r
         }\r
 \r
-        if (SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] != nullptr)\r
+        if (initViewStatus)\r
         {\r
-            SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->RemoveAll();\r
+            if (SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] != nullptr)\r
+            {\r
+                SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->RemoveAll();\r
+\r
+                delete Title;\r
+                Title = nullptr;\r
+\r
+                delete SystemVolumeButton;\r
+                SystemVolumeButton = nullptr;\r
 \r
-            delete Title;\r
-            Title = nullptr;\r
+                delete CallVolumeButton;\r
+                CallVolumeButton = nullptr;\r
 \r
-            delete SystemVolumeButton;\r
-            SystemVolumeButton = nullptr;\r
+                delete VibrationReminderButton;\r
+                VibrationReminderButton = nullptr;\r
 \r
-            delete CallVolumeButton;\r
-            CallVolumeButton = nullptr;\r
+                delete SilentModeButton;\r
+                SilentModeButton = nullptr;\r
 \r
-            delete VibrationReminderButton;\r
-            VibrationReminderButton = nullptr;\r
+                delete SilentModeToggleButton;\r
+                SilentModeToggleButton = nullptr;\r
 \r
-            delete SilentModeButton;\r
-            SilentModeButton = nullptr;\r
+                delete SystemVolumeLabel;\r
+                SystemVolumeLabel = nullptr;\r
 \r
-            delete SilentModeToggleButton;\r
-            SilentModeToggleButton = nullptr;\r
+                delete CallVolumeLabel;\r
+                CallVolumeLabel = nullptr;\r
 \r
-            delete SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW];\r
-            SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] = nullptr;\r
+                delete VibrationReminderLabel;\r
+                VibrationReminderLabel = nullptr;\r
+\r
+                delete SilentModeLabel;\r
+                SilentModeLabel = nullptr;\r
+\r
+                delete SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW];\r
+                SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] = nullptr;\r
+            }\r
         }\r
 \r
         if (vibrationModeView != nullptr)\r
@@ -109,11 +124,31 @@ namespace OHOS
         SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetThrowDrag(true);\r
         SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetTouchable(true);\r
         SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetDraggable(true);\r
+        SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->RequestFocus();\r
+        SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetRotateFactor(2.0);\r
         container_->Add(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]);\r
 \r
         return true;\r
     }\r
 \r
+    UILabelExt *SoundAndVibrationView::SetUpLabel_Ext(LabelConfig &labelconfig)\r
+    {\r
+        UILabelExt *label = new UILabelExt();\r
+        if (label == nullptr)\r
+        {\r
+            return nullptr;\r
+        }\r
+        label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height);\r
+        label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);\r
+        label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);\r
+        label->SetTextId(labelconfig.textId);\r
+        label->SetLineBreakMode(labelconfig.lineBreakMode);\r
+        label->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);\r
+        label->SetRollSpeed(70);\r
+        label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);\r
+        return label;\r
+    }\r
+\r
     /// @brief 声音与震动视图"标题"标签初始化\r
     /// @param  void\r
     /// @return true 初始化成功 false 初始化失败\r
@@ -125,15 +160,49 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::Title new fail!");\r
             return false;\r
         }\r
-        Title->SetPosition(83, 52, 300, 35);\r
+        Title->SetPosition(83, 50, 300, 35);\r
         Title->SetStyle(STYLE_TEXT_FONT, 30);\r
         Title->SetStyle(STYLE_LINE_HEIGHT, 35);\r
         Title->SetTextId(STR_SOUND_AND_VIBRATION); // 声音与震动\r
-        Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);\r
+        Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);\r
+        Title->SetRollSpeed(70);\r
         Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
         Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
         SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(Title);\r
-\r
+        /* -------------------------------------------------------------------------- */\r
+        LabelConfig labelConfig;\r
+        struct LabelSetup\r
+        {\r
+            int16_t y;\r
+            const int16_t textId;\r
+        };\r
+        LabelSetup labelSetups[] = {\r
+            {152, STR_SYSTEM_VOLUME},\r
+            {272, STR_CALL_VOLUME},\r
+            {392, STR_VIBRATION_MODE},\r
+            {512, STR_SILENT_MODE},\r
+        };\r
+        UILabelExt *labelPointers[] = {SystemVolumeLabel, CallVolumeLabel, VibrationReminderLabel, SilentModeLabel};\r
+        for (int i = 0; i < sizeof(labelSetups) / sizeof(labelSetups[0]); ++i)\r
+        {\r
+            labelConfig = {\r
+                .left = 90,\r
+                .top = labelSetups[i].y,\r
+                .width = 240,\r
+                .height = 35,\r
+                .fontSize = 30,\r
+                .lineHeigh = 35,\r
+                .textId = labelSetups[i].textId,\r
+                .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,\r
+            };\r
+            labelPointers[i] = SetUpLabel_Ext(labelConfig);\r
+            if (labelPointers[i] == nullptr)\r
+            {\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::labelPointers[%d] new fail!", i);\r
+                return false;\r
+            }\r
+            SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(labelPointers[i]);\r
+        }\r
         return true;\r
     }\r
 \r
@@ -156,12 +225,12 @@ namespace OHOS
             labelButton->SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE);\r
             labelButton->SetImagePosition(326, 37);\r
         }\r
-        labelButton->SetTextId(buttonconfig.TextId);\r
-        labelButton->SetAlign(TEXT_ALIGNMENT_LEFT);\r
-        labelButton->SetLabelPosition(47, 0);\r
-        labelButton->SetStyle(STYLE_TEXT_FONT, 30);\r
-        labelButton->SetStyle(STYLE_LINE_HEIGHT, 35);\r
-        labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+        // labelButton->SetTextId(buttonconfig.TextId);\r
+        // labelButton->SetAlign(TEXT_ALIGNMENT_LEFT);\r
+        // labelButton->SetLabelPosition(47, 0);\r
+        // labelButton->SetStyle(STYLE_TEXT_FONT, 30);\r
+        // labelButton->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+        // labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
         labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, nextImgVisible ? 0xff000000 : 0xff191919, UIButton::PRESSED);\r
 \r
         return labelButton;\r
@@ -175,15 +244,15 @@ namespace OHOS
         {\r
             int y;\r
             const char *viewId;\r
-            const int16_t textId;\r
             bool clickEffect;\r
         };\r
 \r
         ButtonSetup buttonSetups[] = {\r
-            {120, SYSTEM_VOLUME_BUTTON, STR_SYSTEM_VOLUME, true},\r
-            {240, CALL_VOLUME_BUTTON, STR_CALL_VOLUME, true},\r
-            {360, VIBRATION_REMINDER_BUTTON, STR_VIBRATION_MODE, true},\r
-            {480, SILENT_MODE_BUTTON, STR_SILENT_MODE, false}};\r
+            {120, SYSTEM_VOLUME_BUTTON, true},\r
+            {240, CALL_VOLUME_BUTTON, true},\r
+            {360, VIBRATION_REMINDER_BUTTON, true},\r
+            {480, SILENT_MODE_BUTTON, false},\r
+        };\r
 \r
         UILabelButtonExt *buttonPointers[] = {SystemVolumeButton, CallVolumeButton, VibrationReminderButton, SilentModeButton};\r
 \r
@@ -195,7 +264,7 @@ namespace OHOS
                 .w = 380,\r
                 .h = 100,\r
                 .ViewId = buttonSetups[i].viewId,\r
-                .TextId = buttonSetups[i].textId};\r
+            };\r
             buttonPointers[i] = SetUpButton_Ext(buttonconfig, buttonSetups[i].clickEffect);\r
             if (buttonPointers[i] == nullptr)\r
             {\r
@@ -231,12 +300,13 @@ namespace OHOS
     void SoundAndVibrationView::CreateSoundAndVibrationView(void)\r
     {\r
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::CreateSoundAndVibrationView");\r
-        if (!InitSoundAndVibrationScrollView() || !InitSoundAndVibrationViewTitleLabel() ||\r
-            !InitSoundAndVibrationButtonView() || !InitSoundAndVibrationToggleButton())\r
+        if (!InitSoundAndVibrationScrollView() || !InitSoundAndVibrationButtonView() ||\r
+            !InitSoundAndVibrationViewTitleLabel() || !InitSoundAndVibrationToggleButton())\r
         {\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::CreateSoundAndVibrationView fail!!");\r
             return;\r
         }\r
+        initViewStatus = true;\r
     }\r
 \r
     void SoundAndVibrationView::OnStart()\r
@@ -244,12 +314,20 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::OnStart");\r
         View<SoundAndVibrationPresenter>::OnStart();\r
         SetContainerView(new UIViewGroup());\r
+        if (GetContainer() == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetContainerView fail!!");\r
+            return;\r
+        }\r
         container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
         container_->SetOnDragListener(presenter_);\r
         container_->SetTouchable(true);\r
         container_->SetDraggable(true);\r
 \r
-        CreateSoundAndVibrationView();\r
+        if (!initViewStatus)\r
+        {\r
+            CreateSoundAndVibrationView();\r
+        }\r
         RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 \r
@@ -334,11 +412,29 @@ namespace OHOS
         return false;\r
     }\r
 \r
+    /*检查传入的两个视图参数 hideView 和 showView 的有效性。*/\r
+    bool SoundAndVibrationView::CheckViewParam(int16_t hideView, int16_t showView)\r
+    {\r
+        if (showView < 0 || showView >= MAX_SOUNDANDVIBRATIONVIEWID)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::CheckViewParam showView err.");\r
+            return false;\r
+        }\r
+\r
+        if (hideView < 0 || hideView > MAX_SOUNDANDVIBRATIONVIEWID)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::CheckViewParam hideView err.");\r
+            return false;\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
     void SoundAndVibrationView::ChangeView(int16_t hideView, int16_t showView)\r
     {\r
-        if (hideView > MAX_SOUNDANDVIBRATIONVIEWID)\r
+        if (!CheckViewParam(hideView, showView))\r
         {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " Overstep ones bounds");\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::CheckViewParam failed.");\r
             return;\r
         }\r
         SoundAndVibrationScrollView[hideView]->SetVisible(false);\r
@@ -353,7 +449,7 @@ namespace OHOS
         return vibrationModeView;\r
     }\r
 \r
-    //更新静音模式开关状态\r
+    // 更新静音模式开关状态\r
     bool SoundAndVibrationView::UpdateSilentModeSwitchStatus(void)\r
     {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::UpdateSilentModeSwitchStatus");\r
index bfd70a1..3363612 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-19 10:08:31
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 20:26:10
+ * @LastEditTime: 2024-07-24 16:37:37
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp
  */
 #include "soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h"
@@ -87,7 +87,7 @@ namespace OHOS
     static VoumeProcessSliderEventListener *g_pVoumeProcessSliderEventListener{nullptr};
     VoumeProcessSliderEventListener::VoumeProcessSliderEventListener()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::VoumeProcessSliderEventListener");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::VoumeProcessSliderEventListener");
         // 步骤 3: 创建一个映射表将状态映射到策略
         strategyMap[VOLUMEREDUCE] = std::make_shared<LowerVolumeStrategy>();
         strategyMap[VOLUMEADD] = std::make_shared<ElevateVolumeStrategy>();
@@ -97,7 +97,7 @@ namespace OHOS
 
     VoumeProcessSliderEventListener::~VoumeProcessSliderEventListener()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::~VoumeProcessSliderEventListener");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::~VoumeProcessSliderEventListener");
         g_pVoumeProcessSliderEventListener = nullptr;
     }
 
@@ -106,7 +106,7 @@ namespace OHOS
         return g_pVoumeProcessSliderEventListener;
     }
 
-    void VoumeProcessSliderEventListener::ChangeVolumeValue(uint8_t status, uint8_t value)
+    void VoumeProcessSliderEventListener::FindAndApplyStrategy(uint8_t status, uint8_t value)
     {
         auto it = strategyMap.find(status);
         if (it != strategyMap.end())
@@ -120,38 +120,97 @@ namespace OHOS
         }
     }
 
+    void VoumeProcessSliderEventListener::ChangeVolumeValue(uint8_t status, uint8_t value)
+    {
+        FindAndApplyStrategy(status, value);
+
+        SoundAndVibrationVolumeSettingView *view = SoundAndVibrationVolumeSettingView::GetInstance();
+        if (view)
+        {
+            if (view->GetVolumeType() == SYSTEM_VOLUME)
+            {
+                ConfigModel::GetInstance()->SetSystemVolume(value);
+            }
+            else if (view->GetVolumeType() == CALL_VOLUME)
+            {
+                ConfigModel::GetInstance()->SetCallVolume(value);
+            }
+        }
+    }
+
+    // 滑块变化事件处理
     void VoumeProcessSliderEventListener::OnChange(int32_t value)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnChange %d", value);
-        ChangeVolumeValue(OTHER, value);
+        if (isOnClickSlider && !isDragSlider && !isRotateSlider)
+        {
+            ChangeVolumeValue(OTHER, value);
+        }
     }
 
+    // 滑块释放事件处理
     void VoumeProcessSliderEventListener::OnRelease(int32_t value)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnRelease %d", value);
         ChangeVolumeValue(OTHER, value);
-
-        if ( SoundAndVibrationVolumeSettingView::GetInstance()->GetVolumeType() == SYSTEM_VOLUME)
-        {
-            ConfigModel::GetInstance()->SetSystemVolume(value);
-        }
-        else if (SoundAndVibrationVolumeSettingView::GetInstance()->GetVolumeType() == CALL_VOLUME)
-        {
-            ConfigModel::GetInstance()->SetCallVolume(value);
-        }
     }
 
+    // 滑块点击事件处理
     bool VoumeProcessSliderEventListener::OnClick(UIView &view, const ClickEvent &event)
     {
         UNUSED(event);
-        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::OnClick");
+        UISlider *slider = dynamic_cast<UISlider *>(&view);
+        SoundAndVibrationVolumeSettingView *soundAndVibrationVolumeSettingView = SoundAndVibrationVolumeSettingView::GetInstance();
+        if (slider != nullptr && soundAndVibrationVolumeSettingView != nullptr)
+        {
+            if (slider == soundAndVibrationVolumeSettingView->GetVolumeProcess())
+            {
+                isOnClickSlider = true;
+                isDragSlider = false;
+                isRotateSlider = false;
+            }
+        }
         return true;
     }
 
+    // 滑块拖动事件处理
     bool VoumeProcessSliderEventListener::OnDrag(UIView &view, const DragEvent &event)
     {
         UNUSED(event);
-        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::OnDrag");
+        UISlider *slider = dynamic_cast<UISlider *>(&view);
+        SoundAndVibrationVolumeSettingView *soundAndVibrationVolumeSettingView = SoundAndVibrationVolumeSettingView::GetInstance();
+        if (slider != nullptr && soundAndVibrationVolumeSettingView != nullptr)
+        {
+            if (slider == soundAndVibrationVolumeSettingView->GetVolumeProcess())
+            {
+                isOnClickSlider = false;
+                isDragSlider = true;
+                isRotateSlider = false;
+            }
+        }
+        return true;
+    }
+
+    // 滑块旋转结束事件处理
+    bool VoumeProcessSliderEventListener::OnRotateEnd(UIView &view, const RotateEvent &event)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::OnRotateEnd");
+        UISlider *slider = dynamic_cast<UISlider *>(&view);
+        SoundAndVibrationVolumeSettingView *soundAndVibrationVolumeSettingView = SoundAndVibrationVolumeSettingView::GetInstance();
+        if (slider != nullptr && soundAndVibrationVolumeSettingView != nullptr)
+        {
+            if (slider == soundAndVibrationVolumeSettingView->GetVolumeProcess())
+            {
+                isDragSlider = false;
+                isOnClickSlider = false;
+                isRotateSlider = true;
+
+                int value = slider->GetValue();
+                ChangeVolumeValue(OTHER, value);
+            }
+        }
         return true;
     }
 }
index eea2125..f4254f4 100644 (file)
@@ -11,14 +11,14 @@ namespace OHOS
 
     SoundAndVibrationVolumeSettingView::SoundAndVibrationVolumeSettingView(uint8_t VolumeType)
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationVolumeSettingView::SoundAndVibrationVolumeSettingView,VolumeType = %d", VolumeType);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationVolumeSettingView::SoundAndVibrationVolumeSettingView,VolumeType = %d", VolumeType);
         m_VolumeType = VolumeType;
         g_pSoundAndVibrationVolumeSettingView = this;
     }
 
     SoundAndVibrationVolumeSettingView::~SoundAndVibrationVolumeSettingView()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationVolumeSettingView::~SoundAndVibrationVolumeSettingView");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationVolumeSettingView::~SoundAndVibrationVolumeSettingView");
         ClearAll();
         g_pSoundAndVibrationVolumeSettingView = nullptr;
     }
@@ -32,19 +32,27 @@ namespace OHOS
     {
         if (initViewStatus == true)
         {
-            ScrollView->RemoveAll();
-
-            delete VolumeProcess;
-            VolumeProcess = nullptr;
-
-            delete VolumeVetor;
-            VolumeVetor = nullptr;
-
-            delete listener;
-            listener = nullptr;
-
-            delete ScrollView;
-            ScrollView = nullptr;
+            if (ScrollView != nullptr)
+            {
+                ScrollView->RemoveAll();
+                if (VolumeProcess != nullptr)
+                {
+                    delete VolumeProcess;
+                    VolumeProcess = nullptr;
+                }
+                if (VolumeVetor != nullptr)
+                {
+                    delete VolumeVetor;
+                    VolumeVetor = nullptr;
+                }
+                if (listener != nullptr)
+                {
+                    delete listener;
+                    listener = nullptr;
+                }
+                delete ScrollView;
+                ScrollView = nullptr;
+            }
         }
     }
 
@@ -96,6 +104,8 @@ namespace OHOS
         VolumeProcess->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
         VolumeProcess->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff);
         VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle());
+        VolumeProcess->RequestFocus();
+        VolumeProcess->SetRotateFactor(1.0);
         /* ------------------------------- VolumeVetor ------------------------------ */
         VolumeVetor = new UIImageView();
         if (VolumeVetor == nullptr)
@@ -118,12 +128,12 @@ namespace OHOS
         VolumeProcess->SetSliderEventListener(listener);
         VolumeProcess->SetOnClickListener(listener);
         VolumeProcess->SetOnDragListener(listener);
-        VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle());
+        VolumeProcess->SetOnRotateListener(listener);
 
         ScrollView->Add(VolumeProcess);
         ScrollView->Add(VolumeVetor);
         initViewStatus = true;
-        
+
         return ScrollView;
     }
 
index 8b4a567..30db852 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-06-12 11:44:04\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-06-19 18:21:36\r
+ * @LastEditTime: 2024-07-23 16:58:58\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp\r
  */\r
 #include "soundandvibration/include/SystemVolumeView.h"\r
@@ -77,6 +77,11 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::OnStart");\r
         View<SystemVolumePresenter>::OnStart();\r
         SetContainerView(new UIViewGroup());\r
+        if (GetContainer() == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetContainerView fail!!");\r
+            return;\r
+        }\r
         container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
         container_->SetTouchable(true);\r
         container_->SetDraggable(true);\r
index b5512d6..4cbd6c2 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-22 14:35:22
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-19 15:31:31
+ * @LastEditTime: 2024-07-24 17:49:58
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/VibrationModeView.cpp
  */
 #include "soundandvibration/include/VibrationModeView.h"
@@ -14,7 +14,7 @@
 namespace OHOS
 {
 
-    static constexpr uint8_t ROTATEFACTOR = 2;
+    static constexpr const float ROTATEFACTOR = 1.0;
 
     static VibrationModeView *g_pVibrationModeView{nullptr};
 
@@ -94,11 +94,12 @@ namespace OHOS
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VibrationModeView::Title is nullptr!");
                 return nullptr;
             }
-            Title->SetPosition(93, 52, 280, 40);
+            Title->SetPosition(93, 50, 280, 40);
             Title->SetStyle(STYLE_TEXT_FONT, 30);
             Title->SetStyle(STYLE_LINE_HEIGHT, 35);
             Title->SetTextId(STR_VIBRATION_MODE); // 震动模式
-            Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+            Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            Title->SetRollSpeed(70);
             Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
             Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             scrollView->Add(Title);
index 2ff7838..c97f737 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-14 09:40:13
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-06 18:33:51
+ * @LastEditTime: 2024-07-24 20:33:55
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleView.h
  */
 
@@ -24,7 +24,7 @@
 
 namespace OHOS
 {
-    static constexpr const uint16_t MAX_STYLE = MAX_THEME_STYLE-1;
+    static constexpr const uint16_t MAX_STYLE = MAX_THEME_STYLE - 1;
     static constexpr char *THEME_STYLE_LIST = "themestyleList";         // 列表
     static constexpr char *THEME_STYLE_HEXAGONS = "themestyleHexagons"; // 蜂窝
     static constexpr char *THEME_STYLE_FOOTBALL = "themestyleFootball"; // 足球
@@ -39,6 +39,15 @@ namespace OHOS
     {
     public:
         struct LabelButtonConfig
+        {
+            int16_t left;
+            int16_t top;
+            int16_t width;
+            int16_t height;
+            const char *viewId;
+        };
+
+        struct LabelConfig
         {
             int16_t left;
             int16_t top;
@@ -46,8 +55,8 @@ namespace OHOS
             int16_t height;
             int16_t fontSize;
             int16_t lineHeigh;
-            const char *viewId;
             int16_t textId;
+            uint8_t lineBreakMode;
         };
 
         struct ImageConfig
@@ -70,6 +79,7 @@ namespace OHOS
         void OnStop() override;
 
     private:
+        UILabelExt *ThemeStyleLabelViewinit(LabelConfig &labelconfig);
         bool CreateThemeStyleScrollView(void);
         bool CreateThemeStyleLabelView(void);
         bool CreateThemeStyleLabelButtonView(void);
@@ -81,8 +91,11 @@ namespace OHOS
         UIScrollView *scrollView{nullptr};
         UILabelExt *titleText;
         UILabelButtonExt *ThemeStyleLabelButton[MAX_STYLE]{nullptr};
+        UILabelExt *ThemeStyleLabel[MAX_STYLE]{nullptr};
         UIImageView *ThemeStyleImage[MAX_STYLE]{nullptr};
         UILabelButtonExt *ExitLabelButton{nullptr};
+        UILabelExt *ExitLabel{nullptr};
+        bool initViewStatus{false};
     };
 }
 #endif // SET_THEMESTYLE_VIEW_H
index ca34acb..39ad7f2 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-14 09:40:20
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-06 18:34:04
+ * @LastEditTime: 2024-07-24 20:43:01
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleView.cpp
  */
 
@@ -35,36 +35,37 @@ namespace OHOS
 
     void ThemeStyleView::ClearAll(void)
     {
-        if (scrollView != nullptr)
+        if (initViewStatus)
         {
-            scrollView->RemoveAll();
+            if (scrollView != nullptr)
+            {
+                scrollView->RemoveAll();
 
-            delete titleText;
-            titleText = nullptr;
+                delete titleText;
+                titleText = nullptr;
 
-            for (int i = 0; i < MAX_STYLE; i++)
-            {
-                delete ThemeStyleLabelButton[i];
-                ThemeStyleLabelButton[i] = nullptr;
+                for (int i = 0; i < MAX_STYLE; i++)
+                {
+                    delete ThemeStyleLabelButton[i];
+                    ThemeStyleLabelButton[i] = nullptr;
 
-                delete ThemeStyleImage[i];
-                ThemeStyleImage[i] = nullptr;
-            }
+                    delete ThemeStyleLabel[i];
+                    ThemeStyleLabel[i] = nullptr;
 
-            delete ExitLabelButton;
-            ExitLabelButton = nullptr;
+                    delete ThemeStyleImage[i];
+                    ThemeStyleImage[i] = nullptr;
+                }
 
-            delete scrollView;
-            scrollView = nullptr;
-        }
-    }
+                delete ExitLabelButton;
+                ExitLabelButton = nullptr;
 
-    // 设置按键监听
-    static void SetKeyActListener()
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetKeyActListener");
-        RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::ThemeStylePresenter::GetInstance();
-        RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+                delete ExitLabel;
+                ExitLabel = nullptr;
+
+                delete scrollView;
+                scrollView = nullptr;
+            }
+        }
     }
 
     UILabelButtonExt *ThemeStyleView::ThemeStyleLabelButtonViewInit(LabelButtonConfig &labelbuttonconfig)
@@ -80,14 +81,12 @@ namespace OHOS
         labelButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         labelButton->SetImagePosition(300, 30);
         labelButton->SetImageSrc(PNG_CHECKBOX_OFF_IMAGE, PNG_CHECKBOX_OFF_IMAGE);
-        labelButton->SetTextId(labelbuttonconfig.textId);
-        labelButton->SetAlign(TEXT_ALIGNMENT_LEFT);
-        labelButton->SetLabelPosition(100, 0);
-        labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelbuttonconfig.fontSize);
-        labelButton->SetStyle(STYLE_LINE_HEIGHT, labelbuttonconfig.lineHeigh);
+        // labelButton->SetTextId(labelbuttonconfig.textId);
+        // labelButton->SetAlign(TEXT_ALIGNMENT_LEFT);
+        // labelButton->SetLabelPosition(100, 0);
+        // labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelbuttonconfig.fontSize);
+        // labelButton->SetStyle(STYLE_LINE_HEIGHT, labelbuttonconfig.lineHeigh);
         labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
-        labelButton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);
-        labelButton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);
         labelButton->SetOnClickListener(presenter_);
 
         return labelButton;
@@ -105,6 +104,24 @@ namespace OHOS
         return Image;
     }
 
+    UILabelExt *ThemeStyleView::ThemeStyleLabelViewinit(LabelConfig &labelconfig)
+    {
+        UILabelExt *label = new UILabelExt();
+        if (label == nullptr)
+        {
+            return nullptr;
+        }
+        label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height);
+        label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);
+        label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);
+        label->SetTextId(labelconfig.textId);
+        label->SetLineBreakMode(labelconfig.lineBreakMode);
+        label->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
+        label->SetRollSpeed(70);
+        label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
+        return label;
+    }
+
     bool ThemeStyleView::CreateThemeStyleScrollView(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleView::InitThemeStyleScrollView");
@@ -118,6 +135,8 @@ namespace OHOS
         scrollView->SetScrollBlankSize(SCROLLBLANKSIZE);
         scrollView->SetReboundSize(REBOUNDSIZE);
         scrollView->SetHorizontalScrollState(false);
+        scrollView->RequestFocus();
+        scrollView->SetRotateFactor(1.0);
         scrollView->SetTouchable(true);
         scrollView->SetDraggable(true);
         container_->Add(scrollView);
@@ -134,14 +153,55 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleText new fail!");
             return false;
         }
-        titleText->SetPosition(83, 52, 300, 35);
+        titleText->SetPosition(83, 50, 300, 35);
         titleText->SetTextId(STR_DISPLAY_MODE); // 显示方式
         titleText->SetStyle(STYLE_TEXT_FONT, 30);
         titleText->SetStyle(STYLE_LINE_HEIGHT, 35);
-        titleText->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+        titleText->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
         titleText->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         titleText->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         scrollView->Add(titleText);
+        /* -------------------------------------------------------------------------- */
+        // const char *viewId[MAX_STYLE] = {THEME_STYLE_LIST, THEME_STYLE_HEXAGONS, THEME_STYLE_FOOTBALL};
+        // uint16_t textId[MAX_STYLE] = {STR_LIST_DISPLAY, STR_CELLULAR_DISPLAY, STR_GRID_DISPLAY};
+        int16_t textId[MAX_STYLE] = {STR_LIST_DISPLAY, STR_CELLULAR_DISPLAY};
+        LabelConfig labelConfig = {
+            .left = 143,
+            .top = 153,
+            .width = 180,
+            .height = 35,
+            .fontSize = 30,
+            .lineHeigh = 35,
+            .textId = 0,
+            .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
+        };
+        for (int16_t i = 0; i < MAX_STYLE; i++)
+        {
+            labelConfig.top = 153 + 120 * i;
+            labelConfig.textId = textId[i];
+            ThemeStyleLabel[i] = ThemeStyleLabelViewinit(labelConfig);
+            if (ThemeStyleLabel[i] == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThemeStyleLabel[%d] is nullptr", i);
+                return false;
+            }
+            scrollView->Add(ThemeStyleLabel[i]);
+        }
+        /* -------------------------------------------------------------------------- */
+        ExitLabel = new UILabelExt();
+        if (ExitLabel == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ExitLabel new fail!");
+            return false;
+        }
+        ExitLabel->SetPosition(113, labelConfig.top + 120, 240, 35);
+        ExitLabel->SetTextId(STR_CLOSE); /*关闭*/
+        ExitLabel->SetStyle(STYLE_TEXT_FONT, 30);
+        ExitLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+        ExitLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+        ExitLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+        ExitLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        scrollView->Add(ExitLabel);
 
         return true;
     }
@@ -153,22 +213,14 @@ namespace OHOS
             .top = 120,
             .width = 380,
             .height = 100,
-            .fontSize = 30,
-            .lineHeigh = 35,
             .viewId = THEME_STYLE_LIST,
-            .textId = STR_LIST_DISPLAY,
         };
 
-        int top = 120;
-        // const char *viewId[MAX_STYLE] = {THEME_STYLE_LIST, THEME_STYLE_HEXAGONS, THEME_STYLE_FOOTBALL};
-        // uint16_t textId[MAX_STYLE] = {STR_LIST_DISPLAY, STR_CELLULAR_DISPLAY, STR_GRID_DISPLAY};
         const char *viewId[MAX_STYLE] = {THEME_STYLE_LIST, THEME_STYLE_HEXAGONS};
-        uint16_t textId[MAX_STYLE] = {STR_LIST_DISPLAY, STR_CELLULAR_DISPLAY};
         for (int i = 0; i < MAX_STYLE; i++)
         {
-            labelbuttonconfig.top = top + 120 * i;
+            labelbuttonconfig.top = 120 + 120 * i;
             labelbuttonconfig.viewId = viewId[i];
-            labelbuttonconfig.textId = textId[i];
             ThemeStyleLabelButton[i] = ThemeStyleLabelButtonViewInit(labelbuttonconfig);
             if (ThemeStyleLabelButton[i] == nullptr)
             {
@@ -188,12 +240,7 @@ namespace OHOS
         ExitLabelButton->Resize(labelbuttonconfig.width, labelbuttonconfig.height);
         ExitLabelButton->SetViewId(THEMESTYLEVIEWEXIT);
         ExitLabelButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
-        ExitLabelButton->SetTextId(STR_CLOSE);
-        ExitLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
-        ExitLabelButton->SetStyle(STYLE_LINE_HEIGHT, labelbuttonconfig.lineHeigh);
         ExitLabelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
-        ExitLabelButton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);
-        ExitLabelButton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);
         ExitLabelButton->SetOnClickListener(presenter_);
         scrollView->Add(ExitLabelButton);
 
@@ -210,7 +257,7 @@ namespace OHOS
             .src = THEMESTYLE_LIST_IMAGEPATH,
         };
         int y = 150;
-        //const char *src[MAX_STYLE] = {THEMESTYLE_LIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH, THEMESTYLE_FOOTBALL_IMAGEPATH};
+        // const char *src[MAX_STYLE] = {THEMESTYLE_LIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH, THEMESTYLE_FOOTBALL_IMAGEPATH};
         const char *src[MAX_STYLE] = {THEMESTYLE_LIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH};
         for (int i = 0; i < MAX_STYLE; i++)
         {
@@ -231,13 +278,15 @@ namespace OHOS
     void ThemeStyleView::ThemeStyleViewInit(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleView::ThemeStyleViewInit");
-        if (!CreateThemeStyleScrollView() || !CreateThemeStyleLabelView() ||
-            !CreateThemeStyleLabelButtonView() || !CreateThemeStyleImageView())
+        if (!CreateThemeStyleScrollView() || !CreateThemeStyleLabelButtonView() ||
+            !CreateThemeStyleLabelView() || !CreateThemeStyleImageView())
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThemeStyleView::ThemeStyleViewInit fail!!");
             return;
         }
         UpdateSelectedStyle();
+
+        initViewStatus = true;
     }
 
     void ThemeStyleView::OnStart()
@@ -250,8 +299,11 @@ namespace OHOS
         container_->SetTouchable(true);
         container_->SetDraggable(true);
 
-        ThemeStyleViewInit();
-        SetKeyActListener();
+        if (!initViewStatus)
+        {
+            ThemeStyleViewInit();
+        }
+        RootView::GetInstance()->SetOnKeyActListener(presenter_);
     }
 
     void ThemeStyleView::OnSetUpView()
index dee114b..2b8d024 100644 (file)
@@ -32,7 +32,7 @@ namespace OHOS
     void WatchQRCodePresenter::OnStart()
     {
         Presenter<WatchQRCodeView>::OnStart();
-        ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);
+        // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);
     }
 
     void WatchQRCodePresenter::OnResume(void)
@@ -43,7 +43,7 @@ namespace OHOS
     void WatchQRCodePresenter::OnStop(void)
     {
         Presenter<WatchQRCodeView>::OnStop();
-        ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON);
+        // ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON);
         return;
     }