From b9224c1acedf911353156cf926848b90d8f165ae Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Thu, 11 Aug 2022 11:16:57 +0300 Subject: Disable value_str value_str is a way to add text on a button without a separate label. This saves having an extra label object, but uses more memory and is removed in LVGL8 --- src/displayapp/screens/settings/SettingSetTime.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/displayapp/screens/settings/SettingSetTime.cpp') diff --git a/src/displayapp/screens/settings/SettingSetTime.cpp b/src/displayapp/screens/settings/SettingSetTime.cpp index 47b786e4..e7d824fd 100644 --- a/src/displayapp/screens/settings/SettingSetTime.cpp +++ b/src/displayapp/screens/settings/SettingSetTime.cpp @@ -67,13 +67,15 @@ SettingSetTime::SettingSetTime(Pinetime::Applications::DisplayApp* app, btnSetTime->user_data = this; lv_obj_set_size(btnSetTime, 120, 50); lv_obj_align(btnSetTime, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); - lv_obj_set_style_local_value_str(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Set"); + lblSetTime = lv_label_create(btnSetTime, nullptr); + lv_label_set_text_static(lblSetTime, "Set"); lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); - lv_obj_set_style_local_value_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_GRAY); + lv_obj_set_style_local_text_color(lblSetTime, LV_LABEL_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_GRAY); lv_obj_set_event_cb(btnSetTime, SetTimeEventHandler); UpdateScreen(); lv_obj_set_state(btnSetTime, LV_STATE_DISABLED); + lv_obj_set_state(lblSetTime, LV_STATE_DISABLED); } SettingSetTime::~SettingSetTime() { @@ -89,6 +91,7 @@ void SettingSetTime::UpdateScreen() { } } lv_obj_set_state(btnSetTime, LV_STATE_DEFAULT); + lv_obj_set_state(lblSetTime, LV_STATE_DEFAULT); } void SettingSetTime::SetTime() { @@ -104,4 +107,5 @@ void SettingSetTime::SetTime() { 0, nrf_rtc_counter_get(portNRF_RTC_REG)); lv_obj_set_state(btnSetTime, LV_STATE_DISABLED); + lv_obj_set_state(lblSetTime, LV_STATE_DISABLED); } -- cgit v1.2.3-70-g09d2