mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
加入语言切换
This commit is contained in:
@@ -132,7 +132,20 @@ void ui_set_page_key_handler(void *key_event)
|
|||||||
|
|
||||||
// language
|
// language
|
||||||
case 2:
|
case 2:
|
||||||
// do nothing
|
// key yes
|
||||||
|
if (((key_event_t*)key_event)->id == KEY_ID_Y && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||||
|
{
|
||||||
|
lv_obj_add_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||||
|
ui_set_language_select(1);
|
||||||
|
lv_i18n_set_locale("en");
|
||||||
|
}
|
||||||
|
// key neg
|
||||||
|
else if (((key_event_t*)key_event)->id == KEY_ID_N && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||||
|
{
|
||||||
|
lv_obj_clear_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||||
|
ui_set_language_select(0);
|
||||||
|
lv_i18n_set_locale("zh-cn");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// chose rotation
|
// chose rotation
|
||||||
@@ -201,6 +214,12 @@ static void _setting_init(void) {
|
|||||||
else
|
else
|
||||||
lv_obj_clear_state(ui_SwitchKS, LV_STATE_CHECKED);
|
lv_obj_clear_state(ui_SwitchKS, LV_STATE_CHECKED);
|
||||||
|
|
||||||
|
// language
|
||||||
|
if(ui_get_language_select() == 1)
|
||||||
|
lv_obj_add_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||||
|
else
|
||||||
|
lv_obj_clear_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||||
|
|
||||||
// lcd rotation
|
// lcd rotation
|
||||||
uint16_t rotation = ui_get_display_rotation();
|
uint16_t rotation = ui_get_display_rotation();
|
||||||
if (rotation == 0) {
|
if (rotation == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user