From 1b8eb36402d1f494be15ebc8a287688216cf6571 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Wed, 31 Jul 2024 10:27:01 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E6=81=A2=E5=A4=8D=E5=87=BA?= =?utf8?q?=E5=8E=82=E8=AE=BE=E7=BD=AE=E6=9C=AA=E9=80=89=E8=AF=AD=E8=A8=80?= =?utf8?q?=E9=95=BF=E6=8C=89=E8=BF=9B=E5=85=A5=E6=BB=91=E5=8A=A8=E5=85=B3?= =?utf8?q?=E6=9C=BA=E9=87=8D=E5=90=AF=E7=95=8C=E9=9D=A2=E6=97=A0=E5=AD=97?= =?utf8?q?=E4=BD=93=E9=97=AE=E9=A2=98=EF=BC=8C=E7=8E=B0=E5=9C=A8=E6=9C=AA?= =?utf8?q?=E9=80=89=E8=AF=AD=E8=A8=80=E9=BB=98=E8=AE=A4=E5=85=B3=E6=9C=BA?= =?utf8?q?=E5=92=8C=E9=87=8D=E5=90=AF=E5=AD=97=E4=BD=93=E4=B8=BA=E8=8B=B1?= =?utf8?q?=E6=96=87=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/RebootAndShutdownView.h | 3 ++- .../src/RebootAndShutdownView.cpp | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h index 548ea4e79..75e446851 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:25:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-20 14:56:42 + * @LastEditTime: 2024-07-31 09:48:48 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h */ #ifndef REBOOT_AND_SHUTDOWN_VIEW_H @@ -61,6 +61,7 @@ namespace OHOS int16_t fontSize; int16_t lineHeigh; uint16_t textId; + const char *text; uint8_t lineBreakMode; }; 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 530fe9ea2..00cdb9064 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp @@ -2,12 +2,13 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:26:08 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-27 12:55:14 + * @LastEditTime: 2024-07-31 10:08:26 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp */ #include "rebootandshutdown/include/RebootAndShutdownPresenter.h" #include "rebootandshutdown/include/RebootAndShutdownView.h" +#include "ConfigModel.h" #include "wearable_log.h" #include "ui_resource_string.h" #include "UiConfig.h" @@ -136,7 +137,14 @@ namespace OHOS label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize); label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh); - label->SetTextId(labelconfig.textId); + if (true == ConfigModel::GetInstance()->GetisFirstTimeStart() && ConfigModel::GetInstance()->GetLanguage() == -1) + { + label->SetText(labelconfig.text); + } + else + { + label->SetTextId(labelconfig.textId); + } label->SetLineBreakMode(labelconfig.lineBreakMode); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label->SetRollSpeed(70); @@ -172,6 +180,7 @@ namespace OHOS .fontSize = 30, .lineHeigh = 35, .textId = STR_SLIDE_TO_SHUTDOWN, /*滑动关机 >>*/ + .text = "Slide to shutdown", .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; shutdownLabel = RebootAndShutdownLabelInit(labelConfig); @@ -180,15 +189,18 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "shutdownLabel new fail!"); return false; } + shutdownLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); shutdownLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); /* -------------------------------------------------------------------------- */ labelConfig.textId = STR_SLIDE_TO_REBOOT; /*滑动重启 >>*/ + labelConfig.text = "Slide to reboot"; rebootLabel = RebootAndShutdownLabelInit(labelConfig); if (rebootLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootLabel new fail!"); return false; } + rebootLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); rebootLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); /* -------------------------------------------------------------------------- */ labelConfig = { @@ -208,9 +220,8 @@ namespace OHOS return false; } factoryResetLabel->SetViewId(FACTORYRESET_LABEL_VIEWID); - factoryResetLabel->SetTouchable(true); + factoryResetLabel->SetTouchable((ConfigModel::GetInstance()->GetisFirstTimeStart() && ConfigModel::GetInstance()->GetLanguage() == -1) ? false : true); factoryResetLabel->SetTextColor(Color::GetColorFromRGBA(0x35, 0x49, 0xff, 0xff)); - factoryResetLabel->SetStyle(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP); factoryResetLabel->SetOnClickListener(presenter_); return true; -- 2.17.1