还原ui_list.cpp中关于表冠震动的代码 3076/1 3076/head 3082/target/1 3083/target/1
authorluozheng <1732036298@qq.com>
Tue, 13 Jan 2026 09:21:17 +0000 (17:21 +0800)
committerluozheng <1732036298@qq.com>
Tue, 13 Jan 2026 09:21:17 +0000 (17:21 +0800)
code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_list.cpp

index ba279a8..75d331a 100644 (file)
@@ -17,9 +17,6 @@
 
 #include "components/ui_abstract_scroll_bar.h"
 #include "gfx_utils/graphic_log.h"
-#if ENABLE_VIBRATOR
-#include "hal_tick.h"
-#endif
 
 namespace OHOS {
 UIList::Recycle::~Recycle()
@@ -153,11 +150,6 @@ void UIList::Recycle::MoveAdapterItemsRelativeRect(int16_t x, int16_t y)
 
 UIList::UIList() : UIList(VERTICAL) {}
 
-/* --------------------------------- 减少震动次数 --------------------------------- */
-static uint32_t lastVibratorTime_;
-static constexpr uint32_t MIN_VIBRATOR_INTERVAL_MS = 100; // 最小振动间隔100毫秒
-/* -------------------------------------------------------------------------- */
-
 UIList::UIList(uint8_t direction)
     : onSelectedView_(nullptr),
       isLoopList_(false),
@@ -179,7 +171,6 @@ UIList::UIList(uint8_t direction)
 #if ENABLE_VIBRATOR
     needVibration_ = false;
     vibratorType_ = VibratorType::VIBRATOR_TYPE_ONE;
-    lastVibratorTime_ = 0;
 #endif
 #if ENABLE_FOCUS_MANAGER
     focusable_ = true;
@@ -716,25 +707,6 @@ void UIList::MoveChildByOffset(int16_t xOffset, int16_t yOffset)
                 }
             }
 #if ENABLE_VIBRATOR
-            VibratorFunc vibratorFunc = VibratorManager::GetInstance()->GetVibratorFunc();
-            if (isSelectViewFind && needVibration_ && vibratorFunc != nullptr) {
-                printf("isSelectViewFind = %d\n", isSelectViewFind);
-                uint32_t currentTime = HALTick::GetInstance().GetTime();
-                // 只有在规定时间间隔后才允许调用振动(首次调用时lastVibratorTime_为0,允许调用)
-                bool canVibrate = (lastVibratorTime_ == 0) || 
-                                  (HALTick::GetInstance().GetElapseTime(lastVibratorTime_) >= MIN_VIBRATOR_INTERVAL_MS);
-                if (canVibrate) {
-                    if (!isLoopList_ && (onSelectedIndex_ == 0 || onSelectedIndex_ == recycle_.adapter_->GetCount() - 1)) {
-                        vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE);
-                        GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_THREE vibrator");
-                    } else {
-                        vibratorFunc(VibratorType::VIBRATOR_TYPE_TWO);
-                        GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_TWO vibrator");
-                    }
-                    lastVibratorTime_ = currentTime;
-                }
-            }
-            #if 0
             VibratorFunc vibratorFunc = VibratorManager::GetInstance()->GetVibratorFunc();
             if (isSelectViewFind && needVibration_ && vibratorFunc != nullptr) {
                 if (!isLoopList_ && (onSelectedIndex_ == 0 || onSelectedIndex_ == recycle_.adapter_->GetCount() - 1)) {
@@ -745,7 +717,6 @@ void UIList::MoveChildByOffset(int16_t xOffset, int16_t yOffset)
                     GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_TWO vibrator");
                 }
             }
-            #endif
 #endif
         }
         view = view->GetNextSibling();