{
if (UIViewGroup_charge != nullptr)
{
-
if (Chargeing_timer)
{
osTimerStop(Chargeing_timer);
osTimerDelete(Chargeing_timer);
Chargeing_timer = NULL;
}
-
UIViewGroup_charge->RemoveAll();
-
if (batteryprogress)
{
delete batteryprogress;
}
}
+ // 显示充电提醒弹窗
UIViewGroup *ShowChargeingView(void)
{
-
if (UIViewGroup_charge == nullptr)
{
UIViewGroup_charge = new UIViewGroup();
UIViewGroup_charge->SetPosition(0, 0, 466, 466);
- // UIViewGroup_charge->SetStyle(STYLE_BACKGROUND_OPA, 0);
}
UIViewGroup_charge->SetViewId(CHARGE_GROUP);
UIViewGroup_charge->SetTouchable(true);
#ifdef SUPPORT_BATTERY_SERVICE
power = battery_get_voltage(&voltage);
#endif
-
char buf[16] = {0};
sprintf(buf, "%d%c", power, '%');
- // printf("power:%s\r\n",buf);
-
time_t currtime;
struct tm *timeinfo;
time(&currtime);
timeinfo = localtime(&currtime);
-
char time_buf[16] = {0};
sprintf_s(time_buf, 16, "%02d:%02d", timeinfo->tm_hour, timeinfo->tm_min);
-
if (batteryprogress == nullptr)
{
batteryprogress = new UICircleProgress();
}
batteryprogress->SetPosition(123, 123,224,222);
- batteryprogress->SetViewId("circleProgress1");
batteryprogress->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
-
- // Set additional property
- // Set BackgroundStyle
batteryprogress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
batteryprogress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0x05);
batteryprogress->SetBackgroundStyle(STYLE_BORDER_OPA, 0x07);
batteryprogress->SetBackgroundStyle(STYLE_LINE_OPA, 0x07);
batteryprogress->SetBackgroundStyle(STYLE_LINE_WIDTH, 22);
- // Set ForegroundStyle
batteryprogress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195F6);
batteryprogress->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff000000);
batteryprogress->SetForegroundStyle(STYLE_LINE_COLOR, 0xff4FC34C);
batteryprogress->SetValue(power);
batteryprogress->SetVisible(true);
// batteryprogress->SetCapType(CAP_ROUND); 不使用圆形边缘
-
+ /* -------------------------------------------------------------------------- */
if (image_lightning == nullptr)
{
image_lightning = new UIImageView();
}
image_lightning->SetPosition(207, 176);
image_lightning->Resize(70, 60);
- image_lightning->SetViewId("image2");
image_lightning->SetStyle(STYLE_BORDER_COLOR, 0xff191919);
char *image2imagesPath = "/user/res/solar-energy_1.bin";
image_lightning->SetSrc(image2imagesPath);
image_lightning->SetVisible(true);
-
+ /* -------------------------------------------------------------------------- */
if (image_circle == nullptr)
{
image_circle = new UIImageView();
}
image_circle->SetPosition(126, 125);
image_circle->Resize(194, 194);
- image_circle->SetViewId("image1");
char *image1imagesPath = "/user/res/Ellipse_37.bin";
image_circle->SetSrc(image1imagesPath);
image_circle->SetVisible(true);
-
+ /* -------------------------------------------------------------------------- */
if (UILabel_power == nullptr)
{
UILabel_power = new UILabelExt();
}
UILabel_power->SetPosition(133, 252);
UILabel_power->Resize(200, 60);
- UILabel_power->SetViewId("label5");
UILabel_power->SetStyle(STYLE_TEXT_FONT, 40);
-
UILabel_power->SetText(buf);
UILabel_power->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
UILabel_power->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
UILabel_power->SetRollSpeed(0);
UILabel_power->SetFont(GILROY_BOLD_FONT, 40);
UILabel_power->SetVisible(true);
-
+ /* -------------------------------------------------------------------------- */
if (UILabel_Chargeing == nullptr)
{
UILabel_Chargeing = new UILabelExt();
}
UILabel_Chargeing->SetPosition(133, 356);
UILabel_Chargeing->Resize(200, 60);
- UILabel_Chargeing->SetViewId("label4");
UILabel_Chargeing->SetStyle(STYLE_TEXT_FONT, 30);
// UILabel_Chargeing->SetText("正在充电");
// UILabel_Chargeing->SetTextId(STR_CHARGE);
UILabel_Chargeing->SetRollSpeed(0);
UILabel_Chargeing->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);
UILabel_Chargeing->SetVisible(true);
-
+ /* -------------------------------------------------------------------------- */
if (UILabel_time == nullptr)
{
UILabel_time = new UILabelExt();
UILabel_time->SetRollSpeed(0);
UILabel_time->SetFont(GILROY_BOLD_FONT, 40);
UILabel_time->SetVisible(true);
-
+ /* -------------------------------------------------------------------------- */
+ if (Chargeing_timer)
+ {
+ osTimerStop(Chargeing_timer);
+ osTimerDelete(Chargeing_timer);
+ Chargeing_timer = NULL;
+ }
osStatus_t retTimer;
Chargeing_timer = osTimerNew((osTimerFunc_t)Chargeing_Timer_CallBack, osTimerPeriodic, NULL, NULL);
retTimer = osTimerStart(Chargeing_timer, 1000 * 1);
osTimerDelete(Chargeing_timer);
Chargeing_timer = NULL;
}
-
UIViewGroup_charge->Add(image_lightning);
UIViewGroup_charge->Add(image_circle);
-
UIViewGroup_charge->Add(batteryprogress);
-
UIViewGroup_charge->Add(UILabel_time);
UIViewGroup_charge->Add(UILabel_power);
UIViewGroup_charge->Add(UILabel_Chargeing);
-
g_onKeyActListener = RootView::GetInstance()->GetOnKeyActListener();
RootView::GetInstance()->SetOnKeyActListener(lowppowrViewEventListener::GetInstance());
NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeChargePower);