diff --git a/src/displayapp/screens/CheckboxList.cpp b/src/displayapp/screens/CheckboxList.cpp index 9eb80bbad4..9693a5c1da 100644 --- a/src/displayapp/screens/CheckboxList.cpp +++ b/src/displayapp/screens/CheckboxList.cpp @@ -1,6 +1,7 @@ #include "displayapp/DisplayApp.h" #include "displayapp/screens/CheckboxList.h" #include "displayapp/screens/Styles.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -17,7 +18,8 @@ CheckboxList::CheckboxList(const uint8_t screenID, const char* optionsSymbol, uint32_t originalValue, std::function OnValueChanged, - std::array options) + std::array options, + const char* optionsHelptext) : screenID {screenID}, OnValueChanged {std::move(OnValueChanged)}, options {options}, @@ -53,6 +55,17 @@ CheckboxList::CheckboxList(const uint8_t screenID, lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); + lv_obj_t* helptext; + if (optionsHelptext != nullptr) { + helptext = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_align(helptext, LV_LABEL_ALIGN_CENTER); + lv_label_set_long_mode(helptext, LV_LABEL_LONG_SROLL_CIRC); + lv_obj_set_width(helptext, LV_HOR_RES); + lv_obj_set_style_local_text_color(helptext, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + lv_label_set_text_static(helptext, optionsHelptext); + lv_obj_align(helptext, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); + } + for (unsigned int i = 0; i < options.size(); i++) { if (strcmp(options[i].name, "")) { cbOption[i] = lv_checkbox_create(container1, nullptr); diff --git a/src/displayapp/screens/CheckboxList.h b/src/displayapp/screens/CheckboxList.h index c6119970a1..3e57f7f21f 100644 --- a/src/displayapp/screens/CheckboxList.h +++ b/src/displayapp/screens/CheckboxList.h @@ -27,7 +27,8 @@ namespace Pinetime { const char* optionsSymbol, uint32_t originalValue, std::function OnValueChanged, - std::array options); + std::array options, + const char* optionsHelptext = nullptr); ~CheckboxList() override; void UpdateSelected(lv_obj_t* object, lv_event_t event); diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 0d5168d26f..7992191958 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -8,6 +8,7 @@ using namespace Pinetime::Applications::Screens; constexpr const char* SettingWatchFace::title; constexpr const char* SettingWatchFace::symbol; +constexpr const char* SettingWatchFace::helptext; namespace { uint32_t IndexOf(const std::array SettingWatchFace::CreateScreen(unsigned int screenNum) const { std::array watchfacesOnThisScreen; + bool needsHelptext = false; for (int i = 0; i < settingsPerScreen; i++) { if (i + (screenNum * settingsPerScreen) >= watchfaceItems.size()) { watchfacesOnThisScreen[i] = {"", false}; } else { auto& item = watchfaceItems[i + (screenNum * settingsPerScreen)]; watchfacesOnThisScreen[i] = Screens::CheckboxList::Item {item.name, item.enabled}; + needsHelptext |= !item.enabled; } } @@ -89,5 +92,6 @@ std::unique_ptr SettingWatchFace::CreateScreen(unsigned int screenNum) c settings.SetWatchFace(IndexToWatchFace(watchfaceItems, index)); settings.SaveSettings(); }, - watchfacesOnThisScreen); + watchfacesOnThisScreen, + needsHelptext ? helptext : nullptr); } diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 9edc1f7ac8..a34a05382b 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -46,6 +46,7 @@ namespace Pinetime { static constexpr const char* title = "Watch face"; static constexpr const char* symbol = Symbols::home; + static constexpr const char* helptext = " Resources missing! Install resource pack to use greyed out watch faces."; ScreenList screens; };