From 85a545d29718d30b2bd922847e697642e57d1512 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 26 Jul 2024 17:52:07 +0800 Subject: [PATCH] =?utf8?q?=E7=B3=BB=E7=BB=9F=E8=A7=86=E5=9B=BE=E4=BC=98?= =?utf8?q?=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../system/src/SystemFactoryResetView.cpp | 10 ++++++++ .../nativeui/system/src/SystemView.cpp | 25 +++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp index e0002e5a7..47e63d3a3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp @@ -132,6 +132,11 @@ namespace OHOS FactoryResetButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); FactoryResetButtonCheckOff->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE); UIView::OnClickListener *FactoryResetButtonCheckOffClick = static_cast(SystemPresenter::GetInstance()); + if(FactoryResetButtonCheckOffClick == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemFactoryResetView::FactoryResetButtonCheckOffClick is nullptr!"); + return nullptr; + } FactoryResetButtonCheckOff->SetOnClickListener(FactoryResetButtonCheckOffClick); /* ------------------------ FactoryResetButtonCheckOn ----------------------- */ FactoryResetButtonCheckOn = new UIButton(); @@ -149,6 +154,11 @@ namespace OHOS FactoryResetButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); FactoryResetButtonCheckOn->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE); UIView::OnClickListener *FactoryResetButtonCheckOnClick = static_cast(SystemPresenter::GetInstance()); + if(FactoryResetButtonCheckOnClick == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemFactoryResetView::FactoryResetButtonCheckOnClick is nullptr!"); + return nullptr; + } FactoryResetButtonCheckOn->SetOnClickListener(FactoryResetButtonCheckOnClick); /* ----------------------------- Add to scroView ---------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp index 095d065e0..f45b0725a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp @@ -145,18 +145,21 @@ namespace OHOS {513, STR_SYSTEM_LANGUAGE}, {633, STR_FACTORY_RESET}, }; + labelConfig = { + .left = 90, + .top = 153, + .width = 240, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .textId = STR_ABOUT_WATCH, + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, + }; for (int i = 0; i < sizeof(labelSetups) / sizeof(labelSetups[0]); ++i) { - labelConfig = { - .left = 90, - .top = labelSetups[i].y, - .width = 240, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, - .textId = labelSetups[i].textId, - .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, - }; + + labelConfig.top = labelSetups[i].y; + labelConfig.textId = labelSetups[i].textId; SystemViewLabel[i] = SystemViewLabelInit(labelConfig); if (SystemViewLabel[i] == nullptr) { @@ -223,7 +226,7 @@ namespace OHOS SystemScrollView[SYSTEMVIEW]->SetThrowDrag(true); // 设置手指抬起屏幕后是否继续滚动。 SystemScrollView[SYSTEMVIEW]->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。 SystemScrollView[SYSTEMVIEW]->RequestFocus(); - SystemScrollView[SYSTEMVIEW]->SetRotateFactor(true); + SystemScrollView[SYSTEMVIEW]->SetRotateFactor(1.0); SystemScrollView[SYSTEMVIEW]->SetOnDragListener(presenter_); SystemScrollView[SYSTEMVIEW]->SetTouchable(true); SystemScrollView[SYSTEMVIEW]->SetDraggable(true); -- 2.17.1