From: luozheng <1732036298@qq.com> Date: Mon, 6 May 2024 07:48:08 +0000 (+0800) Subject: 修改声音与震动Slice以适配多国语言 X-Git-Tag: release_V1.2.70_20241020_135402~1113^2~23 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=67b596a7bae6f40a730f4eb492f8d3fdd1cfb205;p=mirrors%2FFD230.git 修改声音与震动Slice以适配多国语言 --- 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 b1b9505f5..52e36d188 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 @@ -265,4 +265,8 @@ STR_AUTO_OFF_BLUETOOTH_NOTE$Note: It will be automatically turned off if the con STR_BLUETOOTH_SERVICE_OPTIONS$Bluetooth Service Options STR_HFP$HFP STR_A2DP$A2DP +STR_SYSTEM_VOLUME$System Volume +STR_MEDIA_VOLUME$Media Volume +STR_VIBRATION_MODE$Vibration Mode +STR_SILENT_MODE$Silent Mode 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 839acad9e..880204d3d 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 @@ -265,4 +265,8 @@ STR_AUTO_OFF_BLUETOOTH_NOTE$注:开启后10分钟没连接成功会自动关 STR_BLUETOOTH_SERVICE_OPTIONS$蓝牙服务选项 STR_HFP$通话蓝牙 STR_A2DP$媒体蓝牙 +STR_SYSTEM_VOLUME$系统音量 +STR_MEDIA_VOLUME$媒体音量 +STR_VIBRATION_MODE$震动模式 +STR_SILENT_MODE$静音模式 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 02a50b4a4..a841ce10f 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 @@ -266,5 +266,9 @@ + + + + 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 8a29365ff..9beb267fd 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 @@ -266,5 +266,9 @@ + + + + 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 283b2fa56..a37dcefb5 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 fc7289d6a..18363434e 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 8eac6e1c1..10c1947a3 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 @@ -280,8 +280,12 @@ enum UIResourceTextId : uint16_t { STR_BLUETOOTH_SERVICE_OPTIONS = 267, STR_HFP = 268, STR_A2DP = 269, - STR_LANGUAGE = 270, - STR_MAX_ID = 271, + STR_SYSTEM_VOLUME = 270, + STR_MEDIA_VOLUME = 271, + STR_VIBRATION_MODE = 272, + STR_SILENT_MODE = 273, + STR_LANGUAGE = 274, + STR_MAX_ID = 275, }; // 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 1c3af03f2..ed6997f92 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/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h index df21fdb43..7ce0244c1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h @@ -1,3 +1,10 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-04-19 21:03:26 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-06 15:13:58 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h + */ #ifndef SOUND_AND_VIBRATION_VIEW_H #define SOUND_AND_VIBRATION_VIEW_H @@ -36,7 +43,8 @@ namespace OHOS int16_t w; int16_t h; const char *ViewId; - std::string Text; + //std::string Text; + int16_t TextId; }; SoundAndVibrationView(); virtual ~SoundAndVibrationView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp index 56942955b..3d5bd1410 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp @@ -2,13 +2,14 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-19 10:39:14 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-22 16:53:42 + * @LastEditTime: 2024-05-06 15:19:39 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp */ #include "soundandvibration/include/SoundAndVibrationView.h" #include "soundandvibration/include/SoundAndVibrationPresenter.h" #include "soundandvibration/include/SoundAndVibrationModel.h" #include "wearable_log.h" +#include "language/font/ui_resource_string.h" /* 按优先级分为 1.系统音量 @@ -123,10 +124,11 @@ namespace OHOS Title->SetPosition(93, 52, 280, 40); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetText("声音与震动"); + //Title->SetText("声音与震动"); + Title->SetTextId(STR_SOUND_AND_VIBRATION); Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Title->SetRollSpeed(40); + //Title->SetRollSpeed(40); Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); return true; @@ -152,7 +154,8 @@ namespace OHOS labelButton->SetImageSrc(NextImgSrc, NextImgSrc); labelButton->SetImagePosition(326, 37); } - labelButton->SetText(buttonconfig.Text.c_str()); + //labelButton->SetText(buttonconfig.Text.c_str()); + labelButton->SetTextId(buttonconfig.TextId); labelButton->SetAlign(TEXT_ALIGNMENT_LEFT); labelButton->SetLabelPosition(47, 0); labelButton->SetStyle(STYLE_TEXT_FONT, 30); @@ -171,15 +174,16 @@ namespace OHOS { int y; const char *viewId; - const char *text; + //const char *text; + const int16_t textId; bool clickEffect; }; ButtonSetup buttonSetups[] = { - {120, SYSTEM_VOLUME_BUTTON, "系统音量", true}, - {240, CALL_VOLUME_BUTTON, "通话音量", true}, - {360, VIBRATION_REMINDER_BUTTON, "震动模式", true}, - {480, SILENT_MODE_BUTTON, "静音模式", false}}; + {120, SYSTEM_VOLUME_BUTTON, STR_SYSTEM_VOLUME, true}, + {240, CALL_VOLUME_BUTTON, STR_MEDIA_VOLUME, true}, + {360, VIBRATION_REMINDER_BUTTON, STR_VIBRATION_MODE, true}, + {480, SILENT_MODE_BUTTON, STR_SILENT_MODE, false}}; UILabelButtonExt **buttonPointers[] = {&SystemVolumeButton, &CallVolumeButton, &VibrationReminderButton, &SilentModeButton}; @@ -191,11 +195,13 @@ namespace OHOS .w = 380, .h = 100, .ViewId = buttonSetups[i].viewId, - .Text = buttonSetups[i].text}; + //.Text = buttonSetups[i].text}; + .TextId = buttonSetups[i].textId}; *buttonPointers[i] = SetUpButton_Ext(buttonconfig, buttonSetups[i].clickEffect); if (*buttonPointers[i] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::%s Button new fail!", buttonSetups[i].text); + //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::%s Button new fail!", buttonSetups[i].text); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::Button[%d] new fail!", i); return false; } } 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 283b2fa56..a37dcefb5 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 fc7289d6a..18363434e 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 8eac6e1c1..10c1947a3 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 @@ -280,8 +280,12 @@ enum UIResourceTextId : uint16_t { STR_BLUETOOTH_SERVICE_OPTIONS = 267, STR_HFP = 268, STR_A2DP = 269, - STR_LANGUAGE = 270, - STR_MAX_ID = 271, + STR_SYSTEM_VOLUME = 270, + STR_MEDIA_VOLUME = 271, + STR_VIBRATION_MODE = 272, + STR_SILENT_MODE = 273, + STR_LANGUAGE = 274, + STR_MAX_ID = 275, }; // 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 1c3af03f2..ed6997f92 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