#if 1 // ui
+
+static uint8_t s_hengai_sleep_data_init = 0;
+static nv_watch_hengai_sleep_data_t s_hengai_sleep_data = {0};
+
+void mmi_hengai_sleep_data_nv_write(void)
+{
+ uint32_t nv_data_length = sizeof(nv_watch_hengai_sleep_data_t);
+
+ if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_HENGAI_SLEEP_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_sleep_data))
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__);
+ }
+}
+
+void mmi_hengai_sleep_data_nv_read(void)
+{
+ uint32_t nv_data_length = sizeof(nv_watch_hengai_sleep_data_t);
+
+ if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HENGAI_SLEEP_DATA, 0, nv_data_length, (uint8_t *)&s_hengai_sleep_data))
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__);
+ _lv_memset_00(&s_hengai_sleep_data, sizeof(nv_watch_hengai_sleep_data_t));
+ }
+}
+
+void mmi_hengai_sleep_data_set(sleep_data_t * data) // (nv_watch_hengai_sleep_data_t * data)
+{
+ unsigned char i = 0;
+
+ if(NULL == data)
+ return;
+
+ if(false == s_sleep_data_in_same_cycle)
+ {
+ HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+ s_sleep_data_in_same_cycle = true;
+
+ s_hengai_sleep_data.total_sleep_time = data->total_sleep_time;
+
+ s_hengai_sleep_data.begin_sleep_time.year = data->begin_sleep_time.year;
+ s_hengai_sleep_data.begin_sleep_time.month = data->begin_sleep_time.month;
+ s_hengai_sleep_data.begin_sleep_time.day = data->begin_sleep_time.day;
+ s_hengai_sleep_data.begin_sleep_time.hour = data->begin_sleep_time.hour;
+ s_hengai_sleep_data.begin_sleep_time.minute = data->begin_sleep_time.minute;
+
+ s_hengai_sleep_data.end_sleep_time.year = data->end_sleep_time.year;
+ s_hengai_sleep_data.end_sleep_time.month = data->end_sleep_time.month;
+ s_hengai_sleep_data.end_sleep_time.day = data->end_sleep_time.day;
+ s_hengai_sleep_data.end_sleep_time.hour = data->end_sleep_time.hour;
+ s_hengai_sleep_data.end_sleep_time.minute = data->end_sleep_time.minute;
+
+ for(i = 0; i < data->state_count; i++)
+ {
+ if(NV_LS_STATE == data->data[i].state)
+ s_hengai_sleep_data.state_duration[0] = data->data[i].duration;
+ else if(NV_DS_STATE == data->data[i].state)
+ s_hengai_sleep_data.state_duration[1] = data->data[i].duration;
+ else if(NV_REM_STATE == data->data[i].state)
+ s_hengai_sleep_data.state_duration[2] = data->data[i].duration;
+ }
+ }
+ else
+ {
+ HENGAI_HEALTH_UART_LOG("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+ s_hengai_sleep_data.total_sleep_time += data->total_sleep_time;
+
+ s_hengai_sleep_data.end_sleep_time.year = data->end_sleep_time.year;
+ s_hengai_sleep_data.end_sleep_time.month = data->end_sleep_time.month;
+ s_hengai_sleep_data.end_sleep_time.day = data->end_sleep_time.day;
+ s_hengai_sleep_data.end_sleep_time.hour = data->end_sleep_time.hour;
+ s_hengai_sleep_data.end_sleep_time.minute = data->end_sleep_time.minute;
+
+ for(i = 0; i < data->state_count; i++)
+ {
+ if(NV_LS_STATE == data->data[i].state)
+ s_hengai_sleep_data.state_duration[0] += data->data[i].duration;
+ else if(NV_DS_STATE == data->data[i].state)
+ s_hengai_sleep_data.state_duration[1] += data->data[i].duration;
+ else if(NV_REM_STATE == data->data[i].state)
+ s_hengai_sleep_data.state_duration[2] += data->data[i].duration;
+ }
+ }
+ mmi_hengai_sleep_data_nv_write();
+}
+
+
+static const lv_point_t s_sleep_valid_pos[] = {{0, 0}, {0, 1}};
+
+lv_obj_t * mmi_sleep_tileview_add_tile(lv_obj_t * tileview, uint16_t id)
+{
+ lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
+ lv_obj_t * cont = lv_cont_create(tileview, NULL);
+ lv_obj_add_style(cont, LV_CONT_PART_MAIN, &lv_style_transp_tight);
+ lv_obj_set_size(cont, LV_HOR_RES, LV_VER_RES);
+ lv_obj_set_y(cont, LV_HOR_RES * ext->valid_pos[id].y);
+ lv_tileview_add_element(tileview, cont);
+ lv_obj_set_click(cont, false);
+ return cont;
+}
+
+static void mmi_sleep_period_str_get(char * str_buf, unsigned int buf_len, unsigned int total_value)
+{
+ unsigned int hour_value = 0;
+ unsigned int minute_value = 0;
+
+ if(NULL == str_buf || 32 > buf_len)
+ return;
+
+ hour_value = total_value / 60;
+ minute_value = total_value % 60;
+ if(0 == hour_value && 0== minute_value)
+ {
+ sprintf(str_buf, "--");
+ }
+ else if(0 == hour_value)
+ {
+ sprintf(str_buf, "%d%s",
+ minute_value,
+ lv_lang_get_text(WATCH_TEXT_ID_ACT_MIN));
+ }
+ else if(0 == minute_value)
+ {
+ sprintf(str_buf, "%d%s",
+ hour_value,
+ lv_lang_get_text(WATCH_TEXT_ID_ACT_HOUR));
+ }
+ else
+ {
+ sprintf(str_buf, "%d%s %d%s",
+ hour_value,
+ lv_lang_get_text(WATCH_TEXT_ID_ACT_HOUR),
+ minute_value,
+ lv_lang_get_text(WATCH_TEXT_ID_ACT_MIN));
+ }
+}
+
+lv_obj_t * mmi_sleep_second_tab_create(lv_obj_t * tileview, uint16_t id)
+{
+ char temp_buf[128 + 1] = {0};
+ lv_obj_t * tab = mmi_sleep_tileview_add_tile(tileview, id);
+ LV_ASSERT_MEM(tab);
+ if(tab == NULL)
+ return NULL;
+
+ lv_obj_t * cont = lv_cont_create(tab, NULL);
+ lv_obj_set_size(cont, lv_obj_get_width(tab), lv_obj_get_height(tab));
+ lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+ lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ lv_watch_obj_add_element(cont);
+ lv_tileview_add_element(tileview, cont);
+
+ // deep sleep period
+ lv_obj_t * img_deep_sleep = lv_img_create(cont, NULL);
+ lv_img_set_src(img_deep_sleep, ICON_SLEEP_PROMPT);
+ lv_obj_align(img_deep_sleep, NULL, LV_ALIGN_IN_TOP_LEFT, 80, 55);
+
+ lv_obj_t * label_deep_sleep = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_deep_sleep, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+ lv_label_set_text_id(label_deep_sleep, WATCH_TEXT_ID_DEEP_SLEEP);
+ lv_label_set_long_mode(label_deep_sleep, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_deep_sleep, LV_HOR_RES / 2);
+ lv_label_set_align(label_deep_sleep, LV_LABEL_ALIGN_LEFT);
+ //lv_obj_align(label_deep_sleep, NULL, LV_ALIGN_IN_TOP_MID, 0, 40);
+ lv_obj_align(label_deep_sleep, img_deep_sleep, LV_ALIGN_OUT_RIGHT_TOP, 15, -10);
+
+ lv_obj_t * label_ds_value = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_ds_value, LV_LABEL_PART_MAIN, &lv_watch_font30);
+ mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.state_duration[1]);
+ lv_label_set_text(label_ds_value, temp_buf);
+ lv_label_set_long_mode(label_ds_value, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_ds_value, LV_HOR_RES / 2);
+ lv_label_set_align(label_ds_value, LV_LABEL_ALIGN_LEFT);
+ //lv_obj_align(label_ds_value, label_deep_sleep, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+ lv_obj_align(label_ds_value, img_deep_sleep, LV_ALIGN_OUT_RIGHT_TOP, 17, 55);
+
+
+ // light sleep period
+ lv_obj_t * img_light_sleep = lv_img_create(cont, NULL);
+ lv_img_set_src(img_light_sleep, ICON_SLEEP_PROMPT);
+ lv_obj_align(img_light_sleep, NULL, LV_ALIGN_IN_TOP_LEFT, 80, 55 + 140);
+
+ lv_obj_t * label_light_sleep = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_light_sleep, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+ lv_label_set_text_id(label_light_sleep, WATCH_TEXT_ID_LIGHT_SLEEP);
+ lv_label_set_long_mode(label_light_sleep, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_light_sleep, LV_HOR_RES / 2);
+ lv_label_set_align(label_light_sleep, LV_LABEL_ALIGN_LEFT);
+ //lv_obj_align(label_light_sleep, NULL, LV_ALIGN_CENTER, 0, -25);
+ lv_obj_align(label_light_sleep, img_light_sleep, LV_ALIGN_OUT_RIGHT_TOP, 15, -10);
+
+ lv_obj_t * label_ls_value = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_ls_value, LV_LABEL_PART_MAIN, &lv_watch_font30);
+ mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.state_duration[0]);
+ lv_label_set_text(label_ls_value, temp_buf);
+ lv_label_set_long_mode(label_ls_value, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_ls_value, LV_HOR_RES / 2);
+ lv_label_set_align(label_ls_value, LV_LABEL_ALIGN_LEFT);
+ //lv_obj_align(label_ls_value, label_light_sleep, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+ lv_obj_align(label_ls_value, img_light_sleep, LV_ALIGN_OUT_RIGHT_TOP, 17, 55);
+
+
+ // rem sleep period
+ lv_obj_t * img_rem_sleep = lv_img_create(cont, NULL);
+ lv_img_set_src(img_rem_sleep, ICON_SLEEP_PROMPT);
+ lv_obj_align(img_rem_sleep, NULL, LV_ALIGN_IN_TOP_LEFT, 80, 55 + 140 + 140);
+
+ lv_obj_t * label_rem_sleep = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_rem_sleep, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+ lv_label_set_text_id(label_rem_sleep, WATCH_TEXT_ID_REM_SLEEP);
+ lv_label_set_long_mode(label_rem_sleep, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_rem_sleep, LV_HOR_RES / 2);
+ lv_label_set_align(label_rem_sleep, LV_LABEL_ALIGN_LEFT);
+ //lv_obj_align(label_rem_sleep, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -95);
+ lv_obj_align(label_rem_sleep, img_rem_sleep, LV_ALIGN_OUT_RIGHT_TOP, 15, -10);
+
+ lv_obj_t * label_rem_value = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_rem_value, LV_LABEL_PART_MAIN, &lv_watch_font30);
+ mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.state_duration[2]);
+ lv_label_set_text(label_rem_value, temp_buf);
+ lv_label_set_long_mode(label_rem_value, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_rem_value, LV_HOR_RES / 2);
+ lv_label_set_align(label_rem_value, LV_LABEL_ALIGN_LEFT);
+ //lv_obj_align(label_rem_value, label_rem_sleep, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+ lv_obj_align(label_rem_value, img_rem_sleep, LV_ALIGN_OUT_RIGHT_TOP, 17, 55);
+
+ return tab;
+}
+
+static lv_obj_t * mmi_sleep_first_tab_create(lv_obj_t * tileview, uint16_t id)
+{
+ char temp_buf[128 + 1] = {0};
+ lv_obj_t * tab = mmi_sleep_tileview_add_tile(tileview, id);
+ LV_ASSERT_MEM(tab);
+ if(tab == NULL)
+ return NULL;
+
+ lv_obj_t * cont = lv_cont_create(tab, NULL);
+ lv_obj_set_size(cont, lv_obj_get_width(tab), lv_obj_get_height(tab));
+ lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+ lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ lv_watch_obj_add_element(cont);
+ lv_tileview_add_element(tileview, cont);
+
+ // setting period
+ lv_obj_t * label_sleep_period = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_sleep_period, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+ lv_label_set_text_id(label_sleep_period, WATCH_TEXT_ID_SLEEP_SETTING);
+ lv_label_set_long_mode(label_sleep_period, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_sleep_period, LV_HOR_RES * 2 / 3);
+ lv_label_set_align(label_sleep_period, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_sleep_period, NULL, LV_ALIGN_IN_TOP_MID, 0, 40);
+
+ nv_watch_sleep_time_t sleep_setting_data = {0};
+ mmi_watch_sleep_time_data_get(&sleep_setting_data);
+ sprintf(temp_buf, "%02d:%02d-%02d:%02d",
+ sleep_setting_data.begin_hour,
+ sleep_setting_data.begin_min,
+ sleep_setting_data.end_hour,
+ sleep_setting_data.end_min);
+
+ lv_obj_t * label_sleep_period_value = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_sleep_period_value, LV_LABEL_PART_MAIN, &lv_watch_font40);
+ lv_label_set_text(label_sleep_period_value, temp_buf);
+ lv_label_set_long_mode(label_sleep_period_value, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_sleep_period_value, LV_HOR_RES * 2 / 3);
+ lv_label_set_align(label_sleep_period_value, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_sleep_period_value, label_sleep_period, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+
+
+ // total period
+ lv_obj_t * label_total_period = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_total_period, LV_LABEL_PART_MAIN, &lv_watch_font40_gray);
+ lv_label_set_text_id(label_total_period, WATCH_TEXT_ID_SLEEP_PERIOD);
+ lv_label_set_long_mode(label_total_period, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_total_period, LV_HOR_RES * 2 / 3);
+ lv_label_set_align(label_total_period, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_total_period, NULL, LV_ALIGN_CENTER, 0, -20);
+
+ lv_obj_t * label_total_value = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_total_value, LV_LABEL_PART_MAIN, &lv_watch_font40);
+ mmi_sleep_period_str_get(temp_buf, 128, s_hengai_sleep_data.total_sleep_time);
+ lv_label_set_text(label_total_value, temp_buf);
+ lv_label_set_long_mode(label_total_value, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_total_value, LV_HOR_RES * 2 / 3);
+ lv_label_set_align(label_total_value, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_total_value, label_total_period, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+
+
+ // update time
+ if(0 != s_hengai_sleep_data.total_sleep_time
+ //&& (0 != s_hengai_sleep_data.end_sleep_time.hour
+ // || 0 != s_hengai_sleep_data.end_sleep_time.minute
+ // )
+ )
+ {
+ lv_obj_t * label_prompt = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26);
+ lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_SLEEP_INFO_UPDATE_TIME);
+ lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_prompt, LV_HOR_RES / 2);
+ lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -70);
+
+ snprintf(temp_buf, 128, "%04d.%02d.%02d %02d:%02d",
+ s_hengai_sleep_data.end_sleep_time.year,
+ s_hengai_sleep_data.end_sleep_time.month,
+ s_hengai_sleep_data.end_sleep_time.day,
+ s_hengai_sleep_data.end_sleep_time.hour,
+ s_hengai_sleep_data.end_sleep_time.minute);
+
+ lv_obj_t * label_info = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_info, LV_LABEL_PART_MAIN, &lv_watch_font26);
+ lv_label_set_text(label_info, temp_buf);
+ lv_label_set_long_mode(label_info, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_info, LV_HOR_RES * 2 / 3);
+ lv_label_set_align(label_info, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_info, label_prompt, LV_ALIGN_OUT_BOTTOM_MID, 0, 8);
+ }
+ else
+ {
+ lv_obj_t * label_prompt = lv_label_create(cont, NULL);
+ lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26_gray);
+ lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_NO_DATA_NOW);
+ lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_SROLL);
+ lv_obj_set_width(label_prompt, LV_HOR_RES / 2);
+ lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_prompt, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -30);
+ }
+
+ //
+ lv_obj_t * label_up = lv_label_create(cont, NULL);
+ lv_label_set_text(label_up, LV_SYMBOL_UP);
+ lv_obj_align(label_up, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -5);
+
+ return tab;
+}
+
+void mmi_sleep_display_create(lv_obj_t * obj)
+{
+ lv_obj_t * tileview = lv_tileview_create(obj, NULL);
+ //lv_sleep_drop_pull_obj_ext_t * ext_drop = lv_obj_allocate_ext_attr(tileview, sizeof(lv_sleep_drop_pull_obj_ext_t));
+ //(void)ext_drop;
+ LV_ASSERT_MEM(tileview);
+ lv_tileview_set_valid_positions(tileview, s_sleep_valid_pos, sizeof(s_sleep_valid_pos) / sizeof(s_sleep_valid_pos[0]));
+ lv_tileview_set_edge_flash(tileview, true);
+ lv_tileview_set_anim_time(tileview, 60);
+ lv_page_set_scrollbar_mode(tileview, LV_SCROLLBAR_MODE_OFF);
+ lv_obj_add_style(tileview, LV_TILEVIEW_PART_EDGE_FLASH, &lv_watch_cont_opa1);
+
+ lv_obj_t * tab;
+ tab = mmi_sleep_first_tab_create(tileview, 0);
+ LV_ASSERT_MEM(tab);
+ if(tab == NULL)
+ return NULL;
+
+ tab = mmi_sleep_second_tab_create(tileview, 1);
+ LV_ASSERT_MEM(tab);
+ if(tab == NULL)
+ return NULL;
+
+ lv_tileview_set_tile_act(tileview, 0, 0, false);
+ lv_watch_obj_add_element(tileview);
+ lv_watch_obj_add_element(lv_page_get_scrl(tileview));
+}
+
+void mmi_sleep_no_setting_create(lv_obj_t * obj)
+{
+ lv_obj_t * cont = lv_cont_create(obj, NULL);
+ lv_obj_set_size(cont, lv_obj_get_width(obj), lv_obj_get_height(obj));
+ lv_obj_align(cont, NULL, LV_ALIGN_CENTER, 0, 0);
+ lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
+ lv_watch_obj_add_element(cont);
+
+ lv_obj_t * label_prompt = lv_label_create(cont, NULL);
+#ifdef USE_LV_WATCH_UI_466_466
+ lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font40);
+#else
+ lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+#endif
+ lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_SLEEP_SET_PROMPT);
+ lv_label_set_long_mode(label_prompt, LV_LABEL_LONG_BREAK);
+ lv_obj_set_width(label_prompt, LV_HOR_RES * 4 / 5);
+ lv_label_set_align(label_prompt, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label_prompt, cont, LV_ALIGN_CENTER, 0, -10);
+
+ //lv_obj_set_hidden(label_no, true);
+}
+
+void mmi_sleep_prepare_destory(lv_obj_t * activity_obj)
+{
+ printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+ lv_watch_png_cache_all_free();
+
+ //lv_hengai_sleep_ext_t * ext = wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
+ //if(NULL == ext)
+ return ;
+}
+
+lv_obj_t * mmi_sleep_create(lv_obj_t * activity_obj)
+{
+ printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+
+ if(activity_obj == NULL)
+ {
+ lv_watch_activity_ext_t activity_ext;
+
+ _lv_memset_00(&activity_ext, sizeof(lv_watch_activity_ext_t));
+ activity_ext.actId = ACT_ID_SLEEP;
+ activity_ext.create = (lv_watch_activity_create_f_t)mmi_sleep_create;
+ activity_ext.prepare_destory = mmi_sleep_prepare_destory;
+ activity_obj = lv_watch_creat_activity_obj(&activity_ext);
+ LV_ASSERT_MEM(activity_obj);
+ }
+
+ lv_obj_t * obj = lv_watch_obj_create(activity_obj);
+ if(NULL == obj)
+ return NULL;
+ /*Allocate the tab type specific extended data*/
+ //lv_hengai_sleep_ext_t * ext = lv_obj_allocate_ext_attr(obj, sizeof(lv_hengai_sleep_ext_t));
+ //if(NULL == ext)
+ // return NULL;
+
+ if(false == mmi_watch_sleep_switch_is_on())
+ {
+ mmi_sleep_no_setting_create(obj);
+ }
+ else
+ {
+ mmi_sleep_display_create(obj);
+ }
+
+ return obj;
+}
+
+void mmi_sleep_create_event_cb(lv_obj_t * btn, lv_event_t e)
+{
+ if(LV_EVENT_CLICKED == e)
+ {
+ if(0 == s_hengai_sleep_data_init)
+ {
+ mmi_hengai_sleep_data_nv_read();
+ s_hengai_sleep_data_init = 1;
+ }
+
+ #if 0 // for debug
+ s_hengai_sleep_data.total_sleep_time = 631;
+
+ s_hengai_sleep_data.begin_sleep_time.year = 2024,
+ s_hengai_sleep_data.begin_sleep_time.month = 10,
+ s_hengai_sleep_data.begin_sleep_time.day = 12,
+ s_hengai_sleep_data.begin_sleep_time.hour = 22,
+ s_hengai_sleep_data.begin_sleep_time.minute = 36;
+
+ s_hengai_sleep_data.end_sleep_time.year = 2024,
+ s_hengai_sleep_data.end_sleep_time.month = 10,
+ s_hengai_sleep_data.end_sleep_time.day = 13,
+ s_hengai_sleep_data.end_sleep_time.hour = 8,
+ s_hengai_sleep_data.end_sleep_time.minute = 12;
+
+ s_hengai_sleep_data.state_duration[0] = 180;
+ //s_hengai_sleep_data.state_duration[1] = 59;
+ s_hengai_sleep_data.state_duration[2] = 392;
+ #endif
+
+ lv_watch_png_cache_all_free();
+ lv_obj_t * obj = mmi_sleep_create(NULL);
+ LV_ASSERT_MEM(obj);
+ }
+}
+
+#else
+
static uint8_t s_hengai_sleep_data_init = 0;
static nv_watch_hengai_sleep_data_t s_hengai_sleep_data = {0};