Merge #239 into sdk602patch0521 from refs/changes/239/head
author罗正 <1732036298@qq.com>
Fri, 7 Jun 2024 13:29:22 +0000 (13:29 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Fri, 7 Jun 2024 13:29:22 +0000 (13:29 +0000)
Code review from 罗正

* refs/changes/239/head: (6 commits squashed)

  - 秒表视图添加退出动画

  - 手电筒视图优化

  - 勿扰模式和查找手机视图优化

  - Merge branch &#39;sdk602patch0521&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521

  - 优化指南针,倒计时,显示与亮度的退出逻辑

  - Merge branch &#39;sdk602patch0521&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521

Signed-off-by: 罗正 <1732036298@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/239
24 files changed:
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/compass/include/MainCompassPresenter.h
code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h
code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.h
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp
code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h
code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h
code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp
code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h
code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp
code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h
code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp

index 0de9bc1..95175ac 100644 (file)
@@ -12,6 +12,7 @@
 #include "traing/include/TraingModel.h"
 #include "components/ui_hexagons_list.h"
 #include "TransitionType.h"
+#include "AppViewIDs.h"
 
 namespace OHOS {
     ApplistPresenter::ApplistPresenter()
@@ -84,7 +85,8 @@ namespace OHOS {
         AppViewId viewId = itemView->GetViewId();
         if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) { // 2.0 threshold for beginning transition
             hexagonsView->StopRotateAnimator();
-            NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
+            //NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
+            NativeAbility::GetInstance().EnterSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
             hexagonsView->ClearFocus();
         }
         return true;
@@ -117,7 +119,7 @@ namespace OHOS {
             hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view
             type = TransitionType::TRANSITION_HEXAGONS;
         }
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d type = %d", viewId,type);
         if (viewId < VIEW_MAX_INTER_APP) {
             //NativeAbility::GetInstance().ChangeSlice(viewId, type);
             NativeAbility::GetInstance().EnterSlice(viewId, type);
index 8bc3c1d..4123c1d 100644 (file)
@@ -1,8 +1,10 @@
 /*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: MainCompassPresenter.h
- * Author:
- * Create: 2021-12-21
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-07 09:21:47
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-07 20:18:32
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/compass/include/MainCompassPresenter.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
 #ifndef COMPASS_MAINPRESENTER_H
 #define COMPASS_MAINPRESENTER_H
@@ -35,8 +37,10 @@ public:
 
     static MainCompassPresenter *GetInstance(void);
     bool OnDrag(UIView& view, const DragEvent& event) override;
+    bool OnDragEnd(UIView& view, const DragEvent& event) override;
     bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
     void Notify() override;
+    bool X_DRAG_FLAG{false};
 };
 }
 #endif
\ No newline at end of file
index bf87159..516365c 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-14 15:02:03
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 10:33:16
+ * @LastEditTime: 2024-06-07 20:23:18
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
@@ -13,6 +13,7 @@
 #include "wearable_log.h"
 #include "common/key_code.h"
 #include "custom_utils.h"
+#include "UiConfig.h"
 namespace OHOS
 {
     static MainCompassPresenter *g_pMainView = nullptr;
@@ -52,10 +53,22 @@ namespace OHOS
     */
     bool MainCompassPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCompassPresenter::OnDrag");
         UNUSED(view);
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
         {
-            NativeAbility::GetInstance().Back();
+            MainCompassPresenter::X_DRAG_FLAG = true;
+        }
+        return true;
+    }
+
+    bool MainCompassPresenter::OnDragEnd(UIView& view, const DragEvent& event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCompassPresenter::OnDragEnd");
+        UNUSED(view);
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainCompassPresenter::X_DRAG_FLAG)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
         }
         return true;
     }
@@ -71,7 +84,7 @@ bool MainCompassPresenter::OnKeyAct(UIView &view, const KeyEvent &event)
     // 如果是power键就返回上一级
     if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
     {
-        NativeAbility::GetInstance().Back();
+        NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
     }
     return true;
 }
index dea71c4..d946e7b 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-04-07 18:15:53\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-09 15:40:05\r
+ * @LastEditTime: 2024-06-07 19:57:56\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h\r
  */\r
 #ifndef MAIN_COUNTDOWN_PRESENTER_H\r
