适配血氧Slice多国语言
authorCaisking <3449750381@qq.com>
Tue, 7 May 2024 11:10:39 +0000 (19:10 +0800)
committerCaisking <3449750381@qq.com>
Tue, 7 May 2024 11:10:39 +0000 (19:10 +0800)
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodBandoffView.h
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodCheckView.h
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodResultView.h
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodBandoffView.cpp
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodCheckView.cpp
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp

index d230a1a..7a66ee0 100644 (file)
@@ -27,7 +27,7 @@ namespace OHOS
         UIImageAnimatorView *GetImageAnimator();
 
     private:
-        UILabel *label;
+        UILabelExt *label;
         UILabelButton *testButton;
         UIScrollView *BloodBandoffScrollView;
         UIViewGroup *group;
index 1fc13a8..64a2a1f 100644 (file)
@@ -22,6 +22,7 @@
 #include "bloodoxygen/include/BloodOxygenPresenter.h"
 #include "bloodoxygen/include/BloodBandoffView.h"
 #include "components/ui_scroll_view.h"
+#include "components/ui_label_button_ext.h"
 namespace OHOS
 {
     class BloodOxygenPresenter;
@@ -35,16 +36,16 @@ namespace OHOS
         static BloodCheckView *GetInstance(void);
         UIScrollView *BloodCheckViewInit();
         UIImageAnimatorView *GetImageAnimator();
-        UILabelButton *CreateAndSetUIButton(const char *title);
+        UILabelButtonExt *CreateAndSetUIButton(const char *title);
         void UpShowBloodText();
 
     private:
         BloodBandoffView *bloodbandoff{nullptr};
         UIImageAnimatorView *imageAnimator;
-        UILabel *titleLabel;
-        UILabel *Spo2Text;
+        UILabelExt *titleLabel;
+        UILabelExt *Spo2Text;
         UIScrollView *BloodCheckScrollView;
-        UILabelButton *testButton;
+        UILabelButtonExt *testButton;
     };
 }
 
index 26a81d8..5863414 100644 (file)
@@ -1,7 +1,7 @@
 /*** 
  * @Date: 2024-04-15 10:55:58
  * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-04-18 12:11:45
+ * @LastEditTime: 2024-05-07 18:51:13
  * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodResultView.h
  */
 /*
@@ -28,6 +28,7 @@
 #include "BloodOxygenPresenter.h"
 #include "BloodBandoffView.h"
 #include "components/ui_scroll_view.h"
+#include "components/ui_label_button_ext.h"
 namespace OHOS
 {
     class BloodOxygenPresenter;
@@ -47,14 +48,14 @@ namespace OHOS
         bool InitLabel(void);
         BloodResultView *bloodresult{nullptr};
         UIImageView *imageerror; // 图片
-        UILabel *titlelabel;
-        UILabel *label1;
-        UILabel *label2;
-        UILabel *label3;
+        UILabelExt *titlelabel;
+        UILabelExt *label1;
+        UILabelExt *label2;
+        UILabelExt *label3;
 
         UIScrollView *BloodResultScrollView;
-        UILabelButton *ReButton;
-        UILabelButton *StButton;
+        UILabelButtonExt *ReButton;
+        UILabelButtonExt *StButton;
     };
 }
 
index 2905c90..c41ab9e 100644 (file)
@@ -9,6 +9,7 @@
 #include "wearable_log.h"
 #include "BloodBandoffView.h"
 #include "BloodOxygenModel.h"
+#include "language/font/ui_resource_string.h"
 
 namespace OHOS
 {
@@ -116,14 +117,15 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodBandoffView::CreateUIViewGroup");
 
         // 佩戴title
-        label = new UILabel();
+        label = new UILabelExt();
         if (label == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodBandoffView::new Label fail");
             // return nullptr;
         }
         label->SetPosition(LABEL_POSITION_X, LABEL_POSITION_Y, LABEL_POSITION_WIDTH, LABEL_POSITION_HEIGHT);
-        label->SetText("偏紧佩戴,保持静止");
+        // label->SetText("偏紧佩戴,保持静止");
+        label->SetTextId(STR_CHECKNOTE);
         label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
         label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         BloodBandoffScrollView->Add(label);
index 8fc7537..6588368 100644 (file)
@@ -4,6 +4,7 @@
 #include "BloodOxygenModel.h"
 #include "ui_image_animator.h"
 #include "BloodCheckView.h"
+#include "language/font/ui_resource_string.h"
 namespace OHOS
 {
     // 动态刷新设置
@@ -92,7 +93,7 @@ namespace OHOS
         BloodCheckScrollView->SetPosition(0, 0);
         BloodCheckScrollView->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
         /* -------------------------------------------------------------------------- */
-        titleLabel = new UILabel();
+        titleLabel = new UILabelExt();
         if (titleLabel == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new titleLabel fail");
@@ -102,7 +103,8 @@ namespace OHOS
         titleLabel->Resize(200, 90);      // widget's width and height
         titleLabel->SetViewId("label3");  // Set style
         titleLabel->SetStyle(STYLE_TEXT_FONT, 28);
-        titleLabel->SetText("正在检测");
+        // titleLabel->SetText("正在检测");
+        titleLabel->SetTextId(STR_CHECKON);
         titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
         titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         titleLabel->SetRollSpeed(0);
@@ -124,7 +126,7 @@ namespace OHOS
         /* -------------------------------------------------------------------------- */
         if (testButton == nullptr)
         {
-            testButton = new UILabelButton();
+            testButton = new UILabelButtonExt();
         }
         testButton->SetPosition(118, 336);    // widget's left position and top position
         testButton->Resize(230, 80);          // widget's width and height
@@ -132,7 +134,8 @@ namespace OHOS
         testButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
 
         // Set additional property
-        testButton->SetText("停止检测");
+        // testButton->SetText("停止检测");
+        testButton->SetTextId(STR_CHECKSTOP);
         testButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         testButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
         testButton->SetViewId("checkstop");
@@ -145,7 +148,7 @@ namespace OHOS
         testButton->SetOnClickListener(clickLeftListener);
         BloodCheckScrollView->Add(testButton);
         /* -------------------------------------------------------------------------- */
-        Spo2Text = new UILabel();
+        Spo2Text = new UILabelExt();
         if (Spo2Text == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new Spo2Text fail");
index da68c46..fabdc21 100644 (file)
@@ -6,6 +6,8 @@
 #include "BloodOxygenModel.h"
 #include "ui_image_animator.h"
 #include "BloodResultView.h"
+#include "common/image_cache_manager.h"
+#include "language/font/ui_resource_string.h"
 namespace OHOS
 {
     // 图片设置
@@ -71,7 +73,7 @@ namespace OHOS
     // 初始化标签
     bool BloodResultView::InitLabel()
     {
-        titlelabel = new UILabel();
+        titlelabel = new UILabelExt();
         if (titlelabel == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail");
@@ -83,13 +85,14 @@ namespace OHOS
         titlelabel->SetStyle(STYLE_TEXT_FONT, 28);
 
         // Set additional property
-        titlelabel->SetText("检测不到结果");
+        // titlelabel->SetText("检测不到结果");
+        titlelabel->SetTextId(STR_CHECKERROR);
         titlelabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
         titlelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         titlelabel->SetRollSpeed(0);
         titlelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
         /* -------------------------------------------------------------------------- */
-        label1 = new UILabel();
+        label1 = new UILabelExt();
         if (label1 == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail");
@@ -100,13 +103,13 @@ namespace OHOS
         label1->SetViewId("label4");  // Set style
         label1->SetStyle(STYLE_TEXT_FONT, 30);
 
-        label1->SetText("请确认已带上手表,并保持");
+        label1->SetText("请确认已带上手表,并保持静止");
         label1->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
         label1->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         label1->SetRollSpeed(0);
         label1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         /* -------------------------------------------------------------------------- */
-        label2 = new UILabel();
+        label2 = new UILabelExt();
         if (label2 == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail");
@@ -116,14 +119,14 @@ namespace OHOS
         label2->Resize(200, 60);      // widget's width and height
         label2->SetViewId("label5");  // Set style
         label2->SetStyle(STYLE_TEXT_FONT, 30);
-        label2->SetText("静止,准备好后点击下方按钮");
+        label2->SetText("准备好后点击下方按钮");
         label2->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
         label2->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         label2->SetRollSpeed(0);
         label2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
 
         /* -------------------------------------------------------------------------- */
-        label3 = new UILabel();
+        label3 = new UILabelExt();
         if (label3 == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail");
@@ -194,7 +197,7 @@ namespace OHOS
             return nullptr;
         }
         /* -------------------------------------------------------------------------- */
-        ReButton = new UILabelButton();
+        ReButton = new UILabelButtonExt();
         if (ReButton == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButton fail");
@@ -202,7 +205,8 @@ namespace OHOS
         }
         ReButton->SetPosition(118, 334);
         ReButton->Resize(230, 80);
-        ReButton->SetText("重新检测");
+        // ReButton->SetText("重新检测");
+        ReButton->SetTextId(STR_RECHECK);
         ReButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36);
         ReButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         ReButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
@@ -215,7 +219,7 @@ namespace OHOS
         }
         ReButton->SetOnClickListener(clickLeft1Listener);
         /* -------------------------------------------------------------------------- */
-        StButton = new UILabelButton();
+        StButton = new UILabelButtonExt();
         if (StButton == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButton fail");
@@ -223,7 +227,8 @@ namespace OHOS
         }
         StButton->SetPosition(118, 434); // widget's left position and top position
         StButton->Resize(230, 80);       // widget's width and height
-        StButton->SetText("停止检测");
+        // StButton->SetText("停止检测");
+        StButton->SetTextId(STR_CHECKSTOP);
         StButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         StButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         StButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);