From: 罗正 <1732036298@qq.com> Date: Fri, 7 Jun 2024 13:29:22 +0000 (+0000) Subject: Merge #239 into sdk602patch0521 from refs/changes/239/head X-Git-Tag: release_V1.2.70_20241020_135402~1024^2^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=36547645d6687a7e765810d5af13cd2fc37a80af;p=mirrors%2FFD230.git Merge #239 into sdk602patch0521 from refs/changes/239/head Code review from 罗正 * refs/changes/239/head: (6 commits squashed) - 秒表视图添加退出动画 - 手电筒视图优化 - 勿扰模式和查找手机视图优化 - Merge branch 'sdk602patch0521' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521 - 优化指南针,倒计时,显示与亮度的退出逻辑 - Merge branch 'sdk602patch0521' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/239 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp index 0de9bc177..95175ac50 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp @@ -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); diff --git a/code/sdk/application/wearable/fd230app/nativeui/compass/include/MainCompassPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/compass/include/MainCompassPresenter.h index 8bc3c1d40..4123c1d5d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/compass/include/MainCompassPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/compass/include/MainCompassPresenter.h @@ -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 diff --git a/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp index bf87159f4..516365c85 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp @@ -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(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) { - NativeAbility::GetInstance().Back(); + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h index dea71c490..d946e7b39 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-07 18:15:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-09 15:40:05 + * @LastEditTime: 2024-06-07 19:57:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h */ #ifndef MAIN_COUNTDOWN_PRESENTER_H @@ -55,6 +55,7 @@ namespace OHOS std::string countdowntime{0}; std::string ringtime{0}; + bool X_DRAG_FLAG{false}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp index fcacd8701..40ea1b5b7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp @@ -1,5 +1,6 @@ #include "AppViewIDs.h" #include "NativeAbility.h" +#include "UiConfig.h" #include "countdown/include/MainCountDownPresenter.h" #include "countdown/include/CountDownModel.h" #include "common/key_code.h" @@ -57,25 +58,33 @@ namespace OHOS { Presenter::OnStop(); ScreenAlwaysOnCtr(0); // 取消长亮屏 - } bool MainCountDownPresenter::OnDrag(UIView &view, const DragEvent &event) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCountDownPresenter::OnDrag"); UNUSED(view); - UNUSED(event); + if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动 + { + MainCountDownPresenter::X_DRAG_FLAG = true; + } return true; } bool MainCountDownPresenter::OnDragEnd(UIView &view, const DragEvent &event) { - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && strcmp(view.GetViewId(), MAINCOUNTDOWNVIEW) == 0) - { - NativeAbility::GetInstance().Back(); - } - else if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && strcmp(view.GetViewId(), COUNTDOWN_TIMECONFIG_VIEW) == 0) + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCountDownPresenter::OnDragEnd"); + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainCountDownPresenter::X_DRAG_FLAG) { - MainCountDownView::GetInstance()->ChangeView(TIMECONFIG_COUNTDOWN, MAIN_COUNTDOWN); + if (strcmp(view.GetViewId(), MAINCOUNTDOWNVIEW) == 0) + { + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + } + else if (strcmp(view.GetViewId(), COUNTDOWN_TIMECONFIG_VIEW) == 0) + { + MainCountDownView::GetInstance()->ChangeView(TIMECONFIG_COUNTDOWN, MAIN_COUNTDOWN); + } + MainCountDownPresenter::X_DRAG_FLAG = false; } return true; } @@ -183,7 +192,7 @@ namespace OHOS // 如果是power键就返回上一级 if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) { - NativeAbility::GetInstance().Back(); + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp index a70dd21e3..2680cbae7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp @@ -383,6 +383,7 @@ namespace OHOS scrollView[MAIN_COUNTDOWN]->Add(COUNTDOWN_THIRTY_MINUTE_BUTTON); group->Add(scrollView[MAIN_COUNTDOWN]); RootView::GetInstance()->Add(group); + container_ = group; Draw(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h index 445a202be..1e070aebb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-18 09:10:05 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-18 15:53:53 + * @LastEditTime: 2024-06-07 19:25:27 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h */ #ifndef _DISPLAY_BRIGHTNESS_PRESENTER_H @@ -100,6 +100,7 @@ namespace OHOS bool OnDragEnd(UIView &view, const DragEvent &event) override; bool OnChange(UICheckBox::UICheckBoxState state) override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 + bool X_DRAG_FLAG{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp index c796fd717..21400b2e6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp @@ -2,10 +2,11 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-07 10:38:25 + * @LastEditTime: 2024-06-07 19:55:47 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp */ #include "AppViewIDs.h" +#include "UiConfig.h" #include "components/ui_label_ext.h" #include "language/font/ui_resource_string.h" #include "NativeAbility.h" @@ -152,32 +153,38 @@ namespace OHOS bool DisplayBrightnessPresenter::OnClick(UIView &view, const ClickEvent &event) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnClick"); DisplayBrightnessView *p_DisplayBrightnessView = DisplayBrightnessView::GetInstance(); - // 根据控件id查找是哪个控件触发了点击回调 + if (p_DisplayBrightnessView == nullptr) + { + return false; + } if (strcmp(view.GetViewId(), BRINGHTNESSCONTROLBUTTON_VIEW) == 0) { NativeAbility::GetInstance().EnterSlice(VIEW_BRIGHTNESSLEVEL); - return true; } - if (strcmp(view.GetViewId(), SCREENDURATIONBUTTON_VIEWID) == 0) + else if (strcmp(view.GetViewId(), SCREENDURATIONBUTTON_VIEWID) == 0) { p_DisplayBrightnessView->ChangeView(DISPLAYBRIGHTNESSVIEW, SCREENDURATIONVIEW); // 切换到亮屏时长视图 - return true; } - return false; + return true; } bool DisplayBrightnessPresenter::OnDrag(UIView &view, const DragEvent &event) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnDrag"); UNUSED(view); - UNUSED(event); + if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动 + { + DisplayBrightnessPresenter::X_DRAG_FLAG = true; + } return true; } bool DisplayBrightnessPresenter::OnDragEnd(UIView &view, const DragEvent &event) { DisplayBrightnessView *p_DisplayBrightnessView = DisplayBrightnessView::GetInstance(); - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && DisplayBrightnessPresenter::X_DRAG_FLAG) { if (strcmp(view.GetViewId(), SCREENDURATIONSCROLLVIEW) == 0) { @@ -185,9 +192,10 @@ namespace OHOS } else if (strcmp(view.GetViewId(), DISPLAY_BRIGHTNESS_VIEW) == 0) { - NativeAbility::GetInstance().Back(); - return true; + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + } + DisplayBrightnessPresenter::X_DRAG_FLAG = false; } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp index d205e179e..caaa16fc2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp @@ -553,6 +553,7 @@ namespace OHOS DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessLabel); DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessCheckBoxButton); RootView::GetInstance()->Add(DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]); + container_ = DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]; Draw(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.h index 37d9ba928..ca7b7bf7a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.h @@ -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}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h index e6c78afb3..2fdaf4be4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h @@ -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}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp index c91d3375f..1e8240bb6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp @@ -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(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 diff --git a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp index b6a9baeb7..0599c1525 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp @@ -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(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::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(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h index 6fce8bb5e..2fa4cfabe 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhonePresenter.h @@ -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, 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 diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp index 312ffae97..0e1b57bf3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp @@ -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; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp index 03779a7b5..a26308895 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp @@ -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(FindPhonePresenter::GetInstance()); + FindPhoneGroupView->SetOnDragListener(dragListener); + // 增加按键监听 RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::FindPhonePresenter::GetInstance(); RootView::GetInstance()->SetOnKeyActListener(keyactListener); @@ -312,6 +318,7 @@ namespace OHOS { View::OnSetUpView(); RootView::GetInstance()->Add(FindPhoneGroupView); + container_ = FindPhoneGroupView; Draw(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h index 440250ddd..2d5b46e30 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/include/FlashlightPresenter.h @@ -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}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp index a6cb95766..d96dc1a7f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp @@ -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()) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp index 11eccc4e7..60bc2b7ea 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp @@ -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(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h index 2ef2793dc..500f1a030 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h @@ -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 { diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp index 43c523e4f..c84a75079 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp @@ -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; diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h index 253b6a2c7..f866b60ae 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-04 15:13:51 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-07 17:22:21 + * @LastEditTime: 2024-06-07 17:07:38 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h */ #ifndef MAIN_STOPWATCH_PRESENTER_H @@ -50,6 +50,7 @@ namespace OHOS // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; 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 OnChange(UICheckBox::UICheckBoxState state) override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 private: @@ -63,6 +64,7 @@ namespace OHOS List *m_listdata = nullptr; uint64_t lastRecordTime = 0; // 上次记录时间 int RecordCycleNumber{0}; // 用来记录计时圈数 + bool X_DRAG_FLAG{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp index 8b4c1c6e3..1c58e32b9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp @@ -1,5 +1,6 @@ #include "AppViewIDs.h" #include "NativeAbility.h" +#include "UiConfig.h" #include "stopwatch/include/MainStopWatchPresenter.h" #include "stopwatch/include/StopWatchModel.h" #include "common/key_code.h" @@ -100,11 +101,23 @@ namespace OHOS bool MainStopWatchPresenter::OnDrag(UIView &view, const DragEvent &event) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainStopWatchPresenter::OnDrag"); UNUSED(view); - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && - (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) + if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动 { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + MainStopWatchPresenter::X_DRAG_FLAG = true; + } + return true; + } + + bool MainStopWatchPresenter::OnDragEnd(UIView &view, const DragEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainStopWatchPresenter::OnDragEnd"); + UNUSED(view); + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MainStopWatchPresenter::X_DRAG_FLAG) + { + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + X_DRAG_FLAG = false; } return true; } @@ -274,10 +287,9 @@ namespace OHOS // 如果是power键就返回上一级 if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) { - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } - return true; + return false; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp index b2d8ba4b6..165ae0266 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp @@ -390,6 +390,7 @@ namespace OHOS scrollView[MAIN_STOPWATCH]->Add(ResetOrMarkbutton); group->Add(scrollView[MAIN_STOPWATCH]); RootView::GetInstance()->Add(group); + container_ = group; Draw(); }