GUI show auto off time.

This commit is contained in:
xiaojiazhu 2023-10-19 13:51:19 +08:00
parent c4dffcd1c1
commit 9373577880
7 changed files with 68 additions and 13 deletions

View File

@ -184,6 +184,7 @@ void UIFlowMenuCommonConfirm_OnChildScrClose(lv_obj_t* obj, const LV_USER_EVENT_
}
}
static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint32_t* value);
/***************************************************************************
*
@ -216,14 +217,19 @@ static void UIFlowMenuCommonConfirm_MessageBox_Key(lv_obj_t* obj, uint32_t key)
break;
}
// case LV_USER_KEY_SHUTTER2:
// {
case LV_USER_KEY_SHUTTER2:
{
// if(gp){
// // printf("ssssssssssssssssssssssssssss send enter key.\n");
// lv_group_send_data(gp, LV_USER_KEY_SHUTTER2);
// lv_group_send_data(gp, LV_KEY_ENTER);
// }
// break;
// }
static int todo = 8;
lv_event_send(obj, LV_EVENT_CLICKED, &todo);
break;
// uint32_t todo = 0;
// UIFlowMenuCommonConfirm_MessageBox_ValueChanged(obj, &todo);
break;
}
}
}
@ -232,14 +238,15 @@ static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint3
{
if(NULL == value)
return;
printf("============== value = %d\n", *value);
if (*value == 0) {
const char* msgbox_text = lv_msgbox_get_text(obj);
const char* erase_text = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRID_ERASE_THIS)->ptr;
if(strcmp(msgbox_text, erase_text) == 0){
#if(PLAY_MODE)
printf("delete file.\n");
// #if(PLAY_MODE)
UINT32 uiLockStatus;
PB_GetParam(PBPRMID_FILE_ATTR_LOCK, &uiLockStatus);
if (uiLockStatus) {
@ -250,7 +257,7 @@ static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint3
}
UIPlay_Delete(PB_DELETE_ONE);
UIPlay_PlaySingle(PB_SINGLE_CURR);
#endif
// #endif
UIFlowMenuCommonConfirm_CloseScr();
@ -352,7 +359,9 @@ void message_box_confirm_msg_event_callback(lv_obj_t* obj, lv_event_t event)
/* triggered by button release */
case LV_EVENT_VALUE_CHANGED:
case LV_EVENT_CLICKED:
{
printf("=============================================================== LV_EVENT_VALUE_CHANGED\n");
UIFlowMenuCommonConfirm_MessageBox_ValueChanged(obj, (uint32_t*)lv_event_get_data());
break;
}

View File

@ -1263,6 +1263,12 @@ static void task_update_icons_timer_cb(lv_task_t* task)
{
// printf(" task_update_icons_timer_cb\n ");
update_icons();
UINT16 autoOffTime = sf_get_auto_off_time();
if (autoOffTime >= 160)
{
// printf("tttttttttttttttttttttttttttttttttttt time = %d\n", autoOffTime);
UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRID_PLEASE_INSERT_SD, 1000 * 30);
}
return;
}

View File

@ -1203,6 +1203,7 @@ static void play_video(lv_obj_t *obj)
printf("now sotp play the video.\n");
g_PlbData.State = PLB_ST_FULL;
lv_plugin_img_set_src(image_play_scr_uiflowplay, LV_PLUGIN_IMG_ID_SF_STOP);
lv_label_set_text_fmt(label_playtime_scr_uiflowplay, "%02d:%02d", 0, 0);
g_PlbData.VideoPBSpeed = PLB_FWD_MOV_1x;
// Close MoviePlay module.

View File

@ -9,6 +9,9 @@
static lv_group_t* gp = NULL;
static lv_obj_t* msgbox = NULL;
// static const char* btn_map[2] = {NULL, ""};
static lv_task_t* msgbox_timer = NULL;
static lv_plugin_res_id msgID = -1;
static uint16_t autoClose = 0;
static NVTEVT evt = NVTEVT_NULL;
@ -23,12 +26,34 @@ static void set_indev_keypad_group(lv_obj_t* obj)
lv_indev_set_group(indev, gp);
}
static void task_msgbox_timer_cb(lv_task_t* task)
{
#define BUF_LENGTH 256
char buf[BUF_LENGTH] = {0};
printf(" task_msgbox_timer_cb\n ");
// LV_PLUGIN_STRING_ID_STRID_PLEASE_INSERT_SD
if(LV_PLUGIN_STRING_ID_STRID_PLEASE_INSERT_SD == msgID)
{
const lv_plugin_string_t* string = lv_plugin_get_string(msgID);
if(string){
snprintf(buf, BUF_LENGTH, "%s (%d)", string->ptr, autoClose/1000);
lv_msgbox_set_text(msgbox, buf);
}
autoClose = autoClose - 1000;
}
// update_icons();
return;
}
void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_time_ms)
{
if(msgbox){
DBG_WRN("warning message box is already opened and not closed yet, ignore request");
return;
}
msgID = id;
autoClose = auto_close_time_ms;
#if (DRAM_SIZE_64MB_DISP_OFF == ENABLE)
{
return;
@ -83,6 +108,9 @@ void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_tim
}
set_indev_keypad_group(msgbox);
if(msgbox_timer == NULL){
msgbox_timer = lv_task_create(task_msgbox_timer_cb, 1000, LV_TASK_PRIO_MID, NULL);
}
lv_plugin_scr_open(UIFlowWrnMsg, NULL);
}
@ -132,6 +160,11 @@ void UIFlowWrnMsgEventCallback(lv_obj_t* obj, lv_event_t event)
void UIFlowWrnMsg_CloseScr(NVTEVT e)
{
if(msgbox_timer){
lv_task_del(msgbox_timer);
msgbox_timer = NULL;
// update_selftimer();
}
evt = e;
lv_msgbox_start_auto_close(msgbox, 0);
}

View File

@ -21,6 +21,7 @@ void sf_set_pir_power_off_flag(BOOL flag);
BOOL sf_get_pir_statu_flag(void);
void sf_set_pir_statu_flag(BOOL flag);
void sf_set_auto_off_time(UINT16 time);
UINT16 sf_get_auto_off_time(void);
UINT8 sf_get_fw_update(void);
void sf_set_fw_update(UINT8 flag);
UINT8 sf_get_module_update(void);

View File

@ -158,6 +158,11 @@ void sf_set_auto_off_time(UINT16 time)
AutoOfftime = time;
}
UINT16 sf_get_auto_off_time(void)
{
return AutoOfftime;
}
void sf_set_wifi_socket(int fd)
{
WifiSocket = fd;