* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-08-05 15:20:01\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-09-04 15:43:50\r
+ * @LastEditTime: 2024-09-28 18:06:32\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h\r
*/\r
\r
~BluetoothPresenter();\r
bool OnClick(UIView &view, const ClickEvent &event) override;\r
static BluetoothPresenter *GetInstance();\r
+ bool OnDrag(UIView& view, const DragEvent& event) override;\r
bool OnDragEnd(UIView& view, const DragEvent& event) override;\r
bool OnKeyAct(UIView &view, const KeyEvent &event) override;\r
void OnStart() override;\r
void ClickConnfailBackButton(void);\r
private:\r
BluetoothModel *bluetoothMode_{nullptr};\r
+ bool X_DRAG_FLAG{false};\r
};\r
} // namespace OHOS\r
#endif\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClickConnfailBackButton ConnectRemoteDevice retVal = %d", retVal);\r
}\r
\r
-bool BluetoothPresenter::OnDragEnd(UIView& view, const DragEvent& event)\r
+bool BluetoothPresenter::OnDrag(UIView& view, const DragEvent& event)\r
{\r
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) {\r
+ int16_t deltaX;\r
+ int16_t deltaY;\r
+ deltaX = event.GetDeltaX();\r
+ deltaY = event.GetDeltaY();\r
+ if (MATH_ABS(deltaX) >= MATH_ABS(deltaY) && MATH_ABS(deltaX) > 30) {\r
+ X_DRAG_FLAG = true;\r
+ }\r
+ }\r
+ return true;\r
+}\r
+\r
+bool BluetoothPresenter::OnDragEnd(UIView& view, const DragEvent& event)\r
+{\r
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && X_DRAG_FLAG) {\r
view_->DropView(view);\r
+ X_DRAG_FLAG = false;\r
}\r
return true;\r
}\r