|
|
|
@ -38,21 +38,25 @@ static void textarea_event_cb(lv_event_t* e)
|
|
|
|
|
lv_obj_set_height(tabview, NM_DISP_VER);
|
|
|
|
|
lv_obj_add_flag(virt_keyboard, LV_OBJ_FLAG_HIDDEN);
|
|
|
|
|
lv_obj_clear_state(textarea, LV_STATE_FOCUSED);
|
|
|
|
|
lv_indev_reset(NULL, textarea); /* forget the last clicked object to make it focusable again */
|
|
|
|
|
lv_indev_reset(NULL, textarea); /* forget last obj to make it focusable again */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void create_bitcoin_panel(lv_obj_t *parent)
|
|
|
|
|
{
|
|
|
|
|
lv_obj_t *label = lv_label_create(parent);
|
|
|
|
|
lv_label_set_text_static(label, "bitcoin tab isn't designed yet\nfollow https://nakamochi.io");
|
|
|
|
|
lv_label_set_text_static(label,
|
|
|
|
|
"bitcoin tab isn't designed yet\n"
|
|
|
|
|
"follow https://nakamochi.io");
|
|
|
|
|
lv_obj_center(label);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void create_lnd_panel(lv_obj_t *parent)
|
|
|
|
|
{
|
|
|
|
|
lv_obj_t *label = lv_label_create(parent);
|
|
|
|
|
lv_label_set_text_static(label, "lightning tab isn't designed yet\nfollow https://nakamochi.io");
|
|
|
|
|
lv_label_set_text_static(label,
|
|
|
|
|
"lightning tab isn't designed yet\n"
|
|
|
|
|
"follow https://nakamochi.io");
|
|
|
|
|
lv_obj_center(label);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -111,11 +115,10 @@ static void power_halt_btn_callback(lv_event_t *e)
|
|
|
|
|
/* first button must always be a "proceed", do shutdown;
|
|
|
|
|
* text is irrelevant */
|
|
|
|
|
static const char *btns[] = {"PROCEED", "ABORT", NULL};
|
|
|
|
|
lv_obj_t *msgbox = lv_msgbox_create(
|
|
|
|
|
NULL /* modal */,
|
|
|
|
|
lv_obj_t *msgbox = lv_msgbox_create(NULL, /* modal */
|
|
|
|
|
"SHUTDOWN", /* title */
|
|
|
|
|
"are you sure?", /* text */
|
|
|
|
|
btns,
|
|
|
|
|
btns, /* */
|
|
|
|
|
false /* close btn */);
|
|
|
|
|
lv_obj_center(msgbox);
|
|
|
|
|
lv_obj_add_event_cb(msgbox, power_halt_btn_callback, LV_EVENT_VALUE_CHANGED, msgbox);
|
|
|
|
@ -198,17 +201,16 @@ static void create_settings_panel(lv_obj_t* parent)
|
|
|
|
|
* layout
|
|
|
|
|
********************/
|
|
|
|
|
static lv_coord_t parent_grid_cols[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
|
|
|
|
static lv_coord_t parent_grid_rows[] = {
|
|
|
|
|
static lv_coord_t parent_grid_rows[] = {/**/
|
|
|
|
|
LV_GRID_CONTENT, /* wifi panel */
|
|
|
|
|
LV_GRID_CONTENT, /* power panel */
|
|
|
|
|
LV_GRID_TEMPLATE_LAST
|
|
|
|
|
};
|
|
|
|
|
LV_GRID_TEMPLATE_LAST};
|
|
|
|
|
lv_obj_set_grid_dsc_array(parent, parent_grid_cols, parent_grid_rows);
|
|
|
|
|
lv_obj_set_grid_cell(wifi_panel, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
|
|
|
|
lv_obj_set_grid_cell(power_panel, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
|
|
|
|
|
|
|
|
|
static lv_coord_t wifi_grid_cols[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
|
|
|
|
static lv_coord_t wifi_grid_rows[] = {
|
|
|
|
|
static lv_coord_t wifi_grid_rows[] = {/**/
|
|
|
|
|
LV_GRID_CONTENT, /* title */
|
|
|
|
|
5, /* separator */
|
|
|
|
|
LV_GRID_CONTENT, /* wifi status text */
|
|
|
|
@ -218,8 +220,7 @@ static void create_settings_panel(lv_obj_t* parent)
|
|
|
|
|
30, /* password input */
|
|
|
|
|
5, /* separator */
|
|
|
|
|
LV_GRID_CONTENT, /* connect btn */
|
|
|
|
|
LV_GRID_TEMPLATE_LAST
|
|
|
|
|
};
|
|
|
|
|
LV_GRID_TEMPLATE_LAST};
|
|
|
|
|
lv_obj_set_grid_dsc_array(wifi_panel, wifi_grid_cols, wifi_grid_rows);
|
|
|
|
|
lv_obj_set_grid_cell(wifi_panel_title, LV_GRID_ALIGN_STRETCH, 0, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
|
|
|
|
lv_obj_set_grid_cell(wifi_spinner, LV_GRID_ALIGN_END, 1, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
|
|
|
@ -233,12 +234,11 @@ static void create_settings_panel(lv_obj_t* parent)
|
|
|
|
|
lv_obj_set_grid_cell(wifi_connect_btn, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_CENTER, 8, 1);
|
|
|
|
|
|
|
|
|
|
static lv_coord_t power_grid_cols[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
|
|
|
|
static lv_coord_t power_grid_rows[] = {
|
|
|
|
|
static lv_coord_t power_grid_rows[] = {/**/
|
|
|
|
|
LV_GRID_CONTENT, /* title */
|
|
|
|
|
5, /* separator */
|
|
|
|
|
LV_GRID_CONTENT, /* power off text and btn*/
|
|
|
|
|
LV_GRID_TEMPLATE_LAST
|
|
|
|
|
};
|
|
|
|
|
LV_GRID_TEMPLATE_LAST};
|
|
|
|
|
lv_obj_set_grid_dsc_array(power_panel, power_grid_cols, power_grid_rows);
|
|
|
|
|
lv_obj_set_grid_cell(power_panel_title, LV_GRID_ALIGN_STRETCH, 0, 2, LV_GRID_ALIGN_CENTER, 0, 1);
|
|
|
|
|
/* column 0 */
|
|
|
|
@ -268,12 +268,11 @@ extern int ui_init()
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
/* default theme is static */
|
|
|
|
|
lv_theme_t* theme = lv_theme_default_init(
|
|
|
|
|
disp,
|
|
|
|
|
lv_theme_t *theme = lv_theme_default_init(disp, /**/
|
|
|
|
|
lv_palette_main(LV_PALETTE_BLUE), /* primary */
|
|
|
|
|
lv_palette_main(LV_PALETTE_RED), /* secondary */
|
|
|
|
|
true /*LV_THEME_DEFAULT_DARK*/,
|
|
|
|
|
LV_FONT_DEFAULT);
|
|
|
|
|
true, /* dark mode, LV_THEME_DEFAULT_DARK */
|
|
|
|
|
LV_FONT_DEFAULT /* lv_conf.h def */);
|
|
|
|
|
lv_disp_set_theme(disp, theme);
|
|
|
|
|
|
|
|
|
|
font_large = &lv_font_courierprimecode_24; /* static */
|
|
|
|
|