Main Bar - Tile sliding by dragging clock

Main Bar - Tile sliding by dragging clock
This commit is contained in:
chrismcna
2020-08-10 13:09:10 +01:00
parent ddf2e8a852
commit 2240f9bc3a
2 changed files with 12 additions and 2 deletions

View File

@@ -108,10 +108,10 @@ uint32_t mainbar_add_tile( uint16_t x, uint16_t y ) {
tile_pos_table[ tile_entrys - 1 ].x = x; tile_pos_table[ tile_entrys - 1 ].x = x;
tile_pos_table[ tile_entrys - 1 ].y = y; tile_pos_table[ tile_entrys - 1 ].y = y;
lv_obj_t *my_tile = lv_obj_create( mainbar, NULL); lv_obj_t *my_tile = lv_cont_create( mainbar, NULL);
tile[ tile_entrys - 1 ].tile = my_tile; tile[ tile_entrys - 1 ].tile = my_tile;
lv_obj_set_size( tile[ tile_entrys - 1 ].tile, LV_HOR_RES, LV_VER_RES); lv_obj_set_size( tile[ tile_entrys - 1 ].tile, LV_HOR_RES, LV_VER_RES);
lv_obj_reset_style_list( tile[ tile_entrys - 1 ].tile, LV_OBJ_PART_MAIN ); //lv_obj_reset_style_list( tile[ tile_entrys - 1 ].tile, LV_OBJ_PART_MAIN );
lv_obj_add_style( tile[ tile_entrys - 1 ].tile, LV_OBJ_PART_MAIN, &mainbar_style ); lv_obj_add_style( tile[ tile_entrys - 1 ].tile, LV_OBJ_PART_MAIN, &mainbar_style );
lv_obj_set_pos( tile[ tile_entrys - 1 ].tile, tile_pos_table[ tile_entrys - 1 ].x * LV_HOR_RES , tile_pos_table[ tile_entrys - 1 ].y * LV_VER_RES ); lv_obj_set_pos( tile[ tile_entrys - 1 ].tile, tile_pos_table[ tile_entrys - 1 ].x * LV_HOR_RES , tile_pos_table[ tile_entrys - 1 ].y * LV_VER_RES );
lv_tileview_add_element( mainbar, tile[ tile_entrys - 1 ].tile ); lv_tileview_add_element( mainbar, tile[ tile_entrys - 1 ].tile );
@@ -178,3 +178,11 @@ void mainbar_jump_to_tilenumber( uint32_t tile_number, lv_anim_enable_t anim ) {
log_e( "tile number %d do not exist", tile_number ); log_e( "tile number %d do not exist", tile_number );
} }
} }
lv_obj_t * mainbar_obj_create(lv_obj_t *parent)
{
lv_obj_t * child = lv_obj_create( parent, NULL );
lv_tileview_add_element( mainbar, child );
return child;
}

View File

@@ -107,4 +107,6 @@
*/ */
lv_style_t *mainbar_get_slider_style( void ); lv_style_t *mainbar_get_slider_style( void );
lv_obj_t * mainbar_obj_create(lv_obj_t *parent);
#endif // _MAINBAR_H #endif // _MAINBAR_H