@@ -55,6 +55,7 @@ namespace OHOS
 \r
         std::string countdowntime{0};\r
         std::string ringtime{0};\r
+        bool X_DRAG_FLAG{false};\r
     };\r
 }\r
 \r
index fcacd87..40ea1b5 100644 (file)
@@ -1,5 +1,6 @@
 #include "AppViewIDs.h"\r
 #include "NativeAbility.h"\r
+#include "UiConfig.h"\r
 #include "countdown/include/MainCountDownPresenter.h"\r
 #include "countdown/include/CountDownModel.h"\r
 #include "common/key_code.h"\r
@@ -57,25 +58,33 @@ namespace OHOS
     {\r
         Presenter<MainCountDownView>::OnStop();\r
         ScreenAlwaysOnCtr(0); // 取消长亮屏\r
-\r
     }\r
 \r
     bool MainCountDownPresenter::OnDrag(UIView &view, const DragEvent &event)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCountDownPresenter::OnDrag");\r
         UNUSED(view);\r
-        UNUSED(event);\r
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动\r
+        {\r
+            MainCountDownPresenter::X_DRAG_FLAG = true;\r
+        }\r
         return true;\r
     }\r
 \r
     bool MainCountDownPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
     {\r
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && strcmp(view.GetViewId(), MAINCOUNTDOWNVIEW) == 0)\r
-        {\r
-            NativeAbility::GetInstance().Back();\r
-        }\r
-        else if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && strcmp(view.GetViewId(), COUNTDOWN_TIMECONFIG_VIEW) == 0)\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCountDownPresenter::OnDragEnd");\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainCountDownPresenter::X_DRAG_FLAG)\r
         {\r
-            MainCountDownView::GetInstance()->ChangeView(TIMECONFIG_COUNTDOWN, MAIN_COUNTDOWN);\r
+            if (strcmp(view.GetViewId(), MAINCOUNTDOWNVIEW) == 0)\r
+            {\r
+                NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
+            }\r
+            else if (strcmp(view.GetViewId(), COUNTDOWN_TIMECONFIG_VIEW) == 0)\r
+            {\r
+                MainCountDownView::GetInstance()->ChangeView(TIMECONFIG_COUNTDOWN, MAIN_COUNTDOWN);\r
+            }\r
+            MainCountDownPresenter::X_DRAG_FLAG = false;\r
         }\r
         return true;\r
     }\r
@@ -183,7 +192,7 @@ namespace OHOS
         // 如果是power键就返回上一级\r
         if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)\r
         {\r
-            NativeAbility::GetInstance().Back();\r
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
         }\r
         return true;\r
     }\r
index a70dd21..2680cba 100644 (file)
@@ -383,6 +383,7 @@ namespace OHOS
         scrollView[MAIN_COUNTDOWN]->Add(COUNTDOWN_THIRTY_MINUTE_BUTTON);\r
         group->Add(scrollView[MAIN_COUNTDOWN]);\r
         RootView::GetInstance()->Add(group);\r
+        container_ = group;\r
         Draw();\r
     }\r
 \r
index 445a202..1e070ae 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-02-18 09:10:05\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-18 15:53:53\r
+ * @LastEditTime: 2024-06-07 19:25:27\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h\r
  */\r
 #ifndef _DISPLAY_BRIGHTNESS_PRESENTER_H\r
@@ -100,6 +100,7 @@ namespace OHOS
         bool OnDragEnd(UIView &view, const DragEvent &event) override;\r
         bool OnChange(UICheckBox::UICheckBoxState state) override;\r
         bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件\r
+        bool X_DRAG_FLAG{false};\r
     };\r
 } // namespace OHOS\r
 \r
index c796fd7..21400b2 100644 (file)
@@ -2,10 +2,11 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-03-30 09:14:38\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-06-07 10:38:25\r
+ * @LastEditTime: 2024-06-07 19:55:47\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp\r
  */\r
 #include "AppViewIDs.h"\r
+#include "UiConfig.h"\r
 #include "components/ui_label_ext.h"\r
 #include "language/font/ui_resource_string.h"\r
 #include "NativeAbility.h"\r
@@ -152,32 +153,38 @@ namespace OHOS
 \r
     bool DisplayBrightnessPresenter::OnClick(UIView &view, const ClickEvent &event)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnClick");\r
         DisplayBrightnessView *p_DisplayBrightnessView = DisplayBrightnessView::GetInstance();\r
