解決:蓝牙服务界面开关加载动画可以手动上下滑动bug #383
authorluozheng <1732036298@qq.com>
Tue, 3 Sep 2024 02:37:30 +0000 (10:37 +0800)
committerluozheng <1732036298@qq.com>
Tue, 3 Sep 2024 02:37:30 +0000 (10:37 +0800)
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsPresenter.h
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp

index 7405572..daab269 100644 (file)
@@ -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;
     }
index 0d0f282..36134ba 100644 (file)
@@ -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};
     };
 }
 
index 1894432..5159016 100644 (file)
@@ -67,10 +67,8 @@ namespace OHOS
 
         std::map<UIView *, std::string> 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;
index b3570cb..15f937d 100644 (file)
@@ -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<UIView::OnDragListener *>(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;
     }