mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-02 01:18:04 +08:00
feat(demos): allow specifying parent for widgets and music demos (#9444)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
Signed-off-by: bjsylvia <bjsylvia@163.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
**********************/
|
||||
static lv_obj_t * ctrl;
|
||||
static lv_obj_t * list;
|
||||
static uint32_t music_height;
|
||||
|
||||
static const char * title_list[] = {
|
||||
"Waiting for true love",
|
||||
@@ -116,10 +117,25 @@ static const uint32_t time_list[] = {
|
||||
|
||||
void lv_demo_music(void)
|
||||
{
|
||||
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x343247), 0);
|
||||
lv_demo_args_t args;
|
||||
lv_demo_args_init(&args);
|
||||
lv_demo_music_with_args(&args);
|
||||
}
|
||||
|
||||
list = lv_demo_music_list_create(lv_screen_active());
|
||||
ctrl = lv_demo_music_main_create(lv_screen_active());
|
||||
void lv_demo_music_with_args(const lv_demo_args_t * args)
|
||||
{
|
||||
LV_ASSERT_NULL(args);
|
||||
|
||||
lv_obj_t * root = lv_obj_create(args->parent);
|
||||
lv_obj_remove_style_all(root);
|
||||
lv_obj_set_size(root, lv_pct(100), lv_pct(100));
|
||||
lv_obj_set_style_bg_opa(root, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_bg_color(root, lv_color_hex(0x343247), 0);
|
||||
lv_obj_update_layout(root);
|
||||
|
||||
list = lv_demo_music_list_create(root);
|
||||
ctrl = lv_demo_music_main_create(root);
|
||||
music_height = lv_obj_get_height(root);
|
||||
|
||||
#if LV_DEMO_MUSIC_AUTO_PLAY
|
||||
lv_timer_create(auto_step_cb, 1000, NULL);
|
||||
@@ -184,14 +200,14 @@ static void auto_step_cb(lv_timer_t * t)
|
||||
break;
|
||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||
case 11:
|
||||
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
||||
lv_obj_scroll_by(ctrl, 0, -music_height, LV_ANIM_ON);
|
||||
break;
|
||||
case 13:
|
||||
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
||||
lv_obj_scroll_by(ctrl, 0, -music_height, LV_ANIM_ON);
|
||||
break;
|
||||
#else
|
||||
case 12:
|
||||
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
||||
lv_obj_scroll_by(ctrl, 0, -music_height, LV_ANIM_ON);
|
||||
break;
|
||||
#endif
|
||||
case 15:
|
||||
@@ -204,11 +220,11 @@ static void auto_step_cb(lv_timer_t * t)
|
||||
lv_demo_music_play(1);
|
||||
break;
|
||||
case 19:
|
||||
lv_obj_scroll_by(ctrl, 0, LV_VER_RES, LV_ANIM_ON);
|
||||
lv_obj_scroll_by(ctrl, 0, music_height, LV_ANIM_ON);
|
||||
break;
|
||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||
case 20:
|
||||
lv_obj_scroll_by(ctrl, 0, LV_VER_RES, LV_ANIM_ON);
|
||||
lv_obj_scroll_by(ctrl, 0, music_height, LV_ANIM_ON);
|
||||
break;
|
||||
#endif
|
||||
case 30:
|
||||
|
||||
@@ -36,6 +36,11 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
void lv_demo_music(void);
|
||||
/**
|
||||
* Create the music demo with custom arguments.
|
||||
* @param args Pointer to demo arguments structure containing the parent widget and other options.
|
||||
*/
|
||||
void lv_demo_music_with_args(const lv_demo_args_t * args);
|
||||
const char * lv_demo_music_get_title(uint32_t track_id);
|
||||
const char * lv_demo_music_get_artist(uint32_t track_id);
|
||||
const char * lv_demo_music_get_genre(uint32_t track_id);
|
||||
|
||||
@@ -106,7 +106,7 @@ lv_obj_t * lv_demo_music_list_create(lv_obj_t * parent)
|
||||
#endif
|
||||
lv_style_init(&style_button_pr);
|
||||
lv_style_set_bg_opa(&style_button_pr, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&style_button_pr, lv_color_hex(0x4c4965));
|
||||
lv_style_set_bg_color(&style_button_pr, lv_color_hex(0x4c4965));
|
||||
|
||||
lv_style_init(&style_button_chk);
|
||||
lv_style_set_bg_opa(&style_button_chk, LV_OPA_COVER);
|
||||
@@ -132,7 +132,7 @@ lv_obj_t * lv_demo_music_list_create(lv_obj_t * parent)
|
||||
list = lv_obj_create(parent);
|
||||
lv_obj_add_event_cb(list, list_delete_event_cb, LV_EVENT_DELETE, NULL);
|
||||
lv_obj_remove_style_all(list);
|
||||
lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES - LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_size(list, lv_pct(100), lv_obj_get_content_height(parent) - LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_y(list, LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_add_style(list, &style_scrollbar, LV_PART_SCROLLBAR);
|
||||
lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#define BAR_COLOR2_STOP 100
|
||||
#define BAR_REST_RADIUS 82
|
||||
#endif
|
||||
#define BAR_COLOR3_STOP (LV_MAX(LV_HOR_RES, LV_VER_RES) / 3)
|
||||
#define BAR_CNT 20
|
||||
#define DEG_STEP (180/BAR_CNT)
|
||||
#define BAND_CNT 4
|
||||
@@ -98,6 +97,9 @@ static lv_obj_t * play_obj;
|
||||
static const uint16_t (* spectrum)[4];
|
||||
static uint32_t spectrum_len;
|
||||
static const uint16_t rnd_array[30] = {994, 285, 553, 11, 792, 707, 966, 641, 852, 827, 44, 352, 146, 581, 490, 80, 729, 58, 695, 940, 724, 561, 124, 653, 27, 292, 557, 506, 382, 199};
|
||||
static uint32_t music_width = 0;
|
||||
static uint32_t music_height = 0;
|
||||
static uint32_t bar_color3_stop = 0;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -106,7 +108,6 @@ static const uint16_t rnd_array[30] = {994, 285, 553, 11, 792, 707, 966, 641, 85
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/*
|
||||
* Callback adapter function to convert parameter types to avoid compile-time
|
||||
* warning.
|
||||
@@ -127,6 +128,10 @@ static void _obj_set_x_anim_cb(void * obj, int32_t x)
|
||||
|
||||
lv_obj_t * lv_demo_music_main_create(lv_obj_t * parent)
|
||||
{
|
||||
music_width = lv_obj_get_content_width(parent);
|
||||
music_height = lv_obj_get_content_height(parent);
|
||||
bar_color3_stop = (LV_MAX(music_width, music_height) / 3);
|
||||
|
||||
font_small = LV_FONT_DEFAULT;
|
||||
font_large = LV_FONT_DEFAULT;
|
||||
|
||||
@@ -165,7 +170,7 @@ lv_obj_t * lv_demo_music_main_create(lv_obj_t * parent)
|
||||
lv_obj_t * handle_box = create_handle(cont);
|
||||
|
||||
#if LV_DEMO_MUSIC_ROUND
|
||||
lv_obj_set_style_pad_hor(cont, LV_HOR_RES / 6, 0);
|
||||
lv_obj_set_style_pad_hor(cont, music_width / 6, 0);
|
||||
#endif
|
||||
|
||||
/*Arrange the content into a grid*/
|
||||
@@ -184,7 +189,7 @@ lv_obj_t * lv_demo_music_main_create(lv_obj_t * parent)
|
||||
LV_GRID_TEMPLATE_LAST
|
||||
};
|
||||
|
||||
grid_rows[1] = LV_VER_RES;
|
||||
grid_rows[1] = music_height;
|
||||
|
||||
lv_obj_set_grid_dsc_array(cont, grid_cols, grid_rows);
|
||||
lv_obj_set_style_grid_row_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, 0);
|
||||
@@ -263,7 +268,7 @@ lv_obj_t * lv_demo_music_main_create(lv_obj_t * parent)
|
||||
|
||||
uint32_t i;
|
||||
lv_anim_set_exec_cb(&a, start_anim_cb);
|
||||
lv_anim_set_values(&a, LV_MAX(LV_HOR_RES, LV_VER_RES) / 2, 0);
|
||||
lv_anim_set_values(&a, LV_MAX(music_width, music_height) / 2, 0);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_bounce);
|
||||
for(i = 0; i < BAR_CNT; i++) {
|
||||
lv_anim_set_delay(&a, INTRO_TIME - 200 + (rnd_array[i] % 200));
|
||||
@@ -290,13 +295,13 @@ lv_obj_t * lv_demo_music_main_create(lv_obj_t * parent)
|
||||
|
||||
/* Create an intro from a logo + label */
|
||||
LV_IMAGE_DECLARE(img_lv_demo_music_logo);
|
||||
lv_obj_t * logo = lv_image_create(lv_screen_active());
|
||||
lv_obj_t * logo = lv_image_create(parent);
|
||||
lv_image_set_src(logo, &img_lv_demo_music_logo);
|
||||
lv_obj_move_to_index(logo, -1);
|
||||
lv_obj_align_to(logo, spectrum_obj, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
#if LV_DEMO_MUSIC_SQUARE == 0 && LV_DEMO_MUSIC_ROUND == 0
|
||||
lv_obj_t * title = lv_label_create(lv_screen_active());
|
||||
lv_obj_t * title = lv_label_create(parent);
|
||||
lv_label_set_text(title, "LVGL Demo\nMusic player");
|
||||
lv_obj_set_style_text_align(title, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_set_style_text_font(title, font_large, 0);
|
||||
@@ -401,9 +406,9 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
|
||||
lv_obj_t * player = lv_obj_create(main_cont);
|
||||
lv_obj_set_y(player, - LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||
lv_obj_set_size(player, LV_HOR_RES, 2 * LV_VER_RES + LV_DEMO_MUSIC_HANDLE_SIZE * 2);
|
||||
lv_obj_set_size(player, music_width, 2 * music_height + LV_DEMO_MUSIC_HANDLE_SIZE * 2);
|
||||
#else
|
||||
lv_obj_set_size(player, LV_HOR_RES, LV_VER_RES + LV_DEMO_MUSIC_HANDLE_SIZE * 2);
|
||||
lv_obj_set_size(player, music_width, music_height + LV_DEMO_MUSIC_HANDLE_SIZE * 2);
|
||||
#endif
|
||||
lv_obj_remove_flag(player, LV_OBJ_FLAG_SNAPPABLE);
|
||||
|
||||
@@ -427,20 +432,20 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
|
||||
lv_obj_remove_style_all(placeholder3);
|
||||
lv_obj_remove_flag(placeholder3, LV_OBJ_FLAG_CLICKABLE);
|
||||
|
||||
lv_obj_set_size(placeholder1, lv_pct(100), LV_VER_RES);
|
||||
lv_obj_set_size(placeholder1, lv_pct(100), music_height);
|
||||
lv_obj_set_y(placeholder1, 0);
|
||||
|
||||
lv_obj_set_size(placeholder2, lv_pct(100), LV_VER_RES);
|
||||
lv_obj_set_y(placeholder2, LV_VER_RES);
|
||||
lv_obj_set_size(placeholder2, lv_pct(100), music_height);
|
||||
lv_obj_set_y(placeholder2, music_height);
|
||||
|
||||
lv_obj_set_size(placeholder3, lv_pct(100), LV_VER_RES - 2 * LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_y(placeholder3, 2 * LV_VER_RES + LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_size(placeholder3, lv_pct(100), music_height - 2 * LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_y(placeholder3, 2 * music_height + LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
#else
|
||||
lv_obj_set_size(placeholder1, lv_pct(100), LV_VER_RES);
|
||||
lv_obj_set_size(placeholder1, lv_pct(100), music_height);
|
||||
lv_obj_set_y(placeholder1, 0);
|
||||
|
||||
lv_obj_set_size(placeholder2, lv_pct(100), LV_VER_RES - 2 * LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_y(placeholder2, LV_VER_RES + LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_size(placeholder2, lv_pct(100), music_height - 2 * LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
lv_obj_set_y(placeholder2, music_height + LV_DEMO_MUSIC_HANDLE_SIZE);
|
||||
#endif
|
||||
|
||||
lv_obj_update_layout(main_cont);
|
||||
@@ -455,14 +460,14 @@ static void create_wave_images(lv_obj_t * parent)
|
||||
lv_obj_t * wave_top = lv_image_create(parent);
|
||||
lv_image_set_src(wave_top, &img_lv_demo_music_wave_top);
|
||||
lv_image_set_inner_align(wave_top, LV_IMAGE_ALIGN_TILE);
|
||||
lv_obj_set_width(wave_top, LV_HOR_RES);
|
||||
lv_obj_set_width(wave_top, music_width);
|
||||
lv_obj_align(wave_top, LV_ALIGN_TOP_MID, 0, 0);
|
||||
lv_obj_add_flag(wave_top, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||
|
||||
lv_obj_t * wave_bottom = lv_image_create(parent);
|
||||
lv_image_set_src(wave_bottom, &img_lv_demo_music_wave_bottom);
|
||||
lv_image_set_inner_align(wave_bottom, LV_IMAGE_ALIGN_TILE);
|
||||
lv_obj_set_width(wave_bottom, LV_HOR_RES);
|
||||
lv_obj_set_width(wave_bottom, music_width);
|
||||
lv_obj_align(wave_bottom, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_add_flag(wave_bottom, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||
|
||||
@@ -473,7 +478,7 @@ static void create_wave_images(lv_obj_t * parent)
|
||||
#if LV_DEMO_MUSIC_ROUND == 0
|
||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_LEFT, 0, 0);
|
||||
#else
|
||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_LEFT, -LV_HOR_RES / 6, 0);
|
||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_LEFT, -music_width / 6, 0);
|
||||
#endif
|
||||
lv_obj_add_flag(wave_corner, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||
|
||||
@@ -482,7 +487,7 @@ static void create_wave_images(lv_obj_t * parent)
|
||||
#if LV_DEMO_MUSIC_ROUND == 0
|
||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
||||
#else
|
||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_RIGHT, LV_HOR_RES / 6, 0);
|
||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_RIGHT, music_width / 6, 0);
|
||||
#endif
|
||||
lv_obj_add_flag(wave_corner, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||
}
|
||||
@@ -710,17 +715,17 @@ static void track_load(uint32_t id)
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
|
||||
#if LV_DEMO_MUSIC_LANDSCAPE
|
||||
if(next) {
|
||||
lv_anim_set_values(&a, 0, - LV_HOR_RES / 7);
|
||||
lv_anim_set_values(&a, 0, -music_width / 7);
|
||||
}
|
||||
else {
|
||||
lv_anim_set_values(&a, 0, LV_HOR_RES / 7);
|
||||
lv_anim_set_values(&a, 0, music_width / 7);
|
||||
}
|
||||
#else
|
||||
if(next) {
|
||||
lv_anim_set_values(&a, 0, - LV_HOR_RES / 2);
|
||||
lv_anim_set_values(&a, 0, -music_width / 2);
|
||||
}
|
||||
else {
|
||||
lv_anim_set_values(&a, 0, LV_HOR_RES / 2);
|
||||
lv_anim_set_values(&a, 0, music_width / 2);
|
||||
}
|
||||
#endif
|
||||
lv_anim_set_exec_cb(&a, _obj_set_x_anim_cb);
|
||||
@@ -786,9 +791,9 @@ static void spectrum_draw_event_cb(lv_event_t * e)
|
||||
|
||||
if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
#if LV_DEMO_MUSIC_LANDSCAPE
|
||||
lv_event_set_ext_draw_size(e, LV_HOR_RES);
|
||||
lv_event_set_ext_draw_size(e, music_width);
|
||||
#else
|
||||
lv_event_set_ext_draw_size(e, LV_VER_RES);
|
||||
lv_event_set_ext_draw_size(e, music_height);
|
||||
#endif
|
||||
}
|
||||
else if(code == LV_EVENT_COVER_CHECK) {
|
||||
@@ -866,9 +871,9 @@ static void spectrum_draw_event_cb(lv_event_t * e)
|
||||
}
|
||||
|
||||
if(v < BAR_COLOR1_STOP) draw_dsc.color = BAR_COLOR1;
|
||||
else if(v > (uint32_t)BAR_COLOR3_STOP) draw_dsc.color = BAR_COLOR3;
|
||||
else if(v > (uint32_t)bar_color3_stop) draw_dsc.color = BAR_COLOR3;
|
||||
else if(v > BAR_COLOR2_STOP) draw_dsc.color = lv_color_mix(BAR_COLOR3, BAR_COLOR2,
|
||||
((v - BAR_COLOR2_STOP) * 255) / (BAR_COLOR3_STOP - BAR_COLOR2_STOP));
|
||||
((v - BAR_COLOR2_STOP) * 255) / (bar_color3_stop - BAR_COLOR2_STOP));
|
||||
else draw_dsc.color = lv_color_mix(BAR_COLOR2, BAR_COLOR1,
|
||||
((v - BAR_COLOR1_STOP) * 255) / (BAR_COLOR2_STOP - BAR_COLOR1_STOP));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user