diff --git a/tactility/src/apps/desktop/desktop.c b/tactility/src/apps/desktop/desktop.c index b9e552eb..879b55c4 100644 --- a/tactility/src/apps/desktop/desktop.c +++ b/tactility/src/apps/desktop/desktop.c @@ -11,7 +11,7 @@ static void on_app_pressed(lv_event_t* e) { } } -static void create_app_widget(const AppManifest* manifest, void* _Nullable parent) { +static void create_app_widget(const AppManifest* manifest, void* parent) { tt_check(parent); lv_obj_t* list = (lv_obj_t*)parent; lv_obj_t* btn = lv_list_add_btn(list, LV_SYMBOL_FILE, manifest->name); diff --git a/tactility/src/apps/settings/settings.c b/tactility/src/apps/settings/settings.c index c74bdd02..429954f9 100644 --- a/tactility/src/apps/settings/settings.c +++ b/tactility/src/apps/settings/settings.c @@ -11,14 +11,14 @@ static void on_app_pressed(lv_event_t* e) { } } -static void create_app_widget(const AppManifest* manifest, void* _Nullable parent) { +static void create_app_widget(const AppManifest* manifest, void* parent) { tt_check(parent); lv_obj_t* list = (lv_obj_t*)parent; lv_obj_t* btn = lv_list_add_btn(list, LV_SYMBOL_FILE, manifest->name); lv_obj_add_event_cb(btn, &on_app_pressed, LV_EVENT_CLICKED, (void*)manifest); } -static void on_show(TT_UNUSED App app, TT_UNUSED lv_obj_t* parent) { +static void on_show(TT_UNUSED App app, lv_obj_t* parent) { lv_obj_t* list = lv_list_create(parent); lv_obj_set_size(list, LV_PCT(100), LV_PCT(100)); lv_obj_center(list); diff --git a/tactility/src/ui/toolbar.c b/tactility/src/ui/toolbar.c index 6b09f684..10a8d7bc 100644 --- a/tactility/src/ui/toolbar.c +++ b/tactility/src/ui/toolbar.c @@ -22,6 +22,9 @@ lv_obj_t* tt_lv_toolbar_create(lv_obj_t* parent, const Toolbar* toolbar) { lv_obj_center(wrapper); lv_obj_set_flex_flow(wrapper, LV_FLEX_FLOW_ROW); + lv_coord_t title_offset_x = (TOOLBAR_HEIGHT - TOOLBAR_FONT_HEIGHT - 8) / 4 * 3; + lv_coord_t title_offset_y = (TOOLBAR_HEIGHT - TOOLBAR_FONT_HEIGHT - 8) / 2; + lv_obj_t* close_button = lv_btn_create(wrapper); lv_obj_set_size(close_button, TOOLBAR_HEIGHT - 4, TOOLBAR_HEIGHT - 4); tt_lv_obj_set_style_no_padding(close_button); @@ -31,7 +34,7 @@ lv_obj_t* tt_lv_toolbar_create(lv_obj_t* parent, const Toolbar* toolbar) { lv_obj_align(close_button_image, LV_ALIGN_CENTER, 0, 0); // Need spacer to avoid button press glitch animation - tt_lv_spacer_create(wrapper, 2, 1); + tt_lv_spacer_create(wrapper, title_offset_x, 1); lv_obj_t* label_container = lv_obj_create(wrapper); tt_lv_obj_set_style_no_padding(label_container); @@ -42,9 +45,10 @@ lv_obj_t* tt_lv_toolbar_create(lv_obj_t* parent, const Toolbar* toolbar) { lv_obj_t* title_label = lv_label_create(label_container); lv_label_set_text(title_label, toolbar->title); lv_obj_set_style_text_font(title_label, &lv_font_montserrat_18, 0); // TODO replace with size 18 - lv_obj_set_size(title_label, LV_PCT(100), TOOLBAR_FONT_HEIGHT); - lv_obj_set_pos(title_label, 0, (TOOLBAR_HEIGHT - TOOLBAR_FONT_HEIGHT - 10) / 2); - lv_obj_set_style_text_align(title_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_height(title_label, TOOLBAR_FONT_HEIGHT); + + lv_obj_set_pos(title_label, 0, title_offset_y); + lv_obj_set_style_text_align(title_label, LV_TEXT_ALIGN_LEFT, 0); return wrapper; }