-        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (p_DisplayBrightnessView == nullptr)\r
+        {\r
+            return false;\r
+        }\r
         if (strcmp(view.GetViewId(), BRINGHTNESSCONTROLBUTTON_VIEW) == 0)\r
         {\r
             NativeAbility::GetInstance().EnterSlice(VIEW_BRIGHTNESSLEVEL);\r
-            return true;\r
         }\r
-        if (strcmp(view.GetViewId(), SCREENDURATIONBUTTON_VIEWID) == 0)\r
+        else if (strcmp(view.GetViewId(), SCREENDURATIONBUTTON_VIEWID) == 0)\r
         {\r
             p_DisplayBrightnessView->ChangeView(DISPLAYBRIGHTNESSVIEW, SCREENDURATIONVIEW); // 切换到亮屏时长视图\r
-            return true;\r
         }\r
-        return false;\r
+        return true;\r
     }\r
 \r
     bool DisplayBrightnessPresenter::OnDrag(UIView &view, const DragEvent &event)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnDrag");\r
         UNUSED(view);\r
-        UNUSED(event);\r
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动\r
+        {\r
+            DisplayBrightnessPresenter::X_DRAG_FLAG = true;\r
+        }\r
         return true;\r
     }\r
 \r
     bool DisplayBrightnessPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
     {\r
         DisplayBrightnessView *p_DisplayBrightnessView = DisplayBrightnessView::GetInstance();\r
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && DisplayBrightnessPresenter::X_DRAG_FLAG)\r
         {\r
             if (strcmp(view.GetViewId(), SCREENDURATIONSCROLLVIEW) == 0)\r
             {\r
@@ -185,9 +192,10 @@ namespace OHOS
             }\r
             else if (strcmp(view.GetViewId(), DISPLAY_BRIGHTNESS_VIEW) == 0)\r
             {\r
-                NativeAbility::GetInstance().Back();\r
-                return true;\r
+                NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
+                \r
             }\r
+            DisplayBrightnessPresenter::X_DRAG_FLAG = false;\r
         }\r
         return true;\r
     }\r
index d205e17..caaa16f 100644 (file)
@@ -553,6 +553,7 @@ namespace OHOS
         DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessLabel);\r
         DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessCheckBoxButton);\r
         RootView::GetInstance()->Add(DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]);\r
+        container_ = DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW];\r
         Draw();\r
     }\r
 \r
index 37d9ba9..ca7b7bf 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-10 11:58:32
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-10 16:26:47
+ * @LastEditTime: 2024-06-07 18:54:26
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.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};
     };
 }
 
index e6c78af..2fdaf4b 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-10 11:58:15
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 15:42:00
+ * @LastEditTime: 2024-06-07 18:46:54
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h
  */
 #ifndef DNOTDISTURB_VIEW_H
@@ -40,7 +40,7 @@ namespace OHOS
         void DnotDisturbViewInit(void);
         void ClearAll(void);
         UIScrollView *scrollView = nullptr;
-        UILabelExt *showTimeLabel{nullptr}; // 显示系统时间的标签
+        UILabelExt *showTitleLabel{nullptr}; 
         UIImageView *background{nullptr};
         UIImageView *DnotDisturbImage{nullptr};
         UILabel *AttentionLabel{nullptr};
index c91d337..1e8240b 100644 (file)
@@ -2,11 +2,12 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-10 11:58:37
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-25 16:39:57
+ * @LastEditTime: 2024-06-07 18:54:14
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp
  */
 #include "AppViewIDs.h"
 #include "NativeAbility.h"
+#include "UiConfig.h"
 #include "dnotdisturb/include/DnotDisturbView.h"
 #include "dnotdisturb/include/DnotDisturbPresenter.h"
 #include "dnotdisturb/include/DnotDisturbModel.h"
@@ -55,15 +56,24 @@ namespace OHOS
 
     bool DnotDisturbPresenter::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())))) // 拖动过程中判断是否是水平滑动
