* @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
*/
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};
};
}
* @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"
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())
{
* @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"
group->Add(FlashlightVector);
group->Add(LineImage);
RootView::GetInstance()->Add(group);
+ container_ = group;
Draw();
}