From: hcj <1224667075@qq.com>
Date: Thu, 29 Aug 2024 04:02:51 +0000 (+0800)
Subject: 低电量自动关机UI修改
X-Git-Tag: release_V1.2.70_20241020_135402~550^2~2^2~8
X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=dff40dc170415fdee9a0896b6be2db78571eda59;p=mirrors%2FFD230.git
低电量自动关机UI修改
---
diff --git a/code/sdk/application/battery/service/battery_service.cpp b/code/sdk/application/battery/service/battery_service.cpp
index f18191536..9560c8353 100644
--- a/code/sdk/application/battery/service/battery_service.cpp
+++ b/code/sdk/application/battery/service/battery_service.cpp
@@ -82,7 +82,7 @@ static unsigned long g_app_queue;
#define BATTERY_CMD_CHARGE_PLUG 0x13
#define BATTERY_CMD_CHARGE_UNPLUG 0x14
-#define BATTERY_LOWPOWER_ALARM_POWERLEVEL 15
+#define BATTERY_LOWPOWER_ALARM_POWERLEVEL 10
#define BATTERY_LOWPOWER_ALARM_SHUTDOWNLEVEL 5
#define BATTERY_DISABLE_CHARGE_HI_TEMP_VALUE (50.0f) //忢å
çµæ¸©åº¦
@@ -443,6 +443,10 @@ errcode_t Play_shutdown_animation_notify(uint8_t alarm_level)
low_power_flag_2=0;
ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
}
+ else
+ {
+ ChargerEventPublish(TOPIC_EVENT_LOWPOWER_ALARM,alarm_level);
+ }
diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h
index d67039d45..15c30fae8 100644
--- a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h
+++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h
@@ -558,12 +558,14 @@ enum UIResourceTextId : uint16_t {
STR_GOAL_HINT = 545,
STR_SLEEPMODE = 546,
STR_SLEEP_MODE_PROMPT_ON = 547,
- STR_MAX_ID = 548,
+ STR_LOW_POWER_NOTIF_1 = 548,
+ STR_LOW_POWER_NOTIF_2 = 549,
+ STR_MAX_ID = 550,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
- LANGUAGE_ID_ZH,
LANGUAGE_ID_EN,
+ LANGUAGE_ID_ZH,
LANGUAGE_ID_MAX
}; // UITextLanguageTextId
}
diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp
index 77845d1dd..2040067dc 100644
--- a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp
+++ b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp
@@ -13,6 +13,11 @@
#include "linux/delay.h"
#include "components/ui_circle_progress.h"
#include "battery_hal.h"
+#include "uicomponents/UIComponents.h"
+
+
+//#include "ui_resource_string.h"
+
namespace OHOS
{
UIImageView *imageCharge = nullptr;
@@ -241,6 +246,7 @@ namespace OHOS
UILabel_Chargeing->SetViewId("label4");// Set style
UILabel_Chargeing->SetStyle(STYLE_TEXT_FONT, 30);
UILabel_Chargeing->SetText("æ£å¨å
çµ");
+ UILabel_Chargeing->SetTextId(STR_CHARGE);
UILabel_Chargeing->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
UILabel_Chargeing->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff));
UILabel_Chargeing->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
@@ -302,7 +308,7 @@ namespace OHOS
}
}
- static const char ** CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
+ static const char ** CreateImagePathsArray_(const char *basePath, const char *fileExtension, int numImages)
{
const char **imagePaths = new const char *[numImages];
char buffer[256];
@@ -326,7 +332,7 @@ namespace OHOS
group->SetPosition(0, 0, 466, 466);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownAnimatorView::ShowUpShutDownAnimatorView");
- ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, "bin", SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ ShutDownPathsArray = CreateImagePathsArray_(ShutDownPaths, "bin", SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
if (ShutDownImageAnimatorView == nullptr)
{
@@ -416,16 +422,17 @@ namespace OHOS
UIViewGroup_lowpower = nullptr;
}
}
- static uint8_t timer_falg_low_power=5;
+ static uint8_t timer_falg_low_power=6;
void low_power_TimerCallBack(int data)
{
//uapi_poweroff_device(); // å
³æº
if(timer_falg_low_power)
{
timer_falg_low_power--;
- char buf[34]={0};
- sprintf(buf,"çµéè¿ä½%dsåå°èªå¨å
³æº",timer_falg_low_power);
- alarm_UILabel->SetText(buf);
+ // char buf[34]={0};
+ // sprintf(buf,"çµéè¿ä½%dsåå°èªå¨å
³æº",timer_falg_low_power);
+ // alarm_UILabel->SetText(buf);
+ UpdateLabel(alarm_UILabel, timer_falg_low_power, STR_LOW_POWER_NOTIF_2);
RootView::GetInstance()->Invalidate();
if(timer_falg_low_power==0)
{
@@ -469,12 +476,12 @@ namespace OHOS
if (alarm_img == nullptr) {
alarm_img = new UIImageView();
}
- alarm_img->SetPosition(183, 62); // widget's left position and top position
+ alarm_img->SetPosition(171, 155); // widget's left position and top position
alarm_img->Resize(100, 100); // widget's width and height
alarm_img->SetViewId("image1");// Set style
// Set additional property
- const char *imageimagesPath = "/user/res/Attention.bin";
+ const char *imageimagesPath = "/user/res/lowpower.bin";
alarm_img->SetSrc(imageimagesPath);
// Add to rootView
@@ -488,23 +495,31 @@ namespace OHOS
alarm_UILabel->SetPosition(101, 215); // widget's left position and top position
alarm_UILabel->Resize(466, 212); // widget's width and height
alarm_UILabel->SetViewId("label1");// Set style
- alarm_UILabel->SetStyle(STYLE_TEXT_FONT, 33);
+ alarm_UILabel->SetStyle(STYLE_TEXT_FONT, 30);
// Set additional property
if(battery_falg==0)
{
- alarm_UILabel->SetText("è¯·åæ¶è¿æ¥å
çµå¨");
- alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ alarm_UILabel->SetPosition(110, 252); // widget's left position and top position
+ alarm_UILabel->Resize(245, 70); // widget's width and height
+
+ alarm_UILabel->SetText("å½åçµéä½äº10%è¯·åæ¶å
çµ");
+ alarm_UILabel->SetTextId(STR_LOW_POWER_NOTIF_1);
+
+ alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
alarm_UILabel->SetRollSpeed(0);
- alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33);
+ alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
}
// Set additional property
if(battery_falg==1)
{
- alarm_UILabel->SetPosition(50, 215);
- alarm_UILabel->SetText("çµéè¿ä½5såå°èªå¨å
³æº");
- alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ alarm_UILabel->SetPosition(110, 252);
+ alarm_UILabel->Resize(245, 70); // widget's width and height
+ //alarm_UILabel->SetText("å½åçµéä½äº5%,å°èªå¨å
³æº");
+ alarm_UILabel->SetTextId(STR_LOW_POWER_NOTIF_2);
+ UpdateLabel(alarm_UILabel, 5, STR_LOW_POWER_NOTIF_2);
+ alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
alarm_UILabel->SetRollSpeed(0);
alarm_UILabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 33);
@@ -538,6 +553,7 @@ namespace OHOS
alarm_labelbutton->SetImageSrc(ImgSrc, ImgSrc);
// Set additional property
alarm_labelbutton->SetText("确认");
+ alarm_labelbutton->SetTextId(STR_KONW);
alarm_labelbutton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 44);
alarm_labelbutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
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 65fbcaddb..ec7c766ad 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/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 d67039d45..15c30fae8 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
@@ -558,12 +558,14 @@ enum UIResourceTextId : uint16_t {
STR_GOAL_HINT = 545,
STR_SLEEPMODE = 546,
STR_SLEEP_MODE_PROMPT_ON = 547,
- STR_MAX_ID = 548,
+ STR_LOW_POWER_NOTIF_1 = 548,
+ STR_LOW_POWER_NOTIF_2 = 549,
+ STR_MAX_ID = 550,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
- LANGUAGE_ID_ZH,
LANGUAGE_ID_EN,
+ LANGUAGE_ID_ZH,
LANGUAGE_ID_MAX
}; // UITextLanguageTextId
}
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 94677db74..b7ed3def0 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
diff --git a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c
index dfd0d2ecd..5aaec82c5 100644
--- a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c
+++ b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c
@@ -1044,6 +1044,7 @@ static uint32_t PBAP_LS(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
#include "bletest.h"
#include "dial_sos_c.h"
+#include "battery_service.h"
static uint32_t BLE_TEST(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
{
@@ -1094,6 +1095,10 @@ static uint32_t BLE_TEST(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
case 10:
start_SOS_phone_dail();
break;
+ case 11:
+ low_power_play_toUI(atoi( (char *)argv[1]));
+ break;
+
default:
break;
}
diff --git a/tools/language_tool/Language_xml/input_list_en.txt b/tools/language_tool/Language_xml/input_list_en.txt
index d6af90618..8e742b91a 100644
--- a/tools/language_tool/Language_xml/input_list_en.txt
+++ b/tools/language_tool/Language_xml/input_list_en.txt
@@ -545,4 +545,6 @@ STR_NUMBER_OF_STANDS$Number of stands
STR_CONSUME_CALORIES$consume calories
STR_GOAL_HINT$For goal Settings and more data, please visit the mobile APP
STR_SLEEPMODE$Sleep mode
-STR_SLEEP_MODE_PROMPT_ON$Turn on sleep mode, and the watch will disable all reminders
\ No newline at end of file
+STR_SLEEP_MODE_PROMPT_ON$Turn on sleep mode, and the watch will disable all reminders
+STR_LOW_POWER_NOTIF_1$The current battery is below 10%, please charge it in time
+STR_LOW_POWER_NOTIF_2$When the battery is too low XXs will automatically shut down
\ No newline at end of file
diff --git a/tools/language_tool/Language_xml/input_list_zh.txt b/tools/language_tool/Language_xml/input_list_zh.txt
index 50bed8a31..289a9362c 100644
--- a/tools/language_tool/Language_xml/input_list_zh.txt
+++ b/tools/language_tool/Language_xml/input_list_zh.txt
@@ -545,4 +545,6 @@ STR_NUMBER_OF_STANDS$ç«ç«æ¬¡æ°
STR_CONSUME_CALORIES$æ¶èå¡è·¯é
STR_GOAL_HINT$ç®æ è®¾ç½®åæ´å¤æ°æ®è¯·å徿æºAPPæ¥ç
STR_SLEEPMODE$ç¡ç 模å¼
-STR_SLEEP_MODE_PROMPT_ON$å¼å¯ç¡ç 模å¼ï¼æè¡¨å°ç¦ç¨æææéå¹¶å¼å¯ç¡ç çæµ
\ No newline at end of file
+STR_SLEEP_MODE_PROMPT_ON$å¼å¯ç¡ç 模å¼ï¼æè¡¨å°ç¦ç¨æææéå¹¶å¼å¯ç¡ç çæµ
+STR_LOW_POWER_NOTIF_1$å½åçµéä½äº10%è¯·åæ¶å
çµ
+STR_LOW_POWER_NOTIF_2$çµéè¿ä½XXsåå°èªå¨å
³æº
\ No newline at end of file
diff --git a/tools/language_tool/Language_xml/language.xlsx b/tools/language_tool/Language_xml/language.xlsx
index 999cdd385..2d718c10c 100644
Binary files a/tools/language_tool/Language_xml/language.xlsx and b/tools/language_tool/Language_xml/language.xlsx differ
diff --git a/tools/language_tool/Language_xml/language_en.xml b/tools/language_tool/Language_xml/language_en.xml
index f1ac1cf84..97ff6df9a 100644
--- a/tools/language_tool/Language_xml/language_en.xml
+++ b/tools/language_tool/Language_xml/language_en.xml
@@ -547,4 +547,6 @@
+
+
diff --git a/tools/language_tool/Language_xml/language_zh.xml b/tools/language_tool/Language_xml/language_zh.xml
index e3658d882..3b55c48ee 100644
--- a/tools/language_tool/Language_xml/language_zh.xml
+++ b/tools/language_tool/Language_xml/language_zh.xml
@@ -547,4 +547,6 @@
+
+
diff --git a/tools/language_tool/font/en.lang b/tools/language_tool/font/en.lang
index 65fbcaddb..ec7c766ad 100644
Binary files a/tools/language_tool/font/en.lang and b/tools/language_tool/font/en.lang differ
diff --git a/tools/language_tool/font/ui_resource_string.h b/tools/language_tool/font/ui_resource_string.h
index d67039d45..15c30fae8 100644
--- a/tools/language_tool/font/ui_resource_string.h
+++ b/tools/language_tool/font/ui_resource_string.h
@@ -558,12 +558,14 @@ enum UIResourceTextId : uint16_t {
STR_GOAL_HINT = 545,
STR_SLEEPMODE = 546,
STR_SLEEP_MODE_PROMPT_ON = 547,
- STR_MAX_ID = 548,
+ STR_LOW_POWER_NOTIF_1 = 548,
+ STR_LOW_POWER_NOTIF_2 = 549,
+ STR_MAX_ID = 550,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
- LANGUAGE_ID_ZH,
LANGUAGE_ID_EN,
+ LANGUAGE_ID_ZH,
LANGUAGE_ID_MAX
}; // UITextLanguageTextId
}
diff --git a/tools/language_tool/font/zh.lang b/tools/language_tool/font/zh.lang
index 94677db74..b7ed3def0 100644
Binary files a/tools/language_tool/font/zh.lang and b/tools/language_tool/font/zh.lang differ