fix app- and note screen
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ static lv_point_t valid_pos[ TILE_NUM ];
|
||||
|
||||
lv_tile_entry_t tile_entry[ TILE_NUM ] {
|
||||
{ NULL, MAIN_TILE, main_tile_setup, { 0 , 0 } },
|
||||
{ NULL, NOTE_TILE, note_tile_setup, { 1 , 0 } },
|
||||
{ NULL, APP_TILE, app_tile_setup, { 0 , 1 } },
|
||||
{ NULL, APP_TILE, app_tile_setup, { 1 , 0 } },
|
||||
{ NULL, NOTE_TILE, note_tile_setup, { 0 , 1 } },
|
||||
{ NULL, SETUP_TILE, setup_tile_setup, { 1 , 1 } },
|
||||
{ NULL, WLAN_SETTINGS_TILE, wlan_settings_tile_setup, { 1,3 } },
|
||||
{ NULL, WLAN_PASSWORD_TILE, wlan_password_tile_setup, { 2,3 } },
|
||||
|
||||
@@ -2,53 +2,22 @@
|
||||
#include "../mainbar.h"
|
||||
#include "note_tile.h"
|
||||
|
||||
static void btn_event_cb( lv_obj_t * obj, lv_event_t event );
|
||||
static lv_obj_t *notelabel = 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 notestyle;
|
||||
|
||||
LV_FONT_DECLARE(Ubuntu_72px);
|
||||
LV_FONT_DECLARE(Ubuntu_16px);
|
||||
|
||||
void note_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_style_copy( ¬estyle, style);
|
||||
lv_style_set_text_font( ¬estyle, LV_STATE_DEFAULT, &Ubuntu_72px);
|
||||
|
||||
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 );
|
||||
notelabel = lv_label_create(tile, NULL);
|
||||
lv_label_set_text( notelabel, "note");
|
||||
lv_obj_reset_style_list( notelabel, LV_OBJ_PART_MAIN );
|
||||
lv_obj_add_style( notelabel, LV_OBJ_PART_MAIN, ¬estyle );
|
||||
lv_obj_align( notelabel, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
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 );
|
||||
|
||||
}
|
||||
|
||||
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_ON );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user