${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include
${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks
${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/service
+
${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits
${ROOT_DIR}/middleware/services/gui/lvgl/src/hal
#include "dial/include/DialView.h"
#include "blood/include/BloodCardView.h"
-
#include "weather/include/MainWeatherPresenter.h"
#include "weather/include/MainWeatherView.h"
#include "weather/include/WeatherReportPresenter.h"
#include "graphic_hardware_config.h"
#include "graphic_service.h"
#include "common/graphic_startup.h"
+#include "font/ui_font.h"
+#include "font/font_global_manager.h"
+
namespace OHOS
{
{VIEW_SCREEN_DURATION, &NativeLauncher::InitScreenDurationSlice}, // 亮屏时长实例化地址
{VIEW_SECONDARY_FUNCTION, &NativeLauncher::InitSecondaryFunction},
- {VIEW_QUICK_ACCESS,&NativeLauncher::InitQuickAccessSlice}, //快速访问实例化地址
+ {VIEW_QUICK_ACCESS, &NativeLauncher::InitQuickAccessSlice}, // 快速访问实例化地址
{VIEW_FAST_TRAINING, &NativeLauncher::InitFastTrainingSlice},
{VIEW_FAST_TRAINING_ATTENTION, &NativeLauncher::InitFastTrainingAttentionSlice},
void NativeLauncher::InitNativeLauncher()
{
+ //初始化语言
GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME);
WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "NativeLauncher::InitNativeLauncher");
+ /* -------------------------------------------------------------------------- */
+ //注册中文和英语两种语言包
+ static const char *BIN_LANG_EN = RES_PATH "font/en.lang";
+ static const char *BIN_LANG_ZH = RES_PATH "font/zh.lang";
+ const char *resFiles[] = {BIN_LANG_ZH, BIN_LANG_EN};
+ FontGlobalManager::GetInstance()->RegisterLanguageInfo(resFiles, (sizeof(resFiles) / sizeof(char *)), 1);
+ /* -------------------------------------------------------------------------- */
// 初始化所有预加载slice
InitBtHeadsetEvent(); // 蓝牙ct和tg适配初始化
InitAllNativeSlices();
--- /dev/null
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-02-01 14:09:40
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-02-01 14:09:43
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/language/UILabelButtonExt_Init.h
+ * @Description:
+ * @
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.
+ */
--- /dev/null
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-02-01 14:09:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-02-01 14:10:01
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/language/UILabelExt_Init.h
+ * @Description:
+ * @
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.
+ */
--- /dev/null
+## 根元素\r
+\r
+XML 必须以 language 为根元素并支持以下属性,\r
+\r
+language 元素中的属性对所有的子元素都生效,并且作为子元素的默认值,\r
+\r
+如果子元素有定义相同的属性,以子元素设置的生效。 \r
+\r
+\r
+\r
+**表3-3 多语言 xml 配置**\r
+\r
+| 属性名 | 描述 | 取值 | 必选 |\r
+| ------------ | ------------------------------------------------------------ | :---------------------------------------------- | :--: |\r
+| languageinfo | 语言信息,使用语言代码 (ISO 639)标识语言 | ISO 639 标准定义的语言代码 | Y |\r
+| direct | 文本方向布局 | ltr(left to right) rtl (right to left) | N |\r
+| fontName | 设置矢量字库名,路径需要 在 graphic_config.h 中配置 宏 VECTOR_FONT_DIR。 | ttf 文件名 | N |\r
+\r
+例如:\r
+\r
+```c++\r
+<language\r
+ id="language"\r
+ direct="ltf"\r
+ languageinfo="zh">\r
+ <lanstr\r
+ ....\r
+ />\r
+</language>\r
+```\r
+\r
+\r
+\r
+## 字符串元素 \r
+\r
+字符串元素以 lanstr 为命名,定义字符串的相关信息,包括字符串取值、文本大小、 字库名等信息。\r
+\r
+如果根元素也定义的相同的属性,会以字符串元素中定义的值为准,\r
+\r
+ 如果都没有定义,取 UIKit 中设置的默认值。\r
+\r
+\r
+\r
+ **表3-4 字符串元素配置** \r
+\r
+| 属性名 | 描述 | 取值 | 必选 |\r
+| -------- | ------------------------------------------------------------ | ----------------------------------------------- | ---- |\r
+| id | 字符串唯一标识,需要保证唯一性 | 统一以 STR_ 为前缀 是 value 字符串内容 | Y |\r
+| value | 字符串内容 | 任意字符串 | Y |\r
+| direct | 文本方向布局 | ltr(left to right) rtl (right to left) | N |\r
+| size | 文本大小,如果同时有在代码中通 过接口 SetFont 进行设置,会按照 和 SetText 以及 ForceResetText 先 后顺序为准 | 0~255 | N |\r
+| fontName | 设置矢量字库名,路径需要在 graphic_config.h 中配置宏 VECTOR_FONT_DIR。如果同时有 在代码中通过接口 SetFont 进行设 置,会按照和 SetText 以及 ForceResetText 先后顺序为准 | ttf 文件名 | N |\r
+\r
+例如:\r
+\r
+```c++\r
+<lanstr\r
+ id="STR_IMAGE"\r
+ value="Image"\r
+ size="21"\r
+ direct="rtl"\r
+/>\r
+```\r
+\r
--- /dev/null
+/*
+* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.
+* Description: language
+* Author: Graphic develop team
+* Create: 2021-07-06
+*/
+
+#ifndef UI_RESOURCE_STRING_H
+#define UI_RESOURCE_STRING_H
+#include <cstdint>
+namespace OHOS {
+enum UIResourceTextId : uint16_t {
+ STR_IMAGE = 0,\r
+ STR_PROGRESSBAR = 1,\r
+ STR_SLIDEUNLOCK = 2,\r
+ STR_LISTBOX = 3,\r
+ STR_BUTTON = 4,\r
+ STR_SCROLLVIEW = 5,\r
+ STR_SCROLLGRID = 6,\r
+ STR_CLOCK = 7,\r
+ STR_DISTURBANCE = 8,\r
+ STR_BRIGHT = 9,\r
+ STR_PHONE = 10,\r
+ STR_LANGAGE = 11,\r
+ STR_ALARM = 12,\r
+ STR_SYSTEM = 13,\r
+ STR_SPO2 = 14,\r
+ STR_COMPASS = 15,\r
+ STR_INDOORWALK = 16,\r
+ STR_WEATHER = 17,\r
+ STR_SYSTEMSETTING = 18,\r
+ STR_MAX_ID = 19,\r
+}; // UIResourceTextId\r
+
+enum FontLanguageId : uint8_t {
+ LANGUAGE_ID_ZH,\r
+ LANGUAGE_ID_EN,\r
+ LANGUAGE_ID_MAX\r
+}; // UITextLanguageTextId\r
+}\r
+#endif /* UI_RESOURCE_STRING_H */\r
--- /dev/null
+<language id="language" languageinfo="en" fontName="DroidSansFallback.ttf" direct="ltf">
+
+ <lanstr id="STR_IMAGE" value="Image" size="21" direct="rtl" />
+ <lanstr id="STR_PROGRESSBAR" value="ProgressBar" direct="mixed" />
+ <lanstr id="STR_SLIDEUNLOCK" value="SlideUnlock" />
+ <lanstr id="STR_LISTBOX" value="ListBox" />
+ <lanstr id="STR_BUTTON" value="Button" />
+ <lanstr id="STR_SCROLLVIEW" value="ScrollView" />
+ <lanstr id="STR_SCROLLGRID" value="ScrollGrid" />
+ <lanstr id="STR_CLOCK" value="Clock" />
+ <lanstr id="STR_DISTURBANCE" value="Disturbance" />
+ <lanstr id="STR_BRIGHT" value="Bright" />
+ <lanstr id="STR_PHONE" value="Phone" />
+ <lanstr id="STR_ALARM" value="Alarm" />
+ <lanstr id="STR_SYSTEMSETTING" value="Setting" />
+ <lanstr id="STR_LANGAGE" size="26" value="Language" />
+ <lanstr id="STR_SPO2" value="SPO2" />
+ <lanstr id="STR_COMPASS" value="Compass" />
+ <lanstr id="STR_INDOORWALK" value="IndoorWalk" />
+ <lanstr id="STR_WEATHER" value="Weathher" />
+
+</language>
\ No newline at end of file
--- /dev/null
+<language id="language" direct="ltf" languageinfo="zh">
+
+ <lanstr id="STR_IMAGE" value="图片" size="32" direct="rtl" />
+ <lanstr id="STR_PROGRESSBAR" value="进度条" direct="mixed" />
+ <lanstr id="STR_SLIDEUNLOCK" value="滑动解锁" />
+ <lanstr id="STR_LISTBOX" value="列表" />
+ <lanstr id="STR_BUTTON" value="按钮" />
+ <lanstr id="STR_SCROLLVIEW" value="滚动视图" />
+ <lanstr id="STR_SCROLLGRID" value="滚动网格" />
+ <lanstr id="STR_CLOCK" value="时钟" />
+ <lanstr id="STR_DISTURBANCE" value="勿扰" />
+ <lanstr id="STR_BRIGHT" value="亮屏" />
+ <lanstr id="STR_PHONE" value="找手机" />
+ <lanstr id="STR_LANGAGE" size="30" value="语言" />
+ <lanstr id="STR_ALARM" value="闹钟" />
+ <lanstr id="STR_SYSTEM" value="设置" />
+ <lanstr id="STR_SPO2" value="血氧饱和度" />
+ <lanstr id="STR_COMPASS" value="指南针" />
+ <lanstr id="STR_INDOORWALK" value="室内步行" />
+ <lanstr id="STR_WEATHER" value="天气" />
+
+</language>
\ No newline at end of file
#include "components/ui_label.h"\r
#include "components/ui_radio_button.h"\r
#include "components/ui_image_view.h"\r
+#include "components/ui_label_ext.h"\r
namespace OHOS\r
{\r
class SystemLanguageView\r
void SetRadioButtonSelectStatus(UIRadioButton &radiobutton, bool state); // 设置单选框的选择状态\r
private:\r
UIScrollView *scrollView = nullptr;\r
- UILabel *Title = nullptr; // 标题\r
+ UILabelExt *Title = nullptr; // 标题\r
UIImageView *Background[2]{nullptr}; // 放组件的背景\r
UILabel *SimplifiedChineseLabel = nullptr;\r
UILabel *EnglishLabel = nullptr;\r
+/*** \r
+ * @Author: Caisking 3449750381@qq.com\r
+ * @Date: 2024-01-29 19:58:37\r
+ * @LastEditors: Caisking 3449750381@qq.com\r
+ * @LastEditTime: 2024-02-01 16:27:58\r
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemPresenter.h\r
+ * @Description: \r
+ * @\r
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved. \r
+ */\r
#ifndef SYSTEM_PRESENTER_H\r
#define SYSTEM_PRESENTER_H\r
\r
class RadiobuttonOnChangeListener : public UICheckBox::OnChangeListener\r
{\r
public:\r
- RadiobuttonOnChangeListener(UIRadioButton *uiView)\r
+ RadiobuttonOnChangeListener(UIRadioButton *uiView, UILabelExt *label)\r
{\r
m_uiView = uiView;\r
+ m_label = label;\r
}\r
~RadiobuttonOnChangeListener() {}\r
bool isChineseRadioButtonSelected();\r
\r
private:\r
UIRadioButton *m_uiView{nullptr};\r
+ UILabelExt *m_label{nullptr};\r
};\r
\r
class SystemViewOnDragListener : public UIView::OnDragListener\r
}\r
scrollView->SetOnDragListener(draglistener);\r
/* ---------------------------------- Title --------------------------------- */\r
- Title = new UILabel();\r
+ Title = new UILabelExt();\r
if (Title == nullptr)\r
{\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::Title new fail!");\r
return nullptr;\r
}\r
- Title->SetPosition(203, 52);\r
- Title->SetStyle(STYLE_TEXT_FONT, 30);\r
- Title->SetStyle(STYLE_LINE_HEIGHT, 35);\r
- Title->SetText("语言");\r
- Title->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+ Title->SetPosition(203, 52, 200, 35);\r
+ Title->SetTextId(11);\r
+ //Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
scrollView->Add(Title);\r
/* ------------------------------- Background ------------------------------- */\r
ImageConfig imageconfig = {\r
return nullptr;\r
}\r
SetRadioButtonSelectStatus(*SimplifiedChineseRadioButton, true);\r
- UICheckBox::OnChangeListener* SimplifiedChineseRadioButtonChange = static_cast<UICheckBox::OnChangeListener*>(new RadiobuttonOnChangeListener(SimplifiedChineseRadioButton));\r
+ UICheckBox::OnChangeListener *SimplifiedChineseRadioButtonChange = static_cast<UICheckBox::OnChangeListener *>(new RadiobuttonOnChangeListener(SimplifiedChineseRadioButton,Title));\r
SimplifiedChineseRadioButton->SetOnChangeListener(SimplifiedChineseRadioButtonChange);\r
scrollView->Add(SimplifiedChineseRadioButton);\r
/* --------------------------- EnglishRadioButton --------------------------- */\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::EnglishRadioButton new fail!");\r
return nullptr;\r
}\r
- UICheckBox::OnChangeListener* EnglishRadioButtonChange = static_cast<UICheckBox::OnChangeListener*>(new RadiobuttonOnChangeListener(EnglishRadioButton));\r
+ UICheckBox::OnChangeListener *EnglishRadioButtonChange = static_cast<UICheckBox::OnChangeListener *>(new RadiobuttonOnChangeListener(EnglishRadioButton,Title));\r
EnglishRadioButton->SetOnChangeListener(EnglishRadioButtonChange);\r
scrollView->Add(EnglishRadioButton);\r
initViewStatus = true;\r
#include "graphic_math.h"\r
#include "string.h"\r
#include "system/include/SystemPresenter.h"\r
+#include "font/font_global_manager.h"\r
+#include "font/ui_font.h"\r
+\r
namespace OHOS\r
{\r
\r
{\r
return true;\r
}\r
+ RootView::GetInstance()->Invalidate();\r
return false;\r
}\r
\r
return false;\r
}\r
\r
+ /* -------------------------------------------------------------------------- */\r
+ // 注册中文和英语两种语言包\r
+ static const char *BIN_LANG_EN = RES_PATH "font/en.lang";\r
+ static const char *BIN_LANG_ZH = RES_PATH "font/zh.lang";\r
+ const char *resFiles[] = {BIN_LANG_ZH, BIN_LANG_EN};\r
+ /* -------------------------------------------------------------------------- */\r
// 用来监听语言切换\r
bool RadiobuttonOnChangeListener::OnChange(UICheckBox::UICheckBoxState state)\r
{\r
+\r
+ // 获取字体单例\r
+ UIFont *uiFont = UIFont::GetInstance();\r
+ if (uiFont == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Get UIFont error");\r
+ return false;\r
+ }\r
+ /* -------------------------------------------------------------------------- */\r
switch (state)\r
{\r
case UICheckBox::SELECTED:\r
if (isChineseRadioButtonSelected())\r
{\r
- // loadChineseLanguageResource();//加载中文资源\r
- // updateUIWithChineseText();//更新中文文本\r
+ // 中文文本\r
+ FontGlobalManager::GetInstance()->RegisterLanguageInfo(resFiles, (sizeof(resFiles) / sizeof(char *)), 0);\r
+ uiFont->SetCurrentLangId(0); // set language\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Switched to Chinese language");\r
}\r
else if (isEnglishRadioButtonSelected())\r
{\r
- // loadEnglishLanguageResource(); //加载英语资源\r
- // updateUIWithEnglishText(); //更新英语文本\r
+ // 英语文本\r
+ FontGlobalManager::GetInstance()->RegisterLanguageInfo(resFiles, (sizeof(resFiles) / sizeof(char *)), 1);\r
+ uiFont->SetCurrentLangId(1); // set language\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Switched to English language");\r
}\r
+ m_label->SetTextId(11);\r
+ //强制刷新\r
+ m_label->ForceResetText();\r
+ RootView::GetInstance()->Invalidate();\r
break;\r
case UICheckBox::UNSELECTED:\r
// Handle unselected state if needed\r
${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include
${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks
${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/innerkits
+ ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/components
${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/events
${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits
--- /dev/null
+/*
+* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.
+* Description: language
+* Author: Graphic develop team
+* Create: 2021-07-06
+*/
+
+#ifndef UI_RESOURCE_STRING_H
+#define UI_RESOURCE_STRING_H
+#include <cstdint>
+namespace OHOS {
+enum UIResourceTextId : uint16_t {
+ STR_IMAGE = 0,\r
+ STR_PROGRESSBAR = 1,\r
+ STR_SLIDEUNLOCK = 2,\r
+ STR_LISTBOX = 3,\r
+ STR_BUTTON = 4,\r
+ STR_SCROLLVIEW = 5,\r
+ STR_SCROLLGRID = 6,\r
+ STR_CLOCK = 7,\r
+ STR_22 = 8,\r
+ GLIDE_DISTURBANCE = 9,\r
+ GLIDE_BRIGHT = 10,\r
+ GLIDE_PHONE = 11,\r
+ GLIDE_ALARM = 12,\r
+ GLIDE_SYSTEM = 13,\r
+ STR_11 = 14,\r
+ GLIDE_SYSTEMSETTING = 15,\r
+ STR_MAX_ID = 16,\r
+}; // UIResourceTextId\r
+
+enum FontLanguageId : uint8_t {
+ LANGUAGE_ID_ZH,\r
+ LANGUAGE_ID_EN,\r
+ LANGUAGE_ID_MAX\r
+}; // UITextLanguageTextId\r
+}\r
+#endif /* UI_RESOURCE_STRING_H */\r
#include "graphic_hardware_config.h"
#include "graphic_service.h"
#include "common/graphic_startup.h"
+#include "font/font_global_manager.h"
#ifdef SUPPORT_ALIPAY_SEC
#include "AlipayMainView.h"
#include "AlipayPresenter.h"
#endif
+
namespace OHOS {
+static const char* BIN_LANG_EN = RES_PATH"font/en.lang";
+static const char* BIN_LANG_ZH = RES_PATH"font/zh.lang";
struct AppViewMapper
{
AppViewId id;
void NativeLauncher::InitNativeLauncher() {
GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME);
WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "NativeLauncher::InitNativeLauncher");
+
+ const char* resFiles[] = {BIN_LANG_ZH, BIN_LANG_EN};
+ FontGlobalManager::GetInstance()->RegisterLanguageInfo(resFiles, (sizeof(resFiles) / sizeof(char*)), 1);
+
+
// 初始化所有预加载slice
InitBtHeadsetEvent(); // 蓝牙ct和tg适配初始化
InitAllNativeSlices();
mainClockView = new DialViewGroup();
std::string filePath = dynamic_cast<MainPresenterSample*>(presenter_)->GetDialPath();
if (filePath.size() == 0) {
- filePath = RES_PATH"dial.bin";
+ filePath = RES_PATH"maomao.bin";
}
mainClockView->SetDial(filePath);
#else
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-01-29 19:58:37
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-02-01 14:53:13
+ * @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp
+ * @Description:
+ * @
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.
+ */
/*
* Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
* Description: WeekStep
#include "ScreenModels.h"
#include "SettingModel.h"
#include "ui_resource_image.h"
+#include "components/ui_label_ext.h"
+#include "ui_resource_string.h"
namespace OHOS {
void PullUpDownView::InitViewLable(void)
{
- dnotDisturbLable = new UILabel();
+ dnotDisturbLable = new UILabelExt();
if (dnotDisturbLable == nullptr) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dnotDisturbLable new fail");
return;
}
dnotDisturbLable->SetPosition(DISTURB_LABEL_X, DISTURB_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT);
- dnotDisturbLable->SetText("勿扰");
+ dnotDisturbLable->SetTextId(9);
dnotDisturbLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
dnotDisturbLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
- briScreenLable = new UILabel();
+ briScreenLable = new UILabelExt();
if (briScreenLable == nullptr) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "briScreenLable new fail");
return;
}
briScreenLable->SetPosition(SCREEN_LABEL_X, SCREEN_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT);
- briScreenLable->SetText("亮屏");
+ briScreenLable->SetTextId(10);
briScreenLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
briScreenLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
- finPhoneLable = new UILabel();
+ finPhoneLable = new UILabelExt();
if (finPhoneLable == nullptr) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "finPhoneLable new fail");
return;
}
finPhoneLable->SetPosition(PHONE_LABEL_X, PHONE_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT);
- finPhoneLable->SetText("找手机");
+ finPhoneLable->SetTextId(11);
finPhoneLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
finPhoneLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
- droAlarmLable = new UILabel();
+ droAlarmLable = new UILabelExt();
if (finPhoneLable == nullptr) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "finPhoneLable new fail");
return;
}
droAlarmLable->SetPosition(ALARM_LABEL_X, ALARM_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT);
- droAlarmLable->SetText("闹钟");
+ droAlarmLable->SetTextId(12);
droAlarmLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
droAlarmLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
- droSettingLable = new UILabel();
+ droSettingLable = new UILabelExt();
if (droSettingLable == nullptr) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "droSettingLable new fail");
return;
}
droSettingLable->SetPosition(SETTING_LABEL_X, SETTING_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT);
- droSettingLable->SetText("设置");
+ droSettingLable->SetTextId(13);
droSettingLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE);
droSettingLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
}
#include "DialLabelView.h"
#include "securec.h"
-namespace OHOS {
-DialLabelView::DialLabelView(void)
+namespace OHOS
{
-}
-
-DialLabelView::~DialLabelView(void)
-{
- if (text_ != nullptr) {
- UIFree(text_);
+ DialLabelView::DialLabelView(void)
+ {
}
-}
-bool DialLabelView::SetText(const char* text)
-{
- if (text == nullptr) {
- return false;
+ DialLabelView::~DialLabelView(void)
+ {
+ if (text_ != nullptr)
+ {
+ UIFree(text_);
+ }
}
- UILabel::SetText(text);
- return true;
-}
-void DialLabelView::SetTextWithWildcardInner(const char* text)
-{
- if (strcmp(text, dstBuf_) == 0) {
- return;
- }
- memset_s(dstBuf_, sizeof(dstBuf_), 0, sizeof(dstBuf_));
- if (strcpy_s(dstBuf_, MAX_BUF_SIZE, text) != EOK) {
- GRAPHIC_LOGE("strcpy_s failed!\n");
+ bool DialLabelView::SetText(const char *text)
+ {
+ if (text == nullptr)
+ {
+ return false;
+ }
+ UILabel::SetText(text);
+ return true;
}
- UILabel::SetText(dstBuf_);
-}
-bool DialLabelView::SetTextWithWildcard(const char* text)
-{
- if (text == nullptr) {
- return false;
- }
- if (text_ != nullptr) {
- if (strcmp(text, text_) == 0) {
- return true;
+ void DialLabelView::SetTextWithWildcardInner(const char *text)
+ {
+ if (strcmp(text, dstBuf_) == 0)
+ {
+ return;
}
- UIFree(text_);
- text_ = nullptr;
+ memset_s(dstBuf_, sizeof(dstBuf_), 0, sizeof(dstBuf_));
+ if (strcpy_s(dstBuf_, MAX_BUF_SIZE, text) != EOK)
+ {
+ GRAPHIC_LOGE("strcpy_s failed!\n");
+ }
+ UILabel::SetText(dstBuf_);
}
- uint32_t textLen = static_cast<uint32_t>(strlen(text));
- if (textLen > (MAX_BUF_SIZE - 1)) {
- return false;
- }
- text_ = static_cast<char*>(UIMalloc(++textLen));
- if (text_ == nullptr) {
- return false;
- }
- if (memcpy_s(text_, textLen, text, textLen) != EOK) {
- UIFree(text_);
- text_ = nullptr;
- return false;
+ bool DialLabelView::SetTextWithWildcard(const char *text)
+ {
+ if (text == nullptr)
+ {
+ return false;
+ }
+ if (text_ != nullptr)
+ {
+ if (strcmp(text, text_) == 0)
+ {
+ return true;
+ }
+ UIFree(text_);
+ text_ = nullptr;
+ }
+
+ uint32_t textLen = static_cast<uint32_t>(strlen(text));
+ if (textLen > (MAX_BUF_SIZE - 1))
+ {
+ return false;
+ }
+ text_ = static_cast<char *>(UIMalloc(++textLen));
+ if (text_ == nullptr)
+ {
+ return false;
+ }
+ if (memcpy_s(text_, textLen, text, textLen) != EOK)
+ {
+ UIFree(text_);
+ text_ = nullptr;
+ return false;
+ }
+ text_[textLen] = '\0';
+ return true;
}
- text_[textLen] = '\0';
- return true;
-}
-void DialLabelView::HandleTextData(const std::string* data, uint16_t num)
-{
- char tempBuf[MAX_BUF_SIZE] = {0};
- if (num == 1) {
- if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0].c_str()) < 0) {
- GRAPHIC_LOGE("snprintf_s failed.\n");
- return;
+ void DialLabelView::HandleTextData(const std::string *data, uint16_t num)
+ {
+ char tempBuf[MAX_BUF_SIZE] = {0};
+ if (num == 1)
+ {
+ if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0].c_str()) < 0)
+ {
+ GRAPHIC_LOGE("snprintf_s failed.\n");
+ return;
+ }
}
- } else if (num == 2) { // 2: wildcard cnt
- if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0].c_str(), data[1].c_str()) < 0) {
- GRAPHIC_LOGE("snprintf_s failed.\n");
- return;
+ else if (num == 2)
+ { // 2: wildcard cnt
+ if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0].c_str(), data[1].c_str()) < 0)
+ {
+ GRAPHIC_LOGE("snprintf_s failed.\n");
+ return;
+ }
}
- } else if (num == 3) { // 3: wildcard cnt
- if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_,
- data[0].c_str(), data[1].c_str(), data[2].c_str()) < 0) { // 2: index
- GRAPHIC_LOGE("snprintf_s failed.\n");
+ else if (num == 3)
+ { // 3: wildcard cnt
+ if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_,
+ data[0].c_str(), "年", data[1].c_str(), "月", data[2].c_str(), "日") < 0)
+ { // 2: index
+ GRAPHIC_LOGE("snprintf_s failed.\n");
+ return;
+ }
+ }
+ else
+ {
+ GRAPHIC_LOGE("max size is 3.\n");
return;
}
- } else {
- GRAPHIC_LOGE("max size is 3.\n");
- return;
+ SetTextWithWildcardInner(tempBuf);
}
- SetTextWithWildcardInner(tempBuf);
-}
-void DialLabelView::HandleFloatData(const float* data, uint16_t num)
-{
- char tempBuf[MAX_BUF_SIZE] = {0};
- if (num == 1) {
- if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0]) < 0) {
- GRAPHIC_LOGE("snprintf_s failed.\n");
- return;
+ void DialLabelView::HandleFloatData(const float *data, uint16_t num)
+ {
+ char tempBuf[MAX_BUF_SIZE] = {0};
+ if (num == 1)
+ {
+ if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0]) < 0)
+ {
+ GRAPHIC_LOGE("snprintf_s failed.\n");
+ return;
+ }
}
- } else if (num == 2) { // 2: wildcard cnt
- if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0], data[1]) < 0) {
- GRAPHIC_LOGE("snprintf_s failed.\n");
- return;
+ else if (num == 2)
+ { // 2: wildcard cnt
+ if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0], data[1]) < 0)
+ {
+ GRAPHIC_LOGE("snprintf_s failed.\n");
+ return;
+ }
}
- } else if (num == 3) { // 3: wildcard cnt
- if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0], data[1], data[2]) < 0) { // 2: index
- GRAPHIC_LOGE("snprintf_s failed.\n");
+ else if (num == 3)
+ { // 3: wildcard cnt
+ if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data[0], data[1], data[2]) < 0)
+ { // 2: index
+ GRAPHIC_LOGE("snprintf_s failed.\n");
+ return;
+ }
+ }
+ else
+ {
+ GRAPHIC_LOGE("max size is 3.\n");
return;
}
- } else {
- GRAPHIC_LOGE("max size is 3.\n");
- return;
+ SetTextWithWildcardInner(tempBuf);
}
- SetTextWithWildcardInner(tempBuf);
-}
-void DialLabelView::HandleFloatData(float data)
-{
- char tempBuf[MAX_BUF_SIZE] = {0};
- if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data) < 0) {
- GRAPHIC_LOGE("snprintf_s failed.\n");
- return;
+ void DialLabelView::HandleFloatData(float data)
+ {
+ char tempBuf[MAX_BUF_SIZE] = {0};
+ if (snprintf_s(tempBuf, MAX_BUF_SIZE, MAX_BUF_SIZE - 1, text_, data) < 0)
+ {
+ GRAPHIC_LOGE("snprintf_s failed.\n");
+ return;
+ }
+ SetTextWithWildcardInner(tempBuf);
}
- SetTextWithWildcardInner(tempBuf);
-}
}
\ No newline at end of file
out = static_cast<float>(angleMS_);
break;
case DialDataType::DATA_TYPE_TIME_YEAR:
- out = static_cast<float>(tblock_->tm_year);
+ out = static_cast<float>((tblock_->tm_year) + 1900);
break;
case DialDataType::DATA_TYPE_TIME_MONTH:
- out = static_cast<float>(tblock_->tm_mon);
+ out = static_cast<float>((tblock_->tm_mon) + 1);
break;
case DialDataType::DATA_TYPE_TIME_WEEK:
out = static_cast<float>(tblock_->tm_wday);
"audio_manager",
"custom_utils",
"rotary_encoder",
- 'nativelauncher',
- # 'fd230launcher',
+ # 'nativelauncher',
+ 'fd230launcher',
"batterry_service"],
'ram_component_set': ['bgh', 'media', 'gpu', 'graphic_uikit', 'bgh_audio', 'dfx_set', 'ohos_set', 'wearable_set', 'alipay_set'],
'dsp_version': 'max',
'packet': True,
- 'fs_image_path':'evb4',
- # 'fs_image_path':'fd230',
+ # 'fs_image_path':'evb4',
+ 'fs_image_path':'fd230',
'fs_image': True
},
#native-xts: liteos + uikit + nandflash + mipi + psram + audio 典型合封UIKIT版本
"custom_utils",
"rotary_encoder",
# 'nativelauncher',
- 'fd230launcher',
+ 'fd230launcher',
"batterry_service"],
'ram_component_set': ['bgh', 'media', 'gpu', 'graphic_uikit', 'bgh_audio', 'dfx_set', 'ohos_set', 'wearable_set', 'xts_set', 'xts_test_set', 'alipay_set'],
'dsp_version': 'max',
'packet': True,
- 'fs_image_path':'evb4',
- # 'fs_image_path':'fd230',
+ #'fs_image_path':'evb4',
+ 'fs_image_path':'fd230',
'fs_image': True
},
/**
* @brief Whether open offline dial.
*/
-#define USE_OFFLINE_DIAL 0
+#define USE_OFFLINE_DIAL 1
// if ENABLE_OPENVG is set to be 1, dislpay_vau.c should be compiled.
#define ENABLE_OPENVG 0
#include <cstdint>
#include "common/text.h"
#include "components/ui_view.h"
-#include "font/font_global_header.h"
+#include "../src/ui/innerkits/font/font_global_header.h"
#include "graphic_config.h"
#include "gfx_utils/graphic_log.h"
#include "gfx_utils/heap_base.h"
+\r
/*\r
* Copyright (c) 2022 CompanyNameMagicTag.\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
+#include "ui_label_ext.h"\r
*/\r
\r
#ifndef PULL_UP_DOWN_VIEW_H\r
#include "components/ui_image_view.h"\r
#include "components/ui_label.h"\r
#include "components/ui_label_button.h"\r
+#include "components/ui_label_ext.h"\r
\r
namespace OHOS {\r
class PullUpDownView : public AppGroupView {\r
UIImageView *finPhone{nullptr};\r
UIImageView *droAlarm{nullptr};\r
UIImageView *droSetting{nullptr};\r
- UILabel *dnotDisturbLable{nullptr};\r
- UILabel *briScreenLable{nullptr};\r
- UILabel *finPhoneLable{nullptr};\r
- UILabel *droAlarmLable{nullptr};\r
- UILabel *droSettingLable{nullptr};\r
+\r
+ UILabelExt *dnotDisturbLable{nullptr};\r
+ UILabelExt *briScreenLable{nullptr};\r
+ UILabelExt *finPhoneLable{nullptr};\r
+ UILabelExt *droAlarmLable{nullptr};\r
+ UILabelExt *droSettingLable{nullptr};\r
+ \r
UIImageView *bluetooth{nullptr};\r
UIImageView *battery{nullptr};\r
UILabel *batteryLable{nullptr};\r
languageinfo="en"
fontName="DroidSansFallback.ttf"
direct="ltf"
- >
+>
<lanstr
id="STR_IMAGE"
value="Image"
- size = "21"
+ size="21"
direct="rtl"
- />
+ />
<lanstr
id="STR_PROGRESSBAR"
value="ProgressBar"
direct="mixed"
- />
+ />
<lanstr
id="STR_SLIDEUNLOCK"
value="SlideUnlock"
- />
+ />
<lanstr
id="STR_LISTBOX"
value="ListBox"
- />
+ />
<lanstr
id="STR_BUTTON"
value="Button"
- />
+ />
<lanstr
id="STR_SCROLLVIEW"
value="ScrollView"
- />
+ />
<lanstr
id="STR_SCROLLGRID"
value="ScrollGrid"
- />
+ />
<lanstr
id="STR_CLOCK"
value="Clock"
- />
+ />
<lanstr
- size = "21"
+ size="21"
direct="ltr"
id="STR_11"
value="Clock1"
- />
-</language>
+ />
+ <lanstr
+ id="GLIDE_DISTURBANCE"
+ value="Disturbance"
+ />
+ <lanstr
+ id="GLIDE_BRIGHT"
+ value="Bright"
+ />
+ <lanstr
+ id="GLIDE_PHONE"
+ value="Phone"
+ />
+ <lanstr
+ id="GLIDE_ALARM"
+ value="Alarm"
+ />
+ <lanstr
+ id="GLIDE_SYSTEMSETTING"
+ value="SystemSetting"
+ />
+ <lanstr
+ id="SYSTEM_LANGAGE"
+ value="Language"
+ />
+</language>
\ No newline at end of file
value="图片"
size="32"
direct="rtl"
- />
+ />
<lanstr
id="STR_PROGRESSBAR"
value="进度条"
direct="mixed"
- />
+ />
<lanstr
id="STR_SLIDEUNLOCK"
value="滑动解锁"
- />
+ />
<lanstr
id="STR_LISTBOX"
value="列表"
- />
+ />
<lanstr
id="STR_BUTTON"
value="按钮"
- />
+ />
<lanstr
id="STR_SCROLLVIEW"
value="滚动视图"
- />
+ />
<lanstr
id="STR_SCROLLGRID"
value="滚动网格"
- />
+ />
<lanstr
id="STR_CLOCK"
value="时钟"
- />
+ />
<lanstr
id="STR_22"
value="时钟"
- />
-</language>
+ />
+ <lanstr
+ id="GLIDE_DISTURBANCE"
+ value="勿扰"
+ />
+ <lanstr
+ id="GLIDE_BRIGHT"
+ value="亮屏"
+ />
+ <lanstr
+ id="GLIDE_PHONE"
+ value="找手机"
+ />
+ <lanstr
+ id="GLIDE_ALARM"
+ value="闹钟"
+ />
+ <lanstr
+ id="GLIDE_SYSTEM"
+ value="设置"
+ />
+ <lanstr
+ id="SYSTEM_LANGAGE"
+ value="语言"
+ />
+</language>
\ No newline at end of file
/**
* @brief vector font global ability, which is disabled by default on LiteOS.
*/
-#define ENABLE_FONT_VECTOR_GLOBAL 0
+#define ENABLE_FONT_VECTOR_GLOBAL 1
/**
* @brief image bin ability, which is disabled by default on LiteOS.
*/