Merge pull request #53 from chrismcna/master

Add MainBar tile view sliding via Widgets and Apps
This commit is contained in:
Dirk Broßwick
2020-08-19 11:26:51 +02:00
committed by GitHub
3 changed files with 10 additions and 0 deletions

View File

@@ -73,6 +73,9 @@ void example_app_setup( void ) {
lv_obj_align( example_app_icon , example_app_icon_cont, LV_ALIGN_IN_TOP_LEFT, 0, 0 );
lv_obj_set_event_cb( example_app_icon, enter_example_app_event_cb );
// make app icon drag scroll the mainbar
mainbar_add_slide_element(example_app_icon);
// set an small info indicator at your app icon to inform the user about the state or news
example_app_icon_info = lv_img_create( example_app_icon_cont, NULL );
lv_img_set_src( example_app_icon_info, &info_1_16px );
@@ -97,6 +100,9 @@ void example_app_setup( void ) {
lv_obj_align( example_app_widget_icon , example_app_widget_cont, LV_ALIGN_IN_TOP_LEFT, 0, 0 );
lv_obj_set_event_cb( example_app_widget_icon, enter_example_app_event_cb );
// make widget icon drag scroll the mainbar
mainbar_add_slide_element(example_app_widget_icon);
// set an small info icon at your widget icon to inform the user about the state or news
example_app_widget_icon_info = lv_img_create( example_app_widget_cont, NULL );
lv_img_set_src( example_app_widget_icon_info, &info_1_16px );

View File

@@ -77,6 +77,7 @@ void weather_app_setup( void ) {
weather_app_cont = app_tile_register_app( "weather");
lv_obj_t *weather_app_icon = lv_imgbtn_create( weather_app_cont, NULL );
mainbar_add_slide_element(weather_app_icon);
lv_imgbtn_set_src( weather_app_icon, LV_BTN_STATE_RELEASED, &owm_01d_64px);
lv_imgbtn_set_src( weather_app_icon, LV_BTN_STATE_PRESSED, &owm_01d_64px);
lv_imgbtn_set_src( weather_app_icon, LV_BTN_STATE_CHECKED_RELEASED, &owm_01d_64px);
@@ -89,6 +90,7 @@ void weather_app_setup( void ) {
// create widget weather condition icon and temperature label
weather_widget_cont = main_tile_register_widget();
weather_widget_condition_img = lv_imgbtn_create( weather_widget_cont, NULL );
mainbar_add_slide_element(weather_widget_condition_img);
lv_imgbtn_set_src( weather_widget_condition_img, LV_BTN_STATE_RELEASED, &owm_01d_64px);
lv_imgbtn_set_src( weather_widget_condition_img, LV_BTN_STATE_PRESSED, &owm_01d_64px);
lv_imgbtn_set_src( weather_widget_condition_img, LV_BTN_STATE_CHECKED_RELEASED, &owm_01d_64px);

View File

@@ -57,12 +57,14 @@ void app_tile_setup( void ) {
app_entry[ app ].active = false;
// create app icon container
app_entry[ app ].app = lv_obj_create( app_cont, NULL );
mainbar_add_slide_element(app_entry[ app ].app);
lv_obj_reset_style_list( app_entry[ app ].app, LV_OBJ_PART_MAIN );
lv_obj_add_style( app_entry[ app ].app, LV_OBJ_PART_MAIN, style );
lv_obj_set_size( app_entry[ app ].app, APP_ICON_X_SIZE, APP_ICON_Y_SIZE );
lv_obj_align( app_entry[ app ].app , app_cont, LV_ALIGN_IN_TOP_LEFT, app_entry[ app ].x, app_entry[ app ].y );
// create app label
app_entry[ app ].label = lv_label_create( app_cont, NULL );
mainbar_add_slide_element(app_entry[ app ].label);
lv_obj_reset_style_list( app_entry[ app ].label, LV_OBJ_PART_MAIN );
lv_obj_add_style( app_entry[ app ].label, LV_OBJ_PART_MAIN, style );
lv_obj_set_size( app_entry[ app ].label, APP_LABEL_X_SIZE, APP_LABEL_Y_SIZE );