From 3e5ad49e3a27e0238dc8cd473f8743bf2e8d73b0 Mon Sep 17 00:00:00 2001 From: Tim Taenny Date: Fri, 9 Jul 2021 17:46:17 +0200 Subject: [PATCH] Code optimizations in SettingSetDate Using static method of DateTimeController for retrieving month texts instead of implementing it in SettingSetDate again. --- .../screens/settings/SettingSetDate.cpp | 43 +------------------ 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/src/displayapp/screens/settings/SettingSetDate.cpp b/src/displayapp/screens/settings/SettingSetDate.cpp index 7fe0022e..fe71cd85 100644 --- a/src/displayapp/screens/settings/SettingSetDate.cpp +++ b/src/displayapp/screens/settings/SettingSetDate.cpp @@ -209,47 +209,8 @@ void SettingSetDate::CheckDay() { } void SettingSetDate::UpdateMonthLabel() { - switch (monthValue) { - case 1: - lv_label_set_text_static(lblMonth, "Jan"); - break; - case 2: - lv_label_set_text_static(lblMonth, "Feb"); - break; - case 3: - lv_label_set_text_static(lblMonth, "Mar"); - break; - case 4: - lv_label_set_text_static(lblMonth, "Apr"); - break; - case 5: - lv_label_set_text_static(lblMonth, "May"); - break; - case 6: - lv_label_set_text_static(lblMonth, "Jun"); - break; - case 7: - lv_label_set_text_static(lblMonth, "Jul"); - break; - case 8: - lv_label_set_text_static(lblMonth, "Aug"); - break; - case 9: - lv_label_set_text_static(lblMonth, "Sep"); - break; - case 10: - lv_label_set_text_static(lblMonth, "Oct"); - break; - case 11: - lv_label_set_text_static(lblMonth, "Nov"); - break; - case 12: - lv_label_set_text_static(lblMonth, "Dec"); - break; - default: - lv_label_set_text_static(lblMonth, "---"); - break; - } + lv_label_set_text_static(lblMonth, + Pinetime::Controllers::DateTime::MonthShortToStringLow(static_cast(monthValue))); lv_label_set_align(lblMonth, LV_LABEL_ALIGN_CENTER); lv_obj_align(lblMonth, lv_scr_act(), LV_ALIGN_CENTER, POS_X_MONTH, POS_Y_TEXT); }