From 0131421c2b0f094db3f0dd3977456df1f21b470f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Thu, 31 Oct 2024 02:03:50 +0000 Subject: [PATCH] Merge #1299 into sdk602patch0911 from refs/changes/1299/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1299/head: (3 commits squashed) - 添加关机状态的runtime - #1087,解决连接状态界面,点击大退,再次下滑,进入的是连接状态界面,不是下拉栏界面bug - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: Caisking <3449750381@qq.com> Reviewed-by: 罗正 <1732036298@qq.com> Reviewed-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Reviewed-by: aliyun6865282430 <1624952103@qq.com> Merged-by: Caisking <3449750381@qq.com> CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1299 --- .../nativeui/key/src/KeyInputListener.cpp | 4 +++ .../nativeui/main/include/MainViewSample.h | 1 + .../nativeui/main/include/PullUpDownView.h | 4 ++- .../nativeui/main/src/MainViewSample.cpp | 7 +++++ .../nativeui/main/src/PullUpDownView.cpp | 18 +++++++++++- .../src/ShutDownImageAnimatorView.cpp | 29 ++++++++++++++----- .../drivers/peripheral/utils/custom_runtime.c | 11 +++++++ .../drivers/peripheral/utils/custom_runtime.h | 4 +++ 8 files changed, 68 insertions(+), 10 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp b/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp index 8a3f4ff75..822eb8c32 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp @@ -160,6 +160,10 @@ namespace OHOS HandleAlarmNotify(); if (!MainViewSample::GetInstance()->IsMainClockPage()) { + if(MainViewSample::GetInstance()->IsPullUpViewPage()) + { + MainViewSample::GetInstance()->HandOnKeyEventSwitchMainPullDownView(); + } MainViewSample::GetInstance()->SwitchToClockPage(); } else diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h index 904ec7d3c..219dbad15 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h @@ -98,6 +98,7 @@ namespace OHOS bool GetDragFg(void); void SetPage(int16_t page); void UpdateStateShow(); + void HandOnKeyEventSwitchMainPullDownView(void); private: PullUpDownView *dropDownView{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h index dd1cc95df..9f330a307 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-17 15:26:49 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-08 11:12:47 + * @LastEditTime: 2024-10-30 18:27:12 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h */ @@ -57,6 +57,7 @@ namespace OHOS bool ClickFunc(int16_t interface); void ChangeView(int16_t hideView, int16_t showView); ConnectedStatusView *GetConnectedStatusView(void); + void HandOnKeyEventSwitchMainPullDownView(void); private: void OnSwipe(UISwipeView &view) override; @@ -65,6 +66,7 @@ namespace OHOS UIViewGroup *group[MAX_DROPDOWNVIEWID]{nullptr}; ConnectedStatusView *connectedStatusView{nullptr}; bool viewiInitStatus{false}; + uint8_t curView{0}; /* ---------------------------------- 1.连接状态 ---------------------------------- */ public: diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp index b43e7ed71..cabf75e1e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp @@ -661,4 +661,11 @@ namespace OHOS } } + void MainViewSample::HandOnKeyEventSwitchMainPullDownView(void) + { + if(dropDownView) + { + dropDownView->HandOnKeyEventSwitchMainPullDownView(); + } + } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp index b2eeced91..5a158c803 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-26 18:14:24 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-08 15:14:16 + * @LastEditTime: 2024-10-30 18:32:51 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp */ @@ -1169,6 +1169,7 @@ namespace OHOS group[hideView]->SetVisible(false); ClickFunc(showView); group[showView]->SetVisible(true); + curView = showView; Invalidate(); } @@ -1177,5 +1178,20 @@ namespace OHOS { return connectedStatusView; } + + // 处理按键事件回到下拉主页面 + void PullUpDownView::HandOnKeyEventSwitchMainPullDownView(void) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::HandOnKeyEventSwitchMainPullDownView"); + if (curView == CONNECTEDSTATUSVIEW) /*当前是连接状态视图*/ + { + ChangeView(curView, DROPDOWNVIEW); /*切换到下拉主页面*/ + } + if (nullptr != dropDownswipeViewList && dropDownswipeViewList->GetCurrentPage() != 0) + { + dropDownswipeViewList->SetCurrentPage(0); + } + Invalidate(); + } /* -------------------------------------------------------------------------- */ } diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp index 18ff17990..4eaadf65b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp @@ -13,6 +13,7 @@ #include "bleEvent.h" #include "AppViewIDs.h" #include "NativeAbility.h" +#include namespace OHOS { @@ -66,9 +67,9 @@ namespace OHOS do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0); break; case 3: - #ifdef SUPPORT_BLE_SERVICE +#ifdef SUPPORT_BLE_SERVICE cleanUnbindInfor(1); - #endif +#endif default: break; } @@ -82,14 +83,17 @@ namespace OHOS // 0 关机 1 重启 2 恢复出厂 3解绑恢复出厂 void ShutDownImageAnimatorView::ShutDownImageAnimator_Start(int type) { - OperationType = type; - shutDownImageAnimatorView->Start(); - isShutDownImageAnimatorStart = true; - ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 关机动画已经开始了不能息屏 + OperationType = type; // 保存操作类型:0 关机 1 重启 2 恢复出厂 3解绑恢复出厂 - uapi_take_to_wake(0);//关闭抬腕亮屏,和息屏 + shutDownImageAnimatorView->Start(); // 开始播放关机动画 + + uapi_dev_runtime_set_shutting_down_status(1);//设置关机状态runtime值 + + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 关机动画已经开始了不能息屏 + + uapi_take_to_wake(0); // 关闭抬腕亮屏,和息屏 - NativeAbility::GetInstance().SetCurSlicePriority(0); //设置Slice优先级为最高,防止弹窗出现 + NativeAbility::GetInstance().SetCurSlicePriority(0); // 设置Slice优先级为最高,防止弹窗出现 // 关机增加震动 ui_api_vibrate_once_func(); @@ -98,6 +102,15 @@ namespace OHOS // 获取开机动画是否已经开始 bool ShutDownImageAnimatorView::GetShutDownImageAnimatorIsStart(void) { + if (uapi_dev_runtime_get_shutting_down_status() == 1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "正在进行关机动画"); + isShutDownImageAnimatorStart = true; + } + else + { + isShutDownImageAnimatorStart = false; + } return isShutDownImageAnimatorStart; } diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.c b/code/sdk/drivers/peripheral/utils/custom_runtime.c index d2315e4b4..970d29fb2 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.c +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.c @@ -101,6 +101,7 @@ typedef struct uint8_t factory_test_status;//产测模式状态 uint8_t screen_always_on_status;//屏幕是否常亮状态 uint8_t wear_status; + uint8_t shutting_down_status;//是否处于关机状态 } runtime_status_t; @@ -431,6 +432,16 @@ uint8_t uapi_dev_runtime_get_respiratory_training_status(void) return g_runtime.respiratory_training_status; } +//设置关机状态 +void uapi_dev_runtime_set_shutting_down_status(uint8_t status) +{ + g_runtime.shutting_down_status = status; +} +uint8_t uapi_dev_runtime_get_shutting_down_status(void) +{ + return g_runtime.shutting_down_status; +} + //设置是否常亮状态 void uapi_dev_runtime_set_screen_always_on_status(uint8_t status) { diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h index 00ae3b7c5..26bd585f5 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.h @@ -178,6 +178,10 @@ uint8_t uapi_dev_runtime_get_respiratory_training_status(void); //设置屏幕是否常亮 void uapi_dev_runtime_set_screen_always_on_status(uint8_t status); uint8_t uapi_dev_runtime_get_screen_always_on_status(void); + +//关机状态 +void uapi_dev_runtime_set_shutting_down_status(uint8_t status); +uint8_t uapi_dev_runtime_get_shutting_down_status(void); /***************************************cat1 runtime 变量设置获取函数**************************************************/ -- 2.17.1