+        {
+            DnotDisturbPresenter::X_DRAG_FLAG = true;
+        }
         return true;
     }
 
     bool DnotDisturbPresenter::OnDragEnd(UIView &view, const DragEvent &event)
     {
-        UNUSED(view);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDragEnd");
         UNUSED(event);
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && DnotDisturbPresenter::X_DRAG_FLAG)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+            DnotDisturbPresenter::X_DRAG_FLAG = false;
+        }
         return true;
     }
 
@@ -76,15 +86,16 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::GetInstance fail!!");
             return false;
         }
-        if (&view == p_DnotDisturbView->GetButtonOn())//开启勿扰模式
+        if (&view == p_DnotDisturbView->GetButtonOn()) // 开启勿扰模式
         {
             DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(true);
-            NativeAbility::GetInstance().Back();
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
         }
         else if (&view == p_DnotDisturbView->GetButtonOff())
         {
-           NativeAbility::GetInstance().Back();
+            // NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
         }
+        NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
         return true;
     }
 
@@ -97,13 +108,13 @@ namespace OHOS
         // 如果是power键就返回上一级
         if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
         {
-           NativeAbility::GetInstance().Back();
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
         }
         return true;
     }
 
     void DnotDisturbPresenter::Notify()
     {
-        DnotDisturbView::GetInstance()->UpdataTime();
+        // DnotDisturbView::GetInstance()->UpdataTime();
     }
 }
\ No newline at end of file
index b6a9bae..0599c15 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-10 11:58:21
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 15:43:25
+ * @LastEditTime: 2024-06-07 18:51:22
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp
  */
 #include "dnotdisturb/include/DnotDisturbView.h"
@@ -42,10 +42,10 @@ namespace OHOS
         {
             scrollView->RemoveAll();
 
-            if (showTimeLabel != nullptr)
+            if (showTitleLabel != nullptr)
             {
-                delete showTimeLabel;
-                showTimeLabel = nullptr;
+                delete showTitleLabel;
+                showTitleLabel = nullptr;
             }
 
             if (background != nullptr)
@@ -93,20 +93,29 @@ namespace OHOS
             }
             scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
             scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            scrollView->SetTouchable(true);
+            scrollView->SetDraggable(true);
+            UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(DnotDisturbPresenter::GetInstance());
+            if (dragListener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::dragListener new fail!!");
+                return;
+            }
+            scrollView->SetOnDragListener(dragListener);
             /* -------------------------------------------------------------------------- */
-            showTimeLabel = new UILabelExt();
-            if (showTimeLabel == nullptr)
+            showTitleLabel = new UILabelExt();
+            if (showTitleLabel == nullptr)
             {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::showTimeLabel new fail!!");
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::showTitleLabel new fail!!");
                 return;
             }
-            showTimeLabel->SetPosition(83, 52, 300, 46);
-            showTimeLabel->SetStyle(STYLE_TEXT_FONT, 40);
-            showTimeLabel->SetStyle(STYLE_LINE_HEIGHT, 46);
-            showTimeLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
-            showTimeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-            showTimeLabel->SetRollSpeed(40);
-            showTimeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+            showTitleLabel->SetPosition(83, 52, 300, 35);
+            showTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            showTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            showTitleLabel->SetTextId(STR_DO_NOT_DISTURB);
+            showTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+            showTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            showTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             /* -------------------------------------------------------------------------- */
             background = new UIImageView();
             if (background == nullptr)
@@ -137,7 +146,7 @@ namespace OHOS
             AttentionLabel->SetPosition(33, 228, 400, 70);
             AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30);
             AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
-            //AttentionLabel->SetText("开启勿扰模式,手表将不会发出震动与铃声,是否开启");
+            // AttentionLabel->SetText("开启勿扰模式,手表将不会发出震动与铃声,是否开启");
             SetLabelId(AttentionLabel, STR_DO_NOT_DISTURB_MODE);
             AttentionLabel->SetLineBreakMode(UILabelExt::LINE_BREAK_WRAP);
             AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
@@ -183,6 +192,7 @@ namespace OHOS
     /*更新当前时间*/
     void DnotDisturbView::UpdataTime()
     {
+#if 0
         // 获取当前时间
         struct tm pTM;
         time_t seconds;
@@ -195,7 +205,8 @@ namespace OHOS
 
         // 将时间和日期转换为字符串
         std::string stringtime = (hour < 10 ? "0" : "") + std::to_string(hour) + ":" + (minute < 10 ? "0" : "") + std::to_string(minute);
-        showTimeLabel->SetText(stringtime.c_str());
+        showTitleLabel->SetText(stringtime.c_str());
+#endif
     }
 
     UILabelButtonExt *DnotDisturbView::GetButtonOn(void)
@@ -221,13 +232,14 @@ namespace OHOS
     void DnotDisturbView::OnSetUpView()
     {
         View<DnotDisturbPresenter>::OnSetUpView();
-        scrollView->Add(showTimeLabel);
+        scrollView->Add(showTitleLabel);
         scrollView->Add(background);
         scrollView->Add(DnotDisturbImage);
         scrollView->Add(AttentionLabel);
         scrollView->Add(ButtonOn);
         scrollView->Add(ButtonOff);
         RootView::GetInstance()->Add(scrollView);
+        container_ = scrollView;
         Draw();
     }
 
index 6fce8bb..2fa4cfa 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-27 10:47:24
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 16:22:33
+ * @LastEditTime: 2024-06-07 18:18:38
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h
  */
 
@@ -20,7 +20,8 @@ namespace OHOS
     class FindPhoneView;
     class FindPhonePresenter : public Presenter<FindPhoneView>,
                                public UIView::OnClickListener,
-                               public RootView::OnKeyActListener
+                               public RootView::OnKeyActListener,
+                               public UIView::OnDragListener
     {
     public:
         FindPhonePresenter();
@@ -35,7 +36,10 @@ namespace OHOS
 
     private:
         bool OnClick(UIView &view, const ClickEvent &event) override;
+        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};
     };
 }
 #endif
index 312ffae..0e1b57b 100644 (file)
@@ -2,10 +2,11 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-27 10:47:40
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 16:29:37
+ * @LastEditTime: 2024-06-07 18:21:37
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp
  */
 #include "AppViewIDs.h"
+#include "UiConfig.h"
 #include "components/ui_label_ext.h"
 #include "language/font/ui_resource_string.h"
 #include "NativeAbility.h"
@@ -57,6 +58,7 @@ namespace OHOS
 
     bool FindPhonePresenter::OnClick(UIView &view, const ClickEvent &event)
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnClick");
         UNUSED(event);
         if (strcmp(view.GetViewId(), FINDPHONE_LABELBUTTON) == 0)
         {
@@ -65,7 +67,30 @@ namespace OHOS
             {
                 senfindphoneSend(FINDPHONE_STOP);
             }
-            NativeAbility::GetInstance().Back();
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+        }
+        return true;
+    }
+
+    bool FindPhonePresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDrag");
+        UNUSED(view);
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+        {
+            FindPhonePresenter::X_DRAG_FLAG = true;
+        }
+        return true;
+    }
+    
+    bool FindPhonePresenter::OnDragEnd(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDragEnd");
+        UNUSED(event);
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && FindPhonePresenter::X_DRAG_FLAG)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+            FindPhonePresenter::X_DRAG_FLAG = false;
         }
         return true;
     }
@@ -84,7 +109,7 @@ namespace OHOS
             {
                 senfindphoneSend(FINDPHONE_STOP);
             }
-            NativeAbility::GetInstance().Back();
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
         }
         return true;
     }
index 03779a7..a263088 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-27 10:47:46
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-10 16:36:28
+ * @LastEditTime: 2024-06-07 18:33:39
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
  */
 #include "findphone/include/FindPhoneView.h"
@@ -303,6 +303,12 @@ namespace OHOS
         {
             FindPhoneViewInit_BlueToothDisConnected();
         }
+
+        FindPhoneGroupView->SetTouchable(true);
+        FindPhoneGroupView->SetDraggable(true);
+        UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(FindPhonePresenter::GetInstance());
+        FindPhoneGroupView->SetOnDragListener(dragListener);
+
         // 增加按键监听
         RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::FindPhonePresenter::GetInstance();
         RootView::GetInstance()->SetOnKeyActListener(keyactListener);
@@ -312,6 +318,7 @@ namespace OHOS
     {
         View<FindPhonePresenter>::OnSetUpView();
         RootView::GetInstance()->Add(FindPhoneGroupView);
+        container_ = FindPhoneGroupView;
         Draw();
     }
 
