* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-01-29 15:37:44\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-18 14:52:47\r
+ * @LastEditTime: 2024-09-27 15:07:34\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/BrightnessControlView.h\r
*/\r
#ifndef BRIGHTNESS_CONTROL_VIEW_H\r
static const char *BRIGHTNESS_CONTROL_SLIDER = "BrightnessControlViewSlider";\r
class BrightnessSliderEventListener : public UISlider::UISliderEventListener,\r
public UIView::OnClickListener,\r
- public UIView::OnDragListener\r
+ public UIView::OnDragListener,\r
+ public UIView::OnRotateListener\r
{\r
public:\r
BrightnessSliderEventListener();\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
+ bool OnRotateEnd(UIView& view, const RotateEvent& event);\r
\r
private:\r
std::map<uint8_t, std::shared_ptr<BrightnessChangeStrategy>> strategyMap;\r
#include "ConfigModel.h"\r
#include "map"\r
#include "iostream"\r
+#include "vibrator_service.h"\r
namespace OHOS\r
{\r
static BrightnessControlView *g_pBrightnessControlView{nullptr};\r
BrightnessControlViewSlider->SetSliderEventListener(rawPointer);\r
BrightnessControlViewSlider->SetOnClickListener(rawPointer);\r
BrightnessControlViewSlider->SetOnDragListener(rawPointer);\r
+ BrightnessControlViewSlider->SetOnRotateListener(rawPointer);\r
BrightnessControlViewSlider->SetKnobStyle(StyleDefault::GetSliderKnobStyle());\r
return true;\r
}\r
UNUSED(view);\r
return true;\r
}\r
+\r
+ bool BrightnessSliderEventListener::OnRotateEnd(UIView& view, const RotateEvent& event)\r
+ {\r
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnRotateEnd %d", value);\r
+ ui_api_vibrate_once_func();//受设置中震动强度控制\r
+ return true;\r
+ }\r
}\r
#include "BluetoothHeadsetEvent.h"
#include "bts_avrcp_controller.h"
#include "ConfigModel.h"
+#include "vibrator_service.h"
namespace OHOS {
if (slider == progress)
{
ChangeVolume(VOLUMEDRAG);
+ ui_api_vibrate_once_func();//受设置中震动强度控制
}
}
return true;
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-19 10:08:21
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-06 14:11:01
+ * @LastEditTime: 2024-09-27 14:16:52
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h
*/
#ifndef SOUND_AND_VIBRATION_VOLUME_SETTING_PRESENTER_H
void OnRelease(int32_t value) override;
bool OnClick(UIView &view, const ClickEvent &event) override;
bool OnDrag(UIView &view, const DragEvent &event) override;
+ bool OnRotate(UIView& view, const RotateEvent& event);
bool OnRotateEnd(UIView& view, const RotateEvent& event);
private:
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-19 10:08:31
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-14 18:27:21
+ * @LastEditTime: 2024-09-27 15:08:56
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp
*/
#include "soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h"
#include "../../../../../../middleware/services/media/foundation/audiomanager/frameworks/audioservice/include/audio_service.h"
#include "vibrator_service.h"
#include "ConfigModel.h"
+#include <custom_runtime.h>
namespace OHOS
{
}
// 滑块旋转结束事件处理
- bool VoumeProcessSliderEventListener::OnRotateEnd(UIView &view, const RotateEvent &event)
+ bool VoumeProcessSliderEventListener::OnRotate(UIView &view, const RotateEvent &event)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::OnRotateEnd");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::OnRotate,%d",event.GetRotate());
UISlider *slider = dynamic_cast<UISlider *>(&view);
SoundAndVibrationVolumeSettingView *soundAndVibrationVolumeSettingView = SoundAndVibrationVolumeSettingView::GetInstance();
if (slider != nullptr && soundAndVibrationVolumeSettingView != nullptr)
}
return true;
}
+ bool VoumeProcessSliderEventListener::OnRotateEnd(UIView& view, const RotateEvent& event)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VoumeProcessSliderEventListener::OnRotateEnd,%d",event.GetRotate());
+ ui_api_vibrate_once_func();//受设置中震动强度控制
+ return true;
+ }
}
#ifdef __cplusplus
#if __cplusplus
uint16_t vibrationCnt = rotateLen / DEFAULT_SCROLL_VIEW_VIBRATION_LEN;
for (uint16_t i = 0; i < vibrationCnt; i++) {
GRAPHIC_LOGI("UIScrollView::OnRotateEvent calls TYPE_ONE vibrator");
- vibratorFunc(VibratorType::VIBRATOR_TYPE_ONE);
+ // vibratorFunc(VibratorType::VIBRATOR_TYPE_ONE);
}
lastVibratorRotateLen_ = totalRotateLen_;
}
}
if (vibratorFunc != nullptr && (!lastIsEdge && isEdge)) {
GRAPHIC_LOGI("UIScrollView::OnRotateEvent calls TYPE_THREE vibrator");
- vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE);
+ // vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE);
}
#endif
return UIView::OnRotateEvent(event);
bool UISlider::OnRotateEvent(const RotateEvent& event)
{
int32_t realRotation = 0;
- cachedRotation_ += event.GetRotate() * rotateFactor_;
+ int16_t invertedRotate = -event.GetRotate();//对旋转量取反
+ cachedRotation_ += invertedRotate * rotateFactor_;
+ // cachedRotation_ += event.GetRotate() * rotateFactor_;
realRotation = static_cast<int32_t>(cachedRotation_);
if (realRotation == 0) {
return UIView::OnRotateEvent(event);
if (vibratorFunc != nullptr && lastValue != curValue_) {
if (curValue_ == rangeMin_ || curValue_ == rangeMax_) {
GRAPHIC_LOGI("UISlider::OnRotateEvent calls TYPE_THREE vibrator");
- vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE);
+ // vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE);
} else {
int32_t changedValue = MATH_ABS(curValue_ - lastValue);
for (int32_t i = 0; i < changedValue; i++) {
GRAPHIC_LOGI("UISlider::OnRotateEvent calls TYPE_TWO vibrator");
- vibratorFunc(VibratorType::VIBRATOR_TYPE_TWO);
+ // vibratorFunc(VibratorType::VIBRATOR_TYPE_TWO);
}
}
}