Improve password screen.

This commit is contained in:
xiaojiazhu 2023-10-24 17:35:49 +08:00
parent feb9db88c6
commit 2851e26f42
10 changed files with 380 additions and 46 deletions

View File

@ -63,6 +63,124 @@
],
"text": "Enter",
"widget": "Label"
},
{
"button's ctrl": [
],
"button's text": "0,0,0,0,0,0",
"button's width": [
],
"class": "lv_btnmatrix",
"click": true,
"drag": false,
"event callback": "",
"focus": 0,
"geometry": {
"height": 80,
"width": 174,
"x": 74,
"y": 159
},
"hidden": false,
"locked": false,
"name": "button_matrix_password",
"one check": true,
"styles": [
{
"Background": {
"bg_color": "0x000000"
},
"Border": {
"border_color": "0xdddddd",
"border_width": 0
},
"Mix": {
"radius": 0
},
"part": 0,
"state": 0
},
{
"part": 0,
"state": 1
},
{
"Border": {
"border_color": "0x01a2b1"
},
"part": 0,
"state": 2
},
{
"Border": {
"border_color": "0x44d1b6"
},
"part": 0,
"state": 3
},
{
"part": 0,
"state": 4
},
{
"part": 0,
"state": 5
},
{
"part": 0,
"state": 6
},
{
"Background": {
"bg_color": "0x000000"
},
"Border": {
"border_color": "0xdddddd",
"border_width": 0
},
"Text": {
"text_color": "0xffffff",
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x00b495",
"text_sel_color": "0x3c3c3c"
},
"part": 1,
"state": 0
},
{
"Border": {
"border_width": 0
},
"Text": {
"text_color": "0xffffff"
},
"part": 1,
"state": 1
},
{
"part": 1,
"state": 2
},
{
"part": 1,
"state": 3
},
{
"part": 1,
"state": 4
},
{
"part": 1,
"state": 5
},
{
"part": 1,
"state": 6
}
],
"text align": "Center",
"text recolor": false,
"widget": "Button Matrix"
}
],
"class": "lv_img",

View File