index 440250d..2d5b46e 100644 (file)
@@ -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};
     };
 }
 
index a6cb957..d96dc1a 100644 (file)
@@ -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())
         {
index 11eccc4..60bc2b7 100644 (file)
@@ -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();
     }
 
index 2ef2793..500f1a0 100644 (file)
@@ -1,8 +1,9 @@
 /*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopModel.h
- * Author:
- * Create: 2021-11-23
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-07 09:21:47
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-07 15:03:40
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h
  */
 
 #ifndef SET_DESKTOP_MODEL_H
@@ -15,8 +16,8 @@
 #include "SetDesktopPresenter.h"
 
 typedef enum {
-    APPLIST_STYLE,
-    HEXAGONS_STYLE,
+    APPLIST_STYLE,  //列表显示
+    HEXAGONS_STYLE, //蜂窝显示
 } DesktopStyle;
 
 namespace OHOS {
index 43c523e..c84a750 100644 (file)
@@ -1,8 +1,9 @@
 /*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SettingModel.cpp
- * Author:
- * Create: 2021-11-23
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-07 09:21:47
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-07 11:17:14
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp
  */
 
 #include "SetDesktopModel.h"
@@ -21,6 +22,7 @@ namespace OHOS {
         return instance;
     }
 
+    //获取applist的显示样式
     DesktopStyle SetDesktopModel::GetDesktopStyle(void)
     {
         DesktopStyle style;
index 253b6a2..f866b60 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-04-04 15:13:51\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-04-07 17:22:21\r
+ * @LastEditTime: 2024-06-07 17:07:38\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h\r
  */\r
 #ifndef MAIN_STOPWATCH_PRESENTER_H\r
@@ -50,6 +50,7 @@ namespace OHOS
         // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
         bool OnClick(UIView &view, const ClickEvent &event) override;\r
         bool OnDrag(UIView &view, const DragEvent &event) override;\r
+        bool OnDragEnd(UIView &view, const DragEvent &event) override;\r
         bool OnChange(UICheckBox::UICheckBoxState state) override;\r
         bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件\r
     private:\r
@@ -63,6 +64,7 @@ namespace OHOS
         List<const char *> *m_listdata = nullptr;\r
         uint64_t lastRecordTime = 0; // 上次记录时间\r
         int RecordCycleNumber{0};    // 用来记录计时圈数\r
+        bool X_DRAG_FLAG{false};\r
     };\r
 } // namespace OHOS\r
 \r
index 8b4c1c6..1c58e32 100644 (file)
@@ -1,5 +1,6 @@
 #include "AppViewIDs.h"\r
 #include "NativeAbility.h"\r
+#include "UiConfig.h"\r
 #include "stopwatch/include/MainStopWatchPresenter.h"\r
 #include "stopwatch/include/StopWatchModel.h"\r
 #include "common/key_code.h"\r
@@ -100,11 +101,23 @@ namespace OHOS
 \r
     bool MainStopWatchPresenter::OnDrag(UIView &view, const DragEvent &event)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainStopWatchPresenter::OnDrag");\r
         UNUSED(view);\r
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
-            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动\r
         {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+            MainStopWatchPresenter::X_DRAG_FLAG = true;\r
+        }\r
+        return true;\r
+    }\r
+\r
+    bool MainStopWatchPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
+    {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainStopWatchPresenter::OnDragEnd");\r
+        UNUSED(view);\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainStopWatchPresenter::X_DRAG_FLAG)\r
+        {\r
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
+            X_DRAG_FLAG = false;\r
         }\r
         return true;\r
     }\r
@@ -274,10 +287,9 @@ namespace OHOS
         // 如果是power键就返回上一级\r
         if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)\r
         {\r
-            uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
-            NativeAbility::GetInstance().ChangeSlice(preSlice);\r
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);\r
         }\r
-        return true;\r
+        return false;\r
     }\r
 \r
 }
\ No newline at end of file
index b2d8ba4..165ae02 100644 (file)
@@ -390,6 +390,7 @@ namespace OHOS
         scrollView[MAIN_STOPWATCH]->Add(ResetOrMarkbutton);\r
         group->Add(scrollView[MAIN_STOPWATCH]);\r
         RootView::GetInstance()->Add(group);\r
+        container_ = group;\r
         Draw();\r
     }\r
 \r