From: luozheng <1732036298@qq.com> Date: Mon, 6 May 2024 07:09:31 +0000 (+0800) Subject: 修改蓝牙Slice以适配多国语言 X-Git-Tag: release_V1.2.70_20241020_135402~1113^2~24 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=6ec3283f397181eea56de2b50f87ecc0e0e66082;p=mirrors%2FFD230.git 修改蓝牙Slice以适配多国语言 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsView.h b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsView.h index 3c997a1fc..eb20dde57 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-25 11:49:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-25 15:14:34 + * @LastEditTime: 2024-05-06 15:00:23 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/BluetoothServiceOptionsView.h */ @@ -32,7 +32,8 @@ namespace OHOS int16_t height; int16_t fontSize; // 字体大小 int16_t lineHeigh; // 行高 - const char *text; // 文本 + //const char *text; // 文本 + uint16_t textId; uint8_t lineBreakMode; // 断行模式。 }; BluetoothServiceOptionsView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h index 9cad993b9..9264fc9a7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h @@ -1,3 +1,10 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-04-25 11:51:04 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-06 14:20:02 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h + */ #ifndef CLASSIC_BLUETOOTH_VIEW_H #define CLASSIC_BLUETOOTH_VIEW_H @@ -28,7 +35,8 @@ namespace OHOS int16_t height; int16_t fontSize; // 字体大小 int16_t lineHeigh; // 行高 - const char *text; // 文本 + //const char *text; // 文本 + uint16_t textId; uint8_t lineBreakMode; // 断行模式。 }; ClassicBlueToothView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp index d8002210f..6f9beb82f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp @@ -94,7 +94,8 @@ 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->SetText(labelconfig.text); // 内容 + //label->SetText(labelconfig.text); // 内容 + label->SetTextId(labelconfig.textId); label->SetLineBreakMode(labelconfig.lineBreakMode); // 断行模式。 label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize); return label; @@ -110,7 +111,8 @@ namespace OHOS .height = 40, .fontSize = 30, .lineHeigh = 35, - .text = "蓝牙服务选项", + //.text = "蓝牙服务选项", + .textId = STR_BLUETOOTH_SERVICE_OPTIONS, .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; Title = SetBluetoothServiceOptionsViewLabel(labelconfig); @@ -128,7 +130,8 @@ namespace OHOS .height = 40, .fontSize = 30, .lineHeigh = 35, - .text = "通话蓝牙", + //.text = "通话蓝牙", + .textId = STR_HFP, .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; HFP_Label = SetBluetoothServiceOptionsViewLabel(labelconfig); @@ -138,7 +141,8 @@ namespace OHOS return false; } labelconfig.top = 273; - labelconfig.text = "媒体蓝牙"; + //labelconfig.text = "媒体蓝牙"; + labelconfig.textId = STR_A2DP; A2DP_Label = SetBluetoothServiceOptionsViewLabel(labelconfig); if (nullptr == A2DP_Label) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp index f4957a018..a6403bc5a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp @@ -95,7 +95,8 @@ 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->SetText(labelconfig.text); // 内容 + //label->SetText(labelconfig.text); // 内容 + label->SetTextId(labelconfig.textId); label->SetLineBreakMode(labelconfig.lineBreakMode); // 断行模式。 label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize); return label; @@ -111,7 +112,8 @@ namespace OHOS .height = 40, .fontSize = 30, .lineHeigh = 35, - .text = "蓝牙", + //.text = "蓝牙", + .textId = STR_BLUETOOTH, .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; Title = SetClassicBlueToothViewLabel(labelconfig); @@ -129,7 +131,8 @@ namespace OHOS .height = 40, .fontSize = 30, .lineHeigh = 35, - .text = "蓝牙耳机", + //.text = "蓝牙耳机", + .textId = STR_BLUETOOTH_HEADPHONES, .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; BlueToothEarPhoneLabel = SetClassicBlueToothViewLabel(labelconfig); @@ -140,7 +143,8 @@ namespace OHOS } /* -------------------------------------------------------------------------- */ labelconfig.top = 273; - labelconfig.text = "传统蓝牙"; + //labelconfig.text = "传统蓝牙"; + labelconfig.textId = STR_TRADITIONAL_BLUETOOTH; TradionalBlueToothLabel = SetClassicBlueToothViewLabel(labelconfig); if (nullptr == TradionalBlueToothLabel) { @@ -149,7 +153,8 @@ namespace OHOS } /* -------------------------------------------------------------------------- */ labelconfig.top = 393; - labelconfig.text = "蓝牙服务选项"; + //labelconfig.text = "蓝牙服务选项"; + labelconfig.textId = STR_BLUETOOTH_SERVICE_OPTIONS; BluetoothServiceOptionsLabel = SetClassicBlueToothViewLabel(labelconfig); if (nullptr == BluetoothServiceOptionsLabel) { @@ -164,7 +169,8 @@ namespace OHOS .height = 180, .fontSize = 20, .lineHeigh = 30, - .text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)", + //.text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)", + .textId = STR_AUTO_OFF_BLUETOOTH_NOTE, .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; AttentionLabel = SetClassicBlueToothViewLabel(labelconfig); diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt index 83559eea9..b1b9505f5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt +++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt @@ -259,4 +259,10 @@ STR_VOLTE_CALL$VoLTE call STR_MOBILE_DATA_OPTION$Mobile data option STR_SYSTEM_UPDATE$System Update STR_ONLINE_MUSIC$Online music +STR_BLUETOOTH_HEADPHONES$Bluetooth Headphones +STR_TRADITIONAL_BLUETOOTH$Traditional Bluetooth +STR_AUTO_OFF_BLUETOOTH_NOTE$Note: It will be automatically turned off if the connection is not successful for 10 minutes after opening, because the traditional Bluetooth will increase the power consumption for a long time, it is recommended to use when necessary\n\n(this function is mainly used for phone calls/notifications、music control/transmission, etc.) +STR_BLUETOOTH_SERVICE_OPTIONS$Bluetooth Service Options +STR_HFP$HFP +STR_A2DP$A2DP STR_LANGUAGE$Language \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt index 011a1ef53..839acad9e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt +++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt @@ -259,4 +259,10 @@ STR_VOLTE_CALL$VoLTE 通话 STR_MOBILE_DATA_OPTION$移动数据选项 STR_SYSTEM_UPDATE$系统更新 STR_ONLINE_MUSIC$在线音乐 +STR_BLUETOOTH_HEADPHONES$蓝牙耳机 +STR_TRADITIONAL_BLUETOOTH$传统蓝牙 +STR_AUTO_OFF_BLUETOOTH_NOTE$注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等) +STR_BLUETOOTH_SERVICE_OPTIONS$蓝牙服务选项 +STR_HFP$通话蓝牙 +STR_A2DP$媒体蓝牙 STR_LANGUAGE$语言 \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml index 1188d9244..02a50b4a4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml +++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml @@ -260,5 +260,11 @@ + + + + + + diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml index 6e1440e93..8a29365ff 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml +++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml @@ -260,5 +260,11 @@ + + + + + + diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang index f7dcfdc56..283b2fa56 100644 Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang differ diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang index d508778c6..fc7289d6a 100644 Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang differ diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h index ce9b23661..8eac6e1c1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h +++ b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h @@ -274,8 +274,14 @@ enum UIResourceTextId : uint16_t { STR_MOBILE_DATA_OPTION = 261, STR_SYSTEM_UPDATE = 262, STR_ONLINE_MUSIC = 263, - STR_LANGUAGE = 264, - STR_MAX_ID = 265, + STR_BLUETOOTH_HEADPHONES = 264, + STR_TRADITIONAL_BLUETOOTH = 265, + STR_AUTO_OFF_BLUETOOTH_NOTE = 266, + STR_BLUETOOTH_SERVICE_OPTIONS = 267, + STR_HFP = 268, + STR_A2DP = 269, + STR_LANGUAGE = 270, + STR_MAX_ID = 271, }; // UIResourceTextId enum FontLanguageId : uint8_t { diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang index 7cae968e2..1c3af03f2 100644 Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang index f7dcfdc56..283b2fa56 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang index d508778c6..fc7289d6a 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h index ce9b23661..8eac6e1c1 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h @@ -274,8 +274,14 @@ enum UIResourceTextId : uint16_t { STR_MOBILE_DATA_OPTION = 261, STR_SYSTEM_UPDATE = 262, STR_ONLINE_MUSIC = 263, - STR_LANGUAGE = 264, - STR_MAX_ID = 265, + STR_BLUETOOTH_HEADPHONES = 264, + STR_TRADITIONAL_BLUETOOTH = 265, + STR_AUTO_OFF_BLUETOOTH_NOTE = 266, + STR_BLUETOOTH_SERVICE_OPTIONS = 267, + STR_HFP = 268, + STR_A2DP = 269, + STR_LANGUAGE = 270, + STR_MAX_ID = 271, }; // UIResourceTextId enum FontLanguageId : uint8_t { diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang index 7cae968e2..1c3af03f2 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang differ