@ -1026,8 +1026,7 @@
"opa_scale": 120
},
"Text": {
"text_color": "0x31404f",
"text_sel_bg_color": "0x00b495"
"text_color": "0x31404f"
},
"part": 0,
"state": 0
@ -1035,47 +1034,37 @@
{
"Text": {
"text_color": "0xffffff",
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x01a2b1"
"text_font": "montserrat 16 4bpp"
},
"part": 0,
"state": 1
},
{
"Text": {
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x01a2b1"
"text_font": "montserrat 16 4bpp"
},
"part": 0,
"state": 2
},
{
"Text": {
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x01a2b1"
"text_font": "montserrat 16 4bpp"
},
"part": 0,
"state": 3
},
{
"Text": {
"text_sel_bg_color": "0x01a2b1"
},
"part": 0,
"state": 4
},
{
"Text": {
"text_sel_bg_color": "0x01a2b1"
},
"part": 0,
"state": 5
},
{
"Text": {
"text_color": "0x888888",
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x01a2b1"
"text_font": "montserrat 16 4bpp"
},
"part": 0,
"state": 6

View File

@ -529,7 +529,6 @@ lv_plugin_font_t lv_plugin_UIFlowLVGL_font_table[] =
{
{ NULL },
{ &lv_font_montserrat_16 },
{ &notosanscjkjp_black_16_1bpp },
{ &notosanscjksc_black_16_1bpp },
{ &notosanscjktc_black_16_1bpp },
{ &arialuni_16_1bpp },
@ -541,7 +540,6 @@ lv_plugin_font_t lv_plugin_UIFlowLVGL_font_table[] =
{ &arialuni_106_1bpp },
{ &sf_ui_text_bold_20_8bpp },
{ &sf_ui_text_medium_18_8bpp },
{ &arialuni_74_1bpp },
{ &sf_ui_text_medium_16_8bpp },
{ &notosans_black_8_1bpp },
};
@ -617,11 +615,11 @@ lv_plugin_res_id lv_plugin_language_font_table_SC[] = {
};
lv_plugin_res_id lv_plugin_language_font_table_JP[] = {
LV_PLUGIN_FONT_ID_NOTOSANSCJKJP_BLACK_16_1BPP,
LV_PLUGIN_FONT_ID_NOTOSANSCJKJP_BLACK_16_1BPP,
LV_PLUGIN_FONT_ID_NOTOSANSCJKJP_BLACK_16_1BPP,
LV_PLUGIN_FONT_ID_NOTOSANSCJKJP_BLACK_16_1BPP,
LV_PLUGIN_FONT_ID_NOTOSANSCJKJP_BLACK_16_1BPP,
LV_PLUGIN_FONT_ID_LV_FONT_MONTSERRAT_16,
LV_PLUGIN_FONT_ID_LV_FONT_MONTSERRAT_16,
LV_PLUGIN_FONT_ID_LV_FONT_MONTSERRAT_16,
LV_PLUGIN_FONT_ID_LV_FONT_MONTSERRAT_16,
LV_PLUGIN_FONT_ID_LV_FONT_MONTSERRAT_16,
};
lv_plugin_res_id lv_plugin_language_font_table_TC[] = {

View File

@ -53,7 +53,6 @@ extern lv_obj_t *UIFlowWifiLinkOK;
extern lv_obj_t *UIFlowWifiWait;
extern lv_obj_t *UIFlowPassword;
LV_FONT_DECLARE(notosanscjkjp_black_16_1bpp);
LV_FONT_DECLARE(notosanscjksc_black_16_1bpp);
LV_FONT_DECLARE(notosanscjktc_black_16_1bpp);
LV_FONT_DECLARE(arialuni_16_1bpp);
@ -65,7 +64,6 @@ LV_FONT_DECLARE(arialuni_86_1bpp);
LV_FONT_DECLARE(arialuni_106_1bpp);
LV_FONT_DECLARE(sf_ui_text_bold_20_8bpp);
LV_FONT_DECLARE(sf_ui_text_medium_18_8bpp);
LV_FONT_DECLARE(arialuni_74_1bpp);
LV_FONT_DECLARE(sf_ui_text_medium_16_8bpp);
LV_FONT_DECLARE(notosans_black_8_1bpp);
@ -1056,22 +1054,20 @@ LV_IMG_DECLARE(work_mode);
#define LV_PLUGIN_IMG_TABLE_SIZE 486
#define LV_PLUGIN_FONT_ID_LV_FONT_MONTSERRAT_16 1
#define LV_PLUGIN_FONT_ID_NOTOSANSCJKJP_BLACK_16_1BPP 2
#define LV_PLUGIN_FONT_ID_NOTOSANSCJKSC_BLACK_16_1BPP 3
#define LV_PLUGIN_FONT_ID_NOTOSANSCJKTC_BLACK_16_1BPP 4
#define LV_PLUGIN_FONT_ID_ARIALUNI_16_1BPP 5
#define LV_PLUGIN_FONT_ID_ARIALUNI_18_1BPP 6
#define LV_PLUGIN_FONT_ID_ARIALUNI_32_1BPP 7
#define LV_PLUGIN_FONT_ID_ARIALUNI_48_1BPP 8
#define LV_PLUGIN_FONT_ID_ARIALUNI_60_1BPP 9
#define LV_PLUGIN_FONT_ID_ARIALUNI_86_1BPP 10
#define LV_PLUGIN_FONT_ID_ARIALUNI_106_1BPP 11
#define LV_PLUGIN_FONT_ID_SF_UI_TEXT_BOLD_20_8BPP 12
#define LV_PLUGIN_FONT_ID_SF_UI_TEXT_MEDIUM_18_8BPP 13
#define LV_PLUGIN_FONT_ID_ARIALUNI_74_1BPP 14
#define LV_PLUGIN_FONT_ID_SF_UI_TEXT_MEDIUM_16_8BPP 15
#define LV_PLUGIN_FONT_ID_NOTOSANS_BLACK_8_1BPP 16
#define LV_PLUGIN_FONT_TABLE_SIZE 17
#define LV_PLUGIN_FONT_ID_NOTOSANSCJKSC_BLACK_16_1BPP 2
#define LV_PLUGIN_FONT_ID_NOTOSANSCJKTC_BLACK_16_1BPP 3
#define LV_PLUGIN_FONT_ID_ARIALUNI_16_1BPP 4
#define LV_PLUGIN_FONT_ID_ARIALUNI_18_1BPP 5
#define LV_PLUGIN_FONT_ID_ARIALUNI_32_1BPP 6
#define LV_PLUGIN_FONT_ID_ARIALUNI_48_1BPP 7
#define LV_PLUGIN_FONT_ID_ARIALUNI_60_1BPP 8
#define LV_PLUGIN_FONT_ID_ARIALUNI_86_1BPP 9
#define LV_PLUGIN_FONT_ID_ARIALUNI_106_1BPP 10
#define LV_PLUGIN_FONT_ID_SF_UI_TEXT_BOLD_20_8BPP 11
#define LV_PLUGIN_FONT_ID_SF_UI_TEXT_MEDIUM_18_8BPP 12
#define LV_PLUGIN_FONT_ID_SF_UI_TEXT_MEDIUM_16_8BPP 13
#define LV_PLUGIN_FONT_ID_NOTOSANS_BLACK_8_1BPP 14
#define LV_PLUGIN_FONT_TABLE_SIZE 15
#define LV_PLUGIN_STRING_ID_STRID_NULL_ 1
#define LV_PLUGIN_STRING_ID_STRID_MODE 2

View File

@ -711,7 +711,7 @@ static void UIFlowMenuCommonItem_Key(lv_obj_t* obj, uint32_t key)
static void UIFlowMenuCommonItem_ScrClose(lv_obj_t* obj)
{
DBG_DUMP("%s\r\n", __func__);
Save_MenuInfo();
LV_MenuItem_OnClose(obj);
}

View File

@ -11,6 +11,7 @@
**********************/
lv_obj_t* image_1_scr_uiflowpassword;
lv_obj_t* label_enter_scr_uiflowpassword;
lv_obj_t* button_matrix_password_scr_uiflowpassword;
lv_obj_t* label_select_scr_uiflowpassword;
lv_obj_t* label_password_1_scr_uiflowpassword;
lv_obj_t* label_tips_scr_uiflowpassword;
@ -143,6 +144,124 @@ lv_obj_t* UIFlowPassword_create(){
label_enter_scr_uiflowpassword = label_enter;
static lv_style_t button_matrix_password_s0;
lv_style_init(&button_matrix_password_s0);
lv_style_set_radius(&button_matrix_password_s0,LV_STATE_DEFAULT,0);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s0, LV_STATE_DEFAULT, color);
lv_style_set_border_width(&button_matrix_password_s0,LV_STATE_DEFAULT,0);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_border_color(&button_matrix_password_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x13, 0x44, 0xd1, 0xb6) ; lv_style_set_border_color(&button_matrix_password_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s0, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s0, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s0, LV_STATE_DISABLED, color);
static lv_style_t button_matrix_password_s1;
lv_style_init(&button_matrix_password_s1);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
lv_style_set_border_width(&button_matrix_password_s1,LV_STATE_DEFAULT,0);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_outline_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_shadow_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_pattern_recolor(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_value_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
lv_style_set_text_font(&button_matrix_password_s1,LV_STATE_DEFAULT,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&button_matrix_password_s1, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
lv_style_set_border_width(&button_matrix_password_s1,LV_STATE_CHECKED,0);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_outline_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_shadow_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_pattern_recolor(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_value_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&button_matrix_password_s1, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_outline_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_shadow_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_pattern_recolor(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_value_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&button_matrix_password_s1, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_outline_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_shadow_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_pattern_recolor(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_value_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&button_matrix_password_s1, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_outline_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_shadow_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_pattern_recolor(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_value_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&button_matrix_password_s1, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_outline_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_shadow_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_pattern_recolor(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_value_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&button_matrix_password_s1, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_bg_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0xe9, 0xdd, 0xdd, 0xdd) ; lv_style_set_border_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_outline_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_shadow_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_pattern_recolor(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_value_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0xd3, 0x3c, 0x3c, 0x3c) ; lv_style_set_text_sel_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&button_matrix_password_s1, LV_STATE_DISABLED, color);
lv_obj_t *button_matrix_password = lv_btnmatrix_create(image_1, NULL);
lv_obj_set_hidden(button_matrix_password, false);
lv_obj_set_click(button_matrix_password, true);
lv_obj_set_drag(button_matrix_password, false);
lv_obj_set_pos(button_matrix_password, 74, 159);
lv_obj_set_size(button_matrix_password, 174, 80);
static const char* button_matrix_password_LVGLPropertyBtnmatrixButtonsText[] = {"0","0","0","0","0","0",""};
lv_btnmatrix_set_map(button_matrix_password, button_matrix_password_LVGLPropertyBtnmatrixButtonsText);
lv_btnmatrix_set_one_check(button_matrix_password, false);
lv_btnmatrix_set_align(button_matrix_password, LV_LABEL_ALIGN_CENTER);
lv_btnmatrix_set_focused_btn(button_matrix_password,0);
lv_btnmatrix_set_one_check(button_matrix_password, true);
lv_obj_add_style(button_matrix_password, 0, &button_matrix_password_s0);
lv_obj_add_style(button_matrix_password, 1, &button_matrix_password_s1);
button_matrix_password_scr_uiflowpassword = button_matrix_password;
static lv_style_t label_select_s0;
lv_style_init(&label_select_s0);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_select_s0, LV_STATE_DEFAULT, color);

View File

@ -19,6 +19,7 @@ void UIFlowPasswordEventCallback(lv_obj_t* obj, lv_event_t event);
extern lv_obj_t* image_1_scr_uiflowpassword;
extern lv_obj_t* label_enter_scr_uiflowpassword;
extern lv_obj_t* button_matrix_password_scr_uiflowpassword;
extern lv_obj_t* label_select_scr_uiflowpassword;
extern lv_obj_t* label_password_1_scr_uiflowpassword;
extern lv_obj_t* label_tips_scr_uiflowpassword;

View File

@ -1,6 +1,30 @@
#include "PrjInc.h"
#include "UIFlowLVGL/UIFlowLVGL.h"
#include <stdio.h>
static int PasswordIndex = 0;
static int PasswordWrongTimes = 0;
// static lv_obj_t* button_matrix_password_scr_uiflowpassword = NULL;
static char PasswordBuf1[2] = {'0'};
static char PasswordBuf2[2] = {'0'};
static char PasswordBuf3[2] = {'0'};
static char PasswordBuf4[2] = {'0'};
static char PasswordBuf5[2] = {'0'};
static char PasswordBuf6[2] = {'0'};
#define PASSWORD_LENGTH 7
static char PwdStr[PASSWORD_LENGTH] = {'0'};
static const char* PasswordMap[7] =
{
PasswordBuf1,
PasswordBuf2,
PasswordBuf3,
PasswordBuf4,
PasswordBuf5,
PasswordBuf6,
""
};
static lv_group_t* gp = NULL;
static void set_indev_keypad_group(lv_obj_t* obj)
{
@ -15,11 +39,93 @@ static void set_indev_keypad_group(lv_obj_t* obj)
static void UIFlowPassword_ScrOpen(lv_obj_t* obj)
{
set_indev_keypad_group(obj);
memset(PwdStr, '0', sizeof(PwdStr));
PwdStr[PASSWORD_LENGTH - 1] = '\0';
lv_btnmatrix_set_map(button_matrix_password_scr_uiflowpassword, PasswordMap);
}
static void UIFlowPassword_ScrClose(lv_obj_t* obj)
{
}
void OpenPasswordScreen(void)
{
lv_plugin_scr_open(UIFlowPassword, NULL);
}
static void update_Password_msg(lv_obj_t* obj)
{
// UIMenuStoreInfo *puiPara = sf_ui_para_get();
snprintf(PasswordBuf1, 2, "%c", PwdStr[0]);
snprintf(PasswordBuf2, 2, "%c", PwdStr[1]);
snprintf(PasswordBuf3, 2, "%c", PwdStr[2]);
snprintf(PasswordBuf4, 2, "%c", PwdStr[3]);
snprintf(PasswordBuf5, 2, "%c", PwdStr[4]);
snprintf(PasswordBuf6, 2, "%c", PwdStr[5]);
lv_btnmatrix_set_focused_btn(button_matrix_password_scr_uiflowpassword, PasswordIndex);
}
static void UIFlowPassword_Key(lv_obj_t* obj, uint32_t key)
{
if(button_matrix_password_scr_uiflowpassword == NULL)
{
printf("button_matrix_password_scr_uiflowpassword is NULL");
return;
}
UIMenuStoreInfo *puiPara = sf_ui_para_get();
printf("key:%d\n",key);
switch(key)
{
case LV_USER_KEY_NEXT:
printf("\033[33m[UIFlowPassword_Key]s\033[0m\n");
if(PasswordIndex >= 0 && PasswordIndex <= 5)
{
PwdStr[PasswordIndex] = (PwdStr[PasswordIndex] - '0' + 10 - 1) % 10 + '0';
}
update_Password_msg(obj);
break;
case LV_USER_KEY_PREV:
printf("\033[33m[UIFlowPassword_Key]w\033[0m\n");
if(PasswordIndex >= 0 && PasswordIndex <= 5)
{
PwdStr[PasswordIndex] = (PwdStr[PasswordIndex] - '0' + 1) % 10 + '0';
}
update_Password_msg(obj);
break;
case LV_USER_KEY_LEFT:
printf("\033[33m[UIFlowPassword_Key]a\033[0m\n");
PasswordIndex = (PasswordIndex + 6 - 1) % 6;
lv_obj_set_pos(label_select_scr_uiflowpassword, 74 + 32 * PasswordIndex, 139);
update_Password_msg(obj);
break;
case LV_USER_KEY_RIGHT:
printf("\033[33m[UIFlowPassword_Key]d\033[0m\n");
PasswordIndex = (PasswordIndex + 1) % 6;
lv_obj_set_pos(label_select_scr_uiflowpassword, 74 + 32 * PasswordIndex, 139);
update_Password_msg(obj);
break;
case LV_KEY_ENTER:
// printf("\033[33m[UIFlowPassword_Key]SELECT\033[0m\n");
// puiPara->PwdSwitch = 1;
// lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0));
// hidde_Password_page();
printf("PwdStr = %s, puiPara->PwdStr = %s\n", PwdStr, puiPara->PwdStr);
if(0 == memcmp(PwdStr, puiPara->PwdStr, PASSWORD_LENGTH - 1))
{
printf("password is right.\n");
lv_plugin_scr_close(obj, NULL);
}
else
{
printf("password is wrong.\n");
PasswordWrongTimes ++;
}
break;
default:
break;
}
}
void UIFlowPasswordEventCallback(lv_obj_t* obj, lv_event_t event)
{
printf(" UIFlowPasswordEventCallback %d\n", event);
@ -31,6 +137,7 @@ printf(" UIFlowPasswordEventCallback %d\n", event);
break;
case LV_PLUGIN_EVENT_SCR_CLOSE:
UIFlowPassword_ScrClose(obj);
break;
case LV_PLUGIN_EVENT_CHILD_SCR_CLOSE:
@ -45,6 +152,8 @@ printf(" UIFlowPasswordEventCallback %d\n", event);
{
uint32_t* key = (uint32_t*)lv_event_get_data();
UIFlowPassword_Key(obj, *key);
/* default to block next key event until released, could be removed depend on use cases. */
if(key && *key != LV_KEY_ENTER)
lv_indev_wait_release(lv_indev_get_act());

View File

@ -1095,7 +1095,7 @@ lv_obj_t* UIFlowPhoto_create(){
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_2_s0, LV_STATE_CHECKED, color);
lv_style_set_text_font(&label_2_s0,LV_STATE_CHECKED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_2_s0, LV_STATE_CHECKED, color);
@ -1224,7 +1224,7 @@ lv_obj_t* UIFlowPhoto_create(){
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_3_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_3_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_CHECKED, color);

View File

@ -1524,12 +1524,16 @@ static void UIFlowPhoto_KeyRelease(lv_obj_t* obj, uint32_t key)
void UIFlowPhotoEventCallback(lv_obj_t* obj, lv_event_t event)
{
#define PASSWORD_SWITCH_ON 1
UIMenuStoreInfo *puiPara = sf_ui_para_get();
switch(event)
{
case LV_PLUGIN_EVENT_SCR_OPEN:
UIFlowPhoto_ScrOpen(obj);
// OpenPasswordScreen();
if(PASSWORD_SWITCH_ON == puiPara->PwdSwitch)
{
OpenPasswordScreen();
}
#if HUNTING_CAMERA_MCU == ENABLE
UIMenuStoreInfo *puiPara = sf_ui_para_get();
if((puiPara->CamMode == SF_CAM_MODE_PHOTO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO))