From: luozheng <1732036298@qq.com> Date: Tue, 3 Sep 2024 02:37:30 +0000 (+0800) Subject: 解決:蓝牙服务界面开关加载动画可以手动上下滑动bug #383 X-Git-Tag: release_V1.2.70_20241020_135402~529^2~25 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=0b82c528ac6c7afbeb197d9b003378289bc6b710;p=mirrors%2FFD230.git 解決:蓝牙服务界面开关加载动画可以手动上下滑动bug #383 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp index 7405572fc..daab2695c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-03 11:10:08 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-31 15:11:39 + * @LastEditTime: 2024-09-03 10:18:56 * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp */ #include "aivoice/include/AiVoiceConnectingView.h" @@ -51,7 +51,6 @@ namespace OHOS delete connectingAnimatorView; connectingAnimatorView = nullptr; FreeImageInfoArray(connectingPathsArray, AIVoiceListeningImagePaths, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - } if (cancelLabel) { @@ -132,6 +131,7 @@ namespace OHOS animatorView->SetPosition(imageanimatorconfig.x, imageanimatorconfig.y, imageanimatorconfig.width, imageanimatorconfig.height); animatorView->SetImageAnimatorSrc(imageanimatorconfig.imageInfoArray, imageanimatorconfig.numFrames, imageanimatorconfig.delay); animatorView->SetRepeat(true); + animatorView->SetSizeFixed(true); // animatorView->SetAutoEnable(false); // animatorView->SetResizeMode(UIImageAnimatorView::FILL); animatorView->Start(); @@ -300,6 +300,8 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::CreateAiVoiceConnectingView fail!!"); return nullptr; } + connectingAnimatorView->SetPosition(183, 183); + connectingAnimatorView->Invalidate(); scrollView->Add(connectingAnimatorView); return scrollView; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsPresenter.h index 0d0f2824d..36134ba16 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-20 10:27:30 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-25 14:18:02 + * @LastEditTime: 2024-09-03 10:29:03 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsPresenter.h */ #ifndef BLUETOOTH_SERVICE_OPTIONS_PRESENTER_H @@ -36,6 +36,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/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp index 189443280..51590169c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp @@ -67,10 +67,8 @@ namespace OHOS std::map buttonMap = { {classicBlueToothView->GetHFP_ToggleButton(), "HFP"}, - { - classicBlueToothView->GetA2DP_ToggleButton(), - "A2DP", - }}; + {classicBlueToothView->GetA2DP_ToggleButton(),"A2DP",}, + }; auto it = buttonMap.find(&view); if (it != buttonMap.end()) @@ -135,6 +133,16 @@ namespace OHOS { UNUSED(view); UNUSED(event); + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { + int16_t deltaX; + int16_t deltaY; + deltaX = event.GetDeltaX(); + deltaY = event.GetDeltaY(); + if (MATH_ABS(deltaX) >= MATH_ABS(deltaY) && MATH_ABS(deltaX) > 30) { + // MainAlarmView::GetInstance()->DropView(view); + X_DRAG_FLAG = true; + } + } return true; } @@ -142,10 +150,11 @@ namespace OHOS { UNUSED(view); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothServiceOptionsPresenter::OnDragEnd"); - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && X_DRAG_FLAG) { if(! BluetoothServiceOptionsView::GetInstance()->get_connectview_Visible()) NativeAbility::GetInstance().Back(); + X_DRAG_FLAG = false; } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp index b3570cb0b..15f937d01 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp @@ -205,8 +205,8 @@ namespace OHOS return false; } BlueToothScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - BlueToothScrollView->SetScrollBlankSize(35); - BlueToothScrollView->SetReboundSize(50); + // BlueToothScrollView->SetScrollBlankSize(35); + // BlueToothScrollView->SetReboundSize(50); BlueToothScrollView->SetDirection(1); UIView::OnDragListener *draglistener = static_cast(BluetoothServiceOptionsPresenter::GetInstance()); if (draglistener == nullptr) @@ -234,6 +234,7 @@ namespace OHOS label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh); // 字体行高 label->SetTextId(labelconfig.textId); label->SetLineBreakMode(labelconfig.lineBreakMode); // 断行模式。 + label->SetRollSpeed(70); label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize); return label; }