feat(xml): add support scale, span, roller and bar

Also add some backward compatible API changes
This commit is contained in:
Gabor Kiss-Vamosi
2025-01-22 05:16:00 +08:00
parent b78a9b447a
commit a535063308
56 changed files with 1328 additions and 288 deletions

View File

@@ -283,9 +283,9 @@ static void create_widget1(lv_demo_high_res_ctx_t * c, lv_obj_t * widgets)
lv_obj_t * total_spent_span = lv_spangroup_create(spent_box);
lv_obj_add_style(total_spent_span, &c->fonts[FONT_LABEL_XS], 0);
lv_obj_add_style(total_spent_span, &c->styles[STYLE_COLOR_BASE][STYLE_TYPE_TEXT], 0);
lv_span_t * total_spent_amount = lv_spangroup_new_span(total_spent_span);
lv_span_t * total_spent_amount = lv_spangroup_add_span(total_spent_span);
anim_state->spent_span_small = total_spent_amount;
lv_span_t * total_spent_label = lv_spangroup_new_span(total_spent_span);
lv_span_t * total_spent_label = lv_spangroup_add_span(total_spent_span);
lv_span_set_text_static(total_spent_label, "Total spent");
lv_style_set_text_opa(&total_spent_label->style, LV_OPA_40);
@@ -313,9 +313,9 @@ static void create_widget1(lv_demo_high_res_ctx_t * c, lv_obj_t * widgets)
lv_obj_t * gas_equivalent_span = lv_spangroup_create(spent_box);
lv_obj_add_style(gas_equivalent_span, &c->fonts[FONT_LABEL_XS], 0);
lv_obj_add_style(gas_equivalent_span, &c->styles[STYLE_COLOR_BASE][STYLE_TYPE_TEXT], 0);
lv_span_t * gas_equivalent_amount = lv_spangroup_new_span(gas_equivalent_span);
lv_span_t * gas_equivalent_amount = lv_spangroup_add_span(gas_equivalent_span);
lv_span_set_text_static(gas_equivalent_amount, "$340 - ");
lv_span_t * gas_equivalent_label = lv_spangroup_new_span(gas_equivalent_span);
lv_span_t * gas_equivalent_label = lv_spangroup_add_span(gas_equivalent_span);
lv_span_set_text_static(gas_equivalent_label, "Gas Equivalent");
lv_style_set_text_opa(&gas_equivalent_label->style, LV_OPA_40);
}

View File

@@ -91,16 +91,16 @@ void lv_demo_high_res_home(lv_obj_t * base_obj)
lv_obj_t * date = lv_spangroup_create(date_and_time);
lv_obj_add_style(date, &c->fonts[FONT_HEADING_MD], 0);
lv_obj_add_style(date, &c->styles[STYLE_COLOR_BASE][STYLE_TYPE_TEXT], 0);
lv_spangroup_new_span(date);
lv_span_t * day_and_month = lv_spangroup_new_span(date);
lv_spangroup_add_span(date);
lv_span_t * day_and_month = lv_spangroup_add_span(date);
lv_subject_add_observer_obj(&c->th, theme_observer_accent_span_cb, date, day_and_month);
lv_subject_add_observer_obj(&c->subject_groups.date.group, date_observer_cb, date, c);
lv_obj_t * time = lv_spangroup_create(date_and_time);
lv_obj_add_style(time, &c->fonts[FONT_HEADING_XXL], 0);
lv_obj_add_style(time, &c->styles[STYLE_COLOR_BASE][STYLE_TYPE_TEXT], 0);
lv_spangroup_new_span(time);
lv_span_t * minute = lv_spangroup_new_span(time);
lv_spangroup_add_span(time);
lv_span_t * minute = lv_spangroup_add_span(time);
lv_subject_add_observer_obj(&c->th, theme_observer_accent_span_cb, time, minute);
lv_subject_add_observer_obj(&c->subject_groups.time.group, time_observer_cb, time, c);

View File

@@ -829,21 +829,16 @@ static void analytics_create(lv_obj_t * parent)
lv_scale_section_t * section;
section = lv_scale_add_section(scale3);
lv_scale_section_set_range(section, 0, 20);
lv_scale_section_set_style(section, LV_PART_MAIN, &scale3_section1_main_style);
lv_scale_section_set_style(section, LV_PART_INDICATOR, &scale3_section1_indicator_style);
lv_scale_section_set_style(section, LV_PART_ITEMS, &scale3_section1_tick_style);
section = lv_scale_add_section(scale3);
lv_scale_section_set_range(section, 20, 40);
lv_scale_section_set_style(section, LV_PART_MAIN, &scale3_section2_main_style);
lv_scale_section_set_style(section, LV_PART_INDICATOR, &scale3_section2_indicator_style);
lv_scale_section_set_style(section, LV_PART_ITEMS, &scale3_section2_tick_style);
lv_scale_set_section_range(scale3, section, 0, 20);
lv_scale_set_section_style_main(scale3, section, &scale3_section2_main_style);
lv_scale_set_section_style_indicator(scale3, section, &scale3_section2_indicator_style);
lv_scale_set_section_style_items(scale3, section, &scale3_section2_tick_style);
section = lv_scale_add_section(scale3);
lv_scale_section_set_range(section, 40, 60);
lv_scale_section_set_style(section, LV_PART_MAIN, &scale3_section3_main_style);
lv_scale_section_set_style(section, LV_PART_INDICATOR, &scale3_section3_indicator_style);
lv_scale_section_set_style(section, LV_PART_ITEMS, &scale3_section3_tick_style);
lv_scale_set_section_range(scale3, section, 40, 60);
lv_scale_set_section_style_main(scale3, section, &scale3_section3_main_style);
lv_scale_set_section_style_indicator(scale3, section, &scale3_section3_indicator_style);
lv_scale_set_section_style_items(scale3, section, &scale3_section3_tick_style);
LV_IMAGE_DECLARE(img_demo_widgets_needle);
scale3_needle = lv_image_create(scale3);