From: luozheng <1732036298@qq.com> Date: Fri, 7 Jun 2024 10:06:59 +0000 (+0800) Subject: 手电筒视图优化 X-Git-Tag: release_V1.2.70_20241020_135402~1029 X-Git-Url: http://git.snicker.com.cn/css/html/static/gitweb.css?a=commitdiff_plain;h=6432b116659d6406d92d14d9f02c7d017216cec3;p=mirrors%2FFD230.git 手电筒视图优化 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h index 440250ddd..2d5b46e30 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-10 17:32:31 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-10 19:36:50 + * @LastEditTime: 2024-06-07 17:52:25 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/include/FlashlightPresenter.h */ @@ -38,6 +38,7 @@ namespace OHOS 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}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp index a6cb95766..d96dc1a7f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp @@ -2,12 +2,13 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-10 17:32:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-07 10:37:20 + * @LastEditTime: 2024-06-07 17:56:29 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightPresenter.cpp */ #include "AppViewIDs.h" #include "NativeAbility.h" +#include "UiConfig.h" #include "flashlight/include/FlashlightPresenter.h" #include "flashlight/include/FlashlightModel.h" #include "common/key_code.h" @@ -56,23 +57,30 @@ namespace OHOS bool FlashlightPresenter::OnDrag(UIView &view, const DragEvent &event) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDrag"); UNUSED(view); - UNUSED(event); + if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动 + { + FlashlightPresenter::X_DRAG_FLAG = true; + } return true; } bool FlashlightPresenter::OnDragEnd(UIView &view, const DragEvent &event) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDragEnd"); UNUSED(view); - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && FlashlightPresenter::X_DRAG_FLAG) { - NativeAbility::GetInstance().Back(); + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + X_DRAG_FLAG = false; } return true; } bool FlashlightPresenter::OnClick(UIView &view, const ClickEvent &event) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnClick"); UNUSED(event); if (&view == FlashlightView::GetInstance()->GetGroupView()) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp index 11eccc4e7..60bc2b7ea 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-10 17:32:08 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-10 21:22:43 + * @LastEditTime: 2024-06-07 18:04:33 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightView.cpp */ #include "flashlight/include/FlashlightView.h" @@ -133,6 +133,7 @@ namespace OHOS group->Add(FlashlightVector); group->Add(LineImage); RootView::GetInstance()->Add(group); + container_ = group; Draw(); }