fix app- and note screen

This commit is contained in:
sharandac
2020-07-09 17:02:41 +02:00
parent 8ac776e670
commit 9299ec6fd3
3 changed files with 27 additions and 90 deletions

View File

@@ -2,53 +2,21 @@
#include "../mainbar.h"
#include "app_tile.h"
static void btn_event_cb( lv_obj_t * obj, lv_event_t event );
static lv_obj_t *applabel = NULL;
LV_IMG_DECLARE(wifi_64px);
LV_IMG_DECLARE(bluetooth_64px);
LV_IMG_DECLARE(time_64px);
LV_IMG_DECLARE(brightness_64px);
static lv_style_t appstyle;
LV_FONT_DECLARE(Ubuntu_72px);
LV_FONT_DECLARE(Ubuntu_16px);
void app_tile_setup( lv_obj_t *tile, lv_style_t *style, lv_coord_t hres, lv_coord_t vres ) {
lv_obj_t * wifi_setup = lv_imgbtn_create(tile, NULL);
lv_imgbtn_set_src(wifi_setup, LV_BTN_STATE_RELEASED, &wifi_64px);
lv_imgbtn_set_src(wifi_setup, LV_BTN_STATE_PRESSED, &wifi_64px);
lv_imgbtn_set_src(wifi_setup, LV_BTN_STATE_CHECKED_RELEASED, &wifi_64px);
lv_imgbtn_set_src(wifi_setup, LV_BTN_STATE_CHECKED_PRESSED, &wifi_64px);
lv_obj_add_style(wifi_setup, LV_IMGBTN_PART_MAIN, style);
lv_obj_align(wifi_setup, tile, LV_ALIGN_IN_TOP_LEFT, 48, 48 );
lv_obj_set_event_cb( wifi_setup, btn_event_cb );
lv_obj_t * bluetooth_setup = lv_imgbtn_create(tile, NULL);
lv_imgbtn_set_src(bluetooth_setup, LV_BTN_STATE_RELEASED, &bluetooth_64px);
lv_imgbtn_set_src(bluetooth_setup, LV_BTN_STATE_PRESSED, &bluetooth_64px);
lv_imgbtn_set_src(bluetooth_setup, LV_BTN_STATE_CHECKED_RELEASED, &bluetooth_64px);
lv_imgbtn_set_src(bluetooth_setup, LV_BTN_STATE_CHECKED_PRESSED, &bluetooth_64px);
lv_obj_add_style(bluetooth_setup, LV_IMGBTN_PART_MAIN, style);
lv_obj_align(bluetooth_setup, tile, LV_ALIGN_IN_TOP_LEFT, 48+86, 48 );
lv_obj_t * time_setup = lv_imgbtn_create(tile, NULL);
lv_imgbtn_set_src(time_setup, LV_BTN_STATE_RELEASED, &time_64px);
lv_imgbtn_set_src(time_setup, LV_BTN_STATE_PRESSED, &time_64px);
lv_imgbtn_set_src(time_setup, LV_BTN_STATE_CHECKED_RELEASED, &time_64px);
lv_imgbtn_set_src(time_setup, LV_BTN_STATE_CHECKED_PRESSED, &time_64px);
lv_obj_add_style(time_setup, LV_IMGBTN_PART_MAIN, style);
lv_obj_align(time_setup, tile, LV_ALIGN_IN_TOP_LEFT, 48, 48+86 );
lv_obj_t * brightness_setup = lv_imgbtn_create(tile, NULL);
lv_imgbtn_set_src(brightness_setup, LV_BTN_STATE_RELEASED, &brightness_64px);
lv_imgbtn_set_src(brightness_setup, LV_BTN_STATE_PRESSED, &brightness_64px);
lv_imgbtn_set_src(brightness_setup, LV_BTN_STATE_CHECKED_RELEASED, &brightness_64px);
lv_imgbtn_set_src(brightness_setup, LV_BTN_STATE_CHECKED_PRESSED, &brightness_64px);
lv_obj_add_style(brightness_setup, LV_IMGBTN_PART_MAIN, style);
lv_obj_align(brightness_setup, tile, LV_ALIGN_IN_TOP_LEFT, 48+86, 48+86 );
lv_style_copy( &appstyle, style);
lv_style_set_text_font( &appstyle, LV_STATE_DEFAULT, &Ubuntu_72px);
}
static void btn_event_cb( lv_obj_t * obj, lv_event_t event ) {
switch( event ) {
case( LV_EVENT_CLICKED ): mainbar_jump_to_maintile( LV_ANIM_OFF );
break;
}
applabel = lv_label_create(tile, NULL);
lv_label_set_text(applabel, "app");
lv_obj_reset_style_list( applabel, LV_OBJ_PART_MAIN );
lv_obj_add_style( applabel, LV_OBJ_PART_MAIN, &appstyle );
lv_obj_align(applabel, NULL, LV_ALIGN_CENTER, 0, 0);
}