timeLable->SetViewId("label1"); // Set style
timeLable->SetStyle(STYLE_TEXT_FONT, digitsize);
- // Set additional property
+
timeLable->SetText(stringtime.c_str());
timeLable->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
timeLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
sweepClock1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
sweepClock1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
- // Set additional property
+
sweepClock1_->SetWorkMode(UISweepClock::WorkMode::NORMAL);
Image *sweepClock1HourImage = new Image();
std::string HourImagePath = std::string(handspath) + "hour.bin";
weekLable->SetViewId("label2"); // Set style
weekLable->SetStyle(STYLE_TEXT_FONT, fontsize);
- // Set additional property
+
cJSON *weekformat = cJSON_GetObjectItem(displayformat, "weekformat");
std ::string weekStr;
if (weekformat != nullptr && cJSON_IsArray(weekformat))
batteryLable->SetViewId("label3"); // Set style
batteryLable->SetStyle(STYLE_TEXT_FONT, fontsize);
- // Set additional property
+
batteryLable->SetText((std::to_string(value) + "%").c_str());
batteryLable->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
batteryLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
{
changebutton = new UIButton();
}
- changebutton->SetPosition(0, 0); // widget's left position and top position
- changebutton->Resize(466, 466); // widget's width and height
- changebutton->SetViewId(CHANGEBUTTON); // Set style
+ changebutton->SetPosition(0, 0);
+ changebutton->Resize(466, 466);
+ changebutton->SetViewId(CHANGEBUTTON);
changebutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
changebutton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ changebutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+ changebutton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ changebutton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);
+ changebutton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);
- // Set additional property
- changebutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
- changebutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
-
- // Add the CallBack about events
UIView::OnLongPressListener *buttonLongPress = static_cast<UIView::OnLongPressListener *>(MainPresenterSample::GetInstance());
changebutton->SetOnLongPressListener(buttonLongPress);
// Add to rootView