#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;
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);
}
}
- 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];
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)
{
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)
{
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
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);
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);