From 439c4beb9a0801c747ccc9b8d7be24df7d9893b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Sat, 27 Jul 2024 05:24:14 +0000 Subject: [PATCH] Merge #607 into sdk602patch0626 from refs/changes/607/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/607/head: (2 commits squashed) - 优化滑动关机和重启视图,视觉上拦截slider点击事件 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 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/607 --- .../src/RebootAndShutdownPresenter.cpp | 18 +++++++++++++++++- .../src/RebootAndShutdownView.cpp | 6 ++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp index a1f107518..02cbd14f9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:11:17 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-20 14:56:16 + * @LastEditTime: 2024-07-27 13:03:52 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/RebootAndShutdownPresenter.cpp */ #include "AppViewIDs.h" @@ -88,6 +88,22 @@ namespace OHOS { RebootAndShutdownView::GetInstance()->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN); } + else if (strcmp(view.GetViewId(), SHUTDOWN_SLIDER_VIEWID) == 0) + { + auto shutdownSlider = view_->GetShutdownSlider(); + if (shutdownSlider != nullptr) + { + shutdownSlider->SetValue(SLIDER_VALUE_MIN); + } + } + else if (strcmp(view.GetViewId(), REBOOT_SLIDER_VIEWID) == 0) + { + auto rebootSlider = view_->GetRebootSlider(); + if (rebootSlider != nullptr) + { + rebootSlider->SetValue(SLIDER_VALUE_MIN); + } + } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp index f7cea52ec..530fe9ea2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:26:08 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-24 17:35:57 + * @LastEditTime: 2024-07-27 12:55:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp */ @@ -227,7 +227,7 @@ namespace OHOS return false; } shutdownSlider->SetPosition(10, 10, 360, 80); - shutdownSlider->SetViewId(REBOOT_SLIDER_VIEWID); + shutdownSlider->SetViewId(SHUTDOWN_SLIDER_VIEWID); shutdownSlider->SetStyle(STYLE_BORDER_RADIUS, 100); shutdownSlider->SetRange(100, 0); shutdownSlider->SetValidWidth(360); @@ -267,9 +267,11 @@ namespace OHOS rebootSlider->SetValue(12); rebootSlider->SetCapType(CapType::CAP_ROUND); } + shutdownSlider->SetOnClickListener(presenter_); shutdownSlider->SetOnDragListener(presenter_); shutdownSlider->SetSliderEventListener(presenter_); + rebootSlider->SetOnClickListener(presenter_); rebootSlider->SetOnDragListener(presenter_); rebootSlider->SetSliderEventListener(presenter_); -- 2.17.1