解决恢复出厂设置未选语言长按进入滑动关机重启界面无字体问题,现在未选语言默认关机和重启字体为英文。
authorluozheng <1732036298@qq.com>
Wed, 31 Jul 2024 02:27:01 +0000 (10:27 +0800)
committerluozheng <1732036298@qq.com>
Wed, 31 Jul 2024 02:27:01 +0000 (10:27 +0800)
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp

index 548ea4e..75e4468 100644 (file)
@@ -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;
         };
 
index 530fe9e..00cdb90 100644 (file)
@@ -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;