From: luozheng <1732036298@qq.com> Date: Sat, 27 Jul 2024 05:08:36 +0000 (+0800) Subject: 优化滑动关机和重启视图,视觉上拦截slider点击事件 X-Git-Tag: release_V1.2.70_20241020_135402~739 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=1c17ddb784b15fa4b63a04dfef5d8748345adf8c;p=mirrors%2FFD230.git 优化滑动关机和重启视图,视觉上拦截slider点击事件 --- 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_);