From: luozheng <1732036298@qq.com> Date: Wed, 28 Jan 2026 09:28:12 +0000 (+0800) Subject: 解决声音与震动界面息屏后滑动监听失效问题;运动识别弹窗震动两次,默认强度设置为强 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3148%2Ftarget%2F1;p=mirrors%2FFD230.git 解决声音与震动界面息屏后滑动监听失效问题;运动识别弹窗震动两次,默认强度设置为强 --- diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/include/SoundAndVibrationView.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/include/SoundAndVibrationView.h index 7922a1c02..2e296723c 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/include/SoundAndVibrationView.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/include/SoundAndVibrationView.h @@ -83,6 +83,7 @@ namespace OHOS bool InitSoundAndVibrationToggleButton(void); private: + UIViewGroup *group{nullptr}; UIScrollView *SoundAndVibrationScrollView[MAX_SOUNDANDVIBRATIONVIEWID]{nullptr}; UILabelExt *Title{nullptr}; // 标题:“声音与震动” // UILabelButtonExt *SystemVolumeButton{nullptr}; // 系统音量按钮 diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp index cf6910abd..0831a857c 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/CallVolumeView.cpp @@ -63,16 +63,13 @@ namespace OHOS return nullptr; } } + CallVolumeScrollView->SetOnDragListener(presenter_); return CallVolumeScrollView; } void CallVolumeView::OnStart() { - GetRootContainer()->SetTouchable(true); - GetRootContainer()->SetDraggable(true); - GetRootContainer()->SetOnDragListener(presenter_); - if (!initViewStatus) { CallVolumeViewInit(); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp index 9ab595b11..e97a12a06 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SoundAndVibrationView.cpp @@ -54,6 +54,10 @@ namespace OHOS if (initViewStatus == true) { + group->RemoveAll(); + delete group; + group = nullptr; + if (SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] != nullptr) { SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->RemoveAll(); @@ -128,7 +132,7 @@ namespace OHOS FocusManager::GetInstance()->RequestFocus(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]); FocusManager::GetInstance()->RequestFocusByDirection(FOCUS_DIRECTION_UP); SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetRotateFactor(1.0); - AddViewToRootContainer(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]); + group->Add(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]); return true; } @@ -338,9 +342,20 @@ namespace OHOS void SoundAndVibrationView::OnStart() { - GetRootContainer()->SetTouchable(true); - GetRootContainer()->SetDraggable(true); - GetRootContainer()->SetOnDragListener(presenter_); + if (group == nullptr) + { + group = new UIViewGroup(); + if (group == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); + return ; + } + } + group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + group->SetDraggable(true); + group->SetTouchable(true); + group->SetOnDragListener(presenter_); + AddViewToRootContainer(group); if (!initViewStatus) { @@ -354,7 +369,7 @@ namespace OHOS if (SoundAndVibrationScrollView[thisView] == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::ChangeSoundAndVibrationView"); - AddViewToRootContainer(SoundAndVibrationScrollView[thisView]); + group->Add(SoundAndVibrationScrollView[thisView]); } return true; } @@ -375,7 +390,7 @@ namespace OHOS } } SoundAndVibrationScrollView[thisView] = vibrationModeView->VibrationModeViewInit(); - AddViewToRootContainer(SoundAndVibrationScrollView[thisView]); + group->Add(SoundAndVibrationScrollView[thisView]); } return true; } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp index 541b56616..873279fda 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/soundandvibration/src/SystemVolumeView.cpp @@ -74,16 +74,13 @@ namespace OHOS return nullptr; } } + SystemVolumeScrollView->SetOnDragListener(presenter_); return SystemVolumeScrollView; } void SystemVolumeView::OnStart() { - GetRootContainer()->SetTouchable(true); - GetRootContainer()->SetDraggable(true); - GetRootContainer()->SetOnDragListener(presenter_); - if (!initViewStatus) { SystemVolumeViewInit(); diff --git a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/motion_recognition_notification.cpp b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/motion_recognition_notification.cpp index 786ab978e..37cab10d1 100644 --- a/code/sdk/application/wearable/fd272/service/msg_center/src/notify/motion_recognition_notification.cpp +++ b/code/sdk/application/wearable/fd272/service/msg_center/src/notify/motion_recognition_notification.cpp @@ -353,6 +353,7 @@ namespace OHOS if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) { custom_VibratorFunc_int(0); + custom_VibratorFunc_int(0); } /* -------------------------------------------------------------------------- */ NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeMotionRecognitionView); diff --git a/code/sdk/zhihui/config/include/ConfigModel.h b/code/sdk/zhihui/config/include/ConfigModel.h index 6ca170ddb..7ba93ba14 100644 --- a/code/sdk/zhihui/config/include/ConfigModel.h +++ b/code/sdk/zhihui/config/include/ConfigModel.h @@ -336,7 +336,7 @@ namespace OHOS {ConfigDataType::DATATYPE_STRING, "language_code", "zh" },//CONFIGMODEL_ITEM_LANGUAGE_CODE, //默认没有选择语言 {ConfigDataType::DATATYPE_INT, "timezone", "32" },//CONFIGMODEL_ITEM_TIMEZONE, //单位刻钟 默认+8 小时 = 4*8 = 32 刻钟 {ConfigDataType::DATATYPE_BOOL, "slient_mode", "false" },//CONFIGMODEL_ITEM_SILENT_MODE, - {ConfigDataType::DATATYPE_INT, "vibrator_switch", "2" },//CONFIGMODEL_ITEM_VIBRATOR_SWITCH, // 马达 开关,3 强,2 中,1 å¼±,0 关 + {ConfigDataType::DATATYPE_INT, "vibrator_switch", "3" },//CONFIGMODEL_ITEM_VIBRATOR_SWITCH, // 马达 开关,3 强,2 中,1 å¼±,0 关 {ConfigDataType::DATATYPE_BOOL, "rase2wake", "true" },//CONFIGMODEL_ITEM_RAISE_TO_WAKE, {ConfigDataType::DATATYPE_INT, "stepcount", "0" },//CONFIGMODEL_ITEM_ACTIVITY_VALUES_STEPCOUNT, //活动数据步数 {ConfigDataType::DATATYPE_INT, "calories", "0" },// CONFIGMODEL_ITEM_ACTIVITY_VALUES_CALORIES, //活动数据卡路里,