Fix music app :
- Enable LVGL animation (and disable groups, which were not used), and set the speed. - Fix disc animation and progress display by initializing lastIncrement at 0 (a random value will be used otherwise, in release build)
This commit is contained in:
parent
04fc33e2d4
commit
f8b9a7c060
4 changed files with 17 additions and 13 deletions
|
@ -164,7 +164,7 @@ Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask &
|
||||||
|
|
||||||
artistName = "Waiting for";
|
artistName = "Waiting for";
|
||||||
albumName = "";
|
albumName = "";
|
||||||
trackName = "track information...";
|
trackName = "track information..";
|
||||||
playing = false;
|
playing = false;
|
||||||
repeat = false;
|
repeat = false;
|
||||||
shuffle = false;
|
shuffle = false;
|
||||||
|
|
|
@ -103,18 +103,22 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus
|
||||||
constexpr uint8_t LINE_PAD = 15;
|
constexpr uint8_t LINE_PAD = 15;
|
||||||
constexpr int8_t MIDDLE_OFFSET = -25;
|
constexpr int8_t MIDDLE_OFFSET = -25;
|
||||||
txtArtist = lv_label_create(lv_scr_act(), nullptr);
|
txtArtist = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL);
|
lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL_CIRC);
|
||||||
|
lv_label_set_anim_speed(txtArtist, 1);
|
||||||
lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT);
|
lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT);
|
||||||
lv_label_set_text(txtArtist, "Artist Name");
|
|
||||||
lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID);
|
lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID);
|
||||||
lv_obj_set_width(txtArtist, LV_HOR_RES);
|
lv_obj_set_width(txtArtist, LV_HOR_RES-12);
|
||||||
|
lv_label_set_text(txtArtist, "Artist Name");
|
||||||
|
|
||||||
|
|
||||||
txtTrack = lv_label_create(lv_scr_act(), nullptr);
|
txtTrack = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL);
|
lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC);
|
||||||
|
lv_label_set_anim_speed(txtTrack, 1);
|
||||||
lv_obj_align(txtTrack, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 2 * FONT_HEIGHT + LINE_PAD);
|
lv_obj_align(txtTrack, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 2 * FONT_HEIGHT + LINE_PAD);
|
||||||
lv_label_set_text(txtTrack, "This is a very long getTrack name");
|
|
||||||
lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID);
|
lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID);
|
||||||
lv_obj_set_width(txtTrack, LV_HOR_RES);
|
lv_obj_set_width(txtTrack, LV_HOR_RES-12);
|
||||||
|
lv_label_set_text(txtTrack, "This is a very long getTrack name");
|
||||||
|
|
||||||
/** Init animation */
|
/** Init animation */
|
||||||
imgDisc = lv_img_create(lv_scr_act(), nullptr);
|
imgDisc = lv_img_create(lv_scr_act(), nullptr);
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace Pinetime {
|
||||||
/** Last length */
|
/** Last length */
|
||||||
int lastLength;
|
int lastLength;
|
||||||
/** Last time an animation update or timer was incremented */
|
/** Last time an animation update or timer was incremented */
|
||||||
TickType_t lastIncrement;
|
TickType_t lastIncrement = 0;
|
||||||
|
|
||||||
bool playing;
|
bool playing;
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ typedef int16_t lv_coord_t;
|
||||||
*==================*/
|
*==================*/
|
||||||
|
|
||||||
/*1: Enable the Animations */
|
/*1: Enable the Animations */
|
||||||
#define LV_USE_ANIMATION 0
|
#define LV_USE_ANIMATION 1
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
|
|
||||||
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
|
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
|
||||||
|
@ -177,7 +177,7 @@ typedef void* lv_anim_user_data_t;
|
||||||
#define LV_USE_IMG_TRANSFORM 0
|
#define LV_USE_IMG_TRANSFORM 0
|
||||||
|
|
||||||
/* 1: Enable object groups (for keyboard/encoder navigation) */
|
/* 1: Enable object groups (for keyboard/encoder navigation) */
|
||||||
#define LV_USE_GROUP 1
|
#define LV_USE_GROUP 0
|
||||||
#if LV_USE_GROUP
|
#if LV_USE_GROUP
|
||||||
typedef void* lv_group_user_data_t;
|
typedef void* lv_group_user_data_t;
|
||||||
#endif /*LV_USE_GROUP*/
|
#endif /*LV_USE_GROUP*/
|
||||||
|
|
Loading…
Reference in a new issue