From: CCC <2393524978@qq.com> Date: Thu, 31 Aug 2023 09:42:43 +0000 (+0800) Subject: gengxin X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=ac2e1f2bb1f87fcf3f2ccab8e0350e5ad04fd295;p=mirrors%2FASR3603_Z5.git gengxin --- diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/alipay/alipay.c b/2.sdk/sdk/gui/lv_watch/lv_apps/alipay/alipay.c index f99dbe61..d1ef9568 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/alipay/alipay.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/alipay/alipay.c @@ -279,7 +279,7 @@ void mmi_identify_info_do(void) strcpy(identify_info.company_name, "ZHIHSX"); ret = aos_set_identify_info(&identify_info); - ALIPAY_DEBUG_PRINTF("[%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); + ALIPAY_DEBUG_PRINTF("[%s][%d]: ret=%d,imei=%s\n", __FUNCTION__, __LINE__, ret, imei); } #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/camera/camera.c b/2.sdk/sdk/gui/lv_watch/lv_apps/camera/camera.c index 58128f91..0e14c1ba 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/camera/camera.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/camera/camera.c @@ -627,8 +627,8 @@ static void camera_shoot_btn_event_cb(lv_obj_t * btn, lv_event_t e) cam_capture_t cap_param; int32_t error = CRANE_CAMERA_ERROR_NONE; - cap_param.width = 240; - cap_param.height = 240; + cap_param.width = 240; // LV_HOR_RES + cap_param.height = 240; // LV_VER_RES album_photo_info_t * pnode = NULL; pnode = (album_photo_info_t *)_lv_ll_ins_tail((lv_ll_t *)album_get_photo_ll()); diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.c b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.c index 032f2fbe..e782f49e 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.c @@ -1765,7 +1765,7 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) return NULL; } - ext->title = NULL; + //ext->title = NULL; ext->list = NULL; /* content */ @@ -1783,9 +1783,9 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_text_id(label, WATCH_TEXT_ID_VIDEOCALL); - lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 5); + lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); lv_obj_set_click(label, false); - ext->title = label; + //ext->title = label; lv_obj_t * list = lv_list_create(content, NULL); if(list == NULL) @@ -1820,29 +1820,6 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) strcpy(t_str, s_vc_contact.number[i]); #if 0 - btn = lv_list_add_btn(list, NULL, t_str); - lv_page_glue_obj(btn, true); - //lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST); - lv_obj_set_event_cb(btn, mmi_vc_dial_btn_screen); - lv_watch_obj_add_element(btn); - - lv_obj_set_style_local_bg_color(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_pad_top(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 6); - lv_obj_set_style_local_pad_bottom(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 6); - lv_obj_set_style_local_pad_left(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 15); - lv_obj_set_style_local_pad_right(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 15); - lv_obj_set_style_local_pad_inner(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 10); - - //lv_obj_set_size(btn, lv_obj_get_width(list), 80); //56); - - //label = lv_obj_get_child(btn, NULL); - //label = lv_list_get_btn_label(btn); - //lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND); - //lv_label_set_text(label, t_str); - //lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); - //lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0); - #else - btn = lv_list_add_btn(list, NULL, NULL); //lv_page_glue_obj(btn, true); //lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST); @@ -1866,9 +1843,35 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); lv_obj_set_click(label, false); //lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0); - #endif lv_watch_set_free_num(btn, i); + #else + + btn = lv_list_add_btn(list, NULL, NULL); + lv_btn_set_layout(btn, LV_LAYOUT_ROW_MID); + //lv_obj_set_event_cb(btn, mmi_vc_dial_btn_screen); + //lv_watch_set_free_num(btn, i); + + lv_obj_t * cont = lv_cont_create(btn, NULL); + lv_cont_set_layout(cont, LV_LAYOUT_OFF); + lv_obj_set_width(cont, lv_obj_get_width(btn)); + lv_obj_set_height(cont, 56); // LV_VER_RES / 4); //lv_obj_get_height(btn)); + lv_obj_add_style(cont, LV_CONT_PART_MAIN, &lv_style_transp); + lv_page_glue_obj(cont, true); + lv_watch_obj_add_element(cont); + lv_obj_set_click(cont, true); + lv_obj_set_event_cb(cont, mmi_vc_dial_btn_screen); + lv_watch_set_free_num(cont, i); + + label = lv_label_create(cont, NULL); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL); + lv_obj_set_width(label, lv_obj_get_width(cont) - 40); + lv_label_set_text(label, t_str); + lv_obj_align(label, cont, LV_ALIGN_IN_LEFT_MID, 20, 0); + + lv_watch_obj_add_element(btn); + #endif } return obj; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.h b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.h index c702a1cf..b010a28c 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call.h @@ -1,7 +1,5 @@ -/** - * @file videocall.h - * - */ + + #ifndef __MMI_VIDEO_CALL_H__ #define __MMI_VIDEO_CALL_H__ @@ -123,7 +121,7 @@ enum enum_canvas_button_hidden_flag typedef struct { lv_watch_obj_ext_t lv_watch_obj; /*New data for this type */ - lv_obj_t * title; + //lv_obj_t * title; lv_obj_t * list; } lv_vc_contact_list_obj_ext_t; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.c b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.c index 0f400508..e5e8fd19 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.c @@ -1789,7 +1789,7 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) return NULL; } - ext->title = NULL; + //ext->title = NULL; ext->list = NULL; /* content */ @@ -1807,9 +1807,9 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_text_id(label, WATCH_TEXT_ID_VIDEOCALL); - lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 5); + lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); lv_obj_set_click(label, false); - ext->title = label; + //ext->title = label; lv_obj_t * list = lv_list_create(content, NULL); if(list == NULL) @@ -1844,29 +1844,6 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) strcpy(t_str, s_vc_contact.number[i]); #if 0 - btn = lv_list_add_btn(list, NULL, t_str); - lv_page_glue_obj(btn, true); - //lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST); - lv_obj_set_event_cb(btn, mmi_vc_dial_btn_screen); - lv_watch_obj_add_element(btn); - - lv_obj_set_style_local_bg_color(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_pad_top(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 6); - lv_obj_set_style_local_pad_bottom(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 6); - lv_obj_set_style_local_pad_left(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 15); - lv_obj_set_style_local_pad_right(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 15); - lv_obj_set_style_local_pad_inner(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 10); - - //lv_obj_set_size(btn, lv_obj_get_width(list), 80); //56); - - //label = lv_obj_get_child(btn, NULL); - //label = lv_list_get_btn_label(btn); - //lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND); - //lv_label_set_text(label, t_str); - //lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); - //lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0); - #else - btn = lv_list_add_btn(list, NULL, NULL); //lv_page_glue_obj(btn, true); //lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST); @@ -1890,9 +1867,35 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); lv_obj_set_click(label, false); //lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0); - #endif lv_watch_set_free_num(btn, i); + #else + + btn = lv_list_add_btn(list, NULL, NULL); + lv_btn_set_layout(btn, LV_LAYOUT_ROW_MID); + //lv_obj_set_event_cb(btn, mmi_vc_dial_btn_screen); + //lv_watch_set_free_num(btn, i); + + lv_obj_t * cont = lv_cont_create(btn, NULL); + lv_cont_set_layout(cont, LV_LAYOUT_OFF); + lv_obj_set_width(cont, lv_obj_get_width(btn)); + lv_obj_set_height(cont, 56); // LV_VER_RES / 4); //lv_obj_get_height(btn)); + lv_obj_add_style(cont, LV_CONT_PART_MAIN, &lv_style_transp); + lv_page_glue_obj(cont, true); + lv_watch_obj_add_element(cont); + lv_obj_set_click(cont, true); + lv_obj_set_event_cb(cont, mmi_vc_dial_btn_screen); + lv_watch_set_free_num(cont, i); + + label = lv_label_create(cont, NULL); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL); + lv_obj_set_width(label, lv_obj_get_width(cont) - 40); + lv_label_set_text(label, t_str); + lv_obj_align(label, cont, LV_ALIGN_IN_LEFT_MID, 20, 0); + + lv_watch_obj_add_element(btn); + #endif } return obj; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.h b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.h index 968f94e7..ae6697ba 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_fzd.h @@ -121,7 +121,7 @@ enum enum_canvas_button_hidden_flag typedef struct { lv_watch_obj_ext_t lv_watch_obj; /*New data for this type */ - lv_obj_t * title; + //lv_obj_t * title; lv_obj_t * list; } lv_vc_contact_list_obj_ext_t; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.c b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.c index 3cd58476..b71bd6a0 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.c @@ -1813,7 +1813,7 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) return NULL; } - ext->title = NULL; + //ext->title = NULL; ext->list = NULL; /* content */ @@ -1831,9 +1831,9 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_text_id(label, WATCH_TEXT_ID_VIDEOCALL); - lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 5); + lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); lv_obj_set_click(label, false); - ext->title = label; + //ext->title = label; lv_obj_t * list = lv_list_create(content, NULL); if(list == NULL) @@ -1868,29 +1868,6 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) strcpy(t_str, s_vc_contact.number[i]); #if 0 - btn = lv_list_add_btn(list, NULL, t_str); - lv_page_glue_obj(btn, true); - //lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST); - lv_obj_set_event_cb(btn, mmi_vc_dial_btn_screen); - lv_watch_obj_add_element(btn); - - lv_obj_set_style_local_bg_color(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_pad_top(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 6); - lv_obj_set_style_local_pad_bottom(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 6); - lv_obj_set_style_local_pad_left(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 15); - lv_obj_set_style_local_pad_right(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 15); - lv_obj_set_style_local_pad_inner(btn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 10); - - //lv_obj_set_size(btn, lv_obj_get_width(list), 80); //56); - - //label = lv_obj_get_child(btn, NULL); - //label = lv_list_get_btn_label(btn); - //lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND); - //lv_label_set_text(label, t_str); - //lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); - //lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0); - #else - btn = lv_list_add_btn(list, NULL, NULL); //lv_page_glue_obj(btn, true); //lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST); @@ -1914,9 +1891,35 @@ static lv_obj_t * mmi_vc_contact_list_create(lv_obj_t * obj) lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); lv_obj_set_click(label, false); //lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0); - #endif lv_watch_set_free_num(btn, i); + #else + + btn = lv_list_add_btn(list, NULL, NULL); + lv_btn_set_layout(btn, LV_LAYOUT_ROW_MID); + //lv_obj_set_event_cb(btn, mmi_vc_dial_btn_screen); + //lv_watch_set_free_num(btn, i); + + lv_obj_t * cont = lv_cont_create(btn, NULL); + lv_cont_set_layout(cont, LV_LAYOUT_OFF); + lv_obj_set_width(cont, lv_obj_get_width(btn)); + lv_obj_set_height(cont, 56); // LV_VER_RES / 4); //lv_obj_get_height(btn)); + lv_obj_add_style(cont, LV_CONT_PART_MAIN, &lv_style_transp); + lv_page_glue_obj(cont, true); + lv_watch_obj_add_element(cont); + lv_obj_set_click(cont, true); + lv_obj_set_event_cb(cont, mmi_vc_dial_btn_screen); + lv_watch_set_free_num(cont, i); + + label = lv_label_create(cont, NULL); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL); + lv_obj_set_width(label, lv_obj_get_width(cont) - 40); + lv_label_set_text(label, t_str); + lv_obj_align(label, cont, LV_ALIGN_IN_LEFT_MID, 20, 0); + + lv_watch_obj_add_element(btn); + #endif } return obj; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.h b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.h index 4ba7b708..6f671f0a 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_video_call/mmi_video_call_tongxin.h @@ -121,7 +121,7 @@ enum enum_canvas_button_hidden_flag typedef struct { lv_watch_obj_ext_t lv_watch_obj; /*New data for this type */ - lv_obj_t * title; + //lv_obj_t * title; lv_obj_t * list; } lv_vc_contact_list_obj_ext_t; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.h b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.h index 485ed0d2..dc8c0f2b 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.h @@ -91,11 +91,18 @@ typedef struct lv_obj_t * label_no_msg; // mo msg prompt //lv_obj_t * img_emo; lv_obj_t * img_record; // record button - lv_obj_t * delete_bg; // delete msg lv_wechat_created_from_e from; // msg from + lv_obj_t * delete_bg; // delete msg + lv_obj_t * delete_current; + lv_obj_t * delete_all; + lv_obj_t * delete_back; + lv_obj_t * delete_label_prompt; + lv_obj_t * delete_btn_cancel; + lv_obj_t * delete_btn_ok; TIMER_ID delete_timer_id; + MCI_EVNET_T event; }lv_wechat_ext_t; diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_ui.c b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_ui.c index c3b9468d..a47e27ed 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_ui.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_ui.c @@ -93,6 +93,21 @@ void wechat_msg_info_index_item_delete(uint8_t msg_index) s_wechat_msg_info->msg_count--; } +void wechat_msg_info_all_item_delete(void) +{ + uint8_t i = 0; + uint32_t msg_item_info_size = sizeof(nv_watch_wechat_msg_item_info_t); + + for(i = 0; i < s_wechat_msg_info->msg_count; i++) + { + lv_fs_remove(s_wechat_msg_info->msg_item[i].msg_data_full_file_name); + _lv_memset_00(&(s_wechat_msg_info->msg_item[i]), msg_item_info_size); + } + s_wechat_msg_info->msg_count = 0; + + //wechat_msg_info_nv_write(); +} + void wechat_msg_info_new_item_add(nv_watch_wechat_msg_item_info_t * msg_item) { uint32_t msg_item_info_size = sizeof(nv_watch_wechat_msg_item_info_t); @@ -102,7 +117,7 @@ void wechat_msg_info_new_item_add(nv_watch_wechat_msg_item_info_t * msg_item) if(NV_WATCH_WECHAT_NUM_MAX <= s_wechat_msg_info->msg_count) { lv_fs_remove(s_wechat_msg_info->msg_item[0].msg_data_full_file_name); - _lv_memset_00(&(s_wechat_msg_info->msg_item[0]), msg_item_info_size); + //_lv_memset_00(&(s_wechat_msg_info->msg_item[0]), msg_item_info_size); uint8_t i = 0; for(i = 0; i < NV_WATCH_WECHAT_NUM_MAX - 1; i++) @@ -512,15 +527,15 @@ bool wechat_msg_send_to_server(void) void wechat_msg_item_delete_success_timer_cb(void *para) { - lv_wechat_ext_t * ext = (lv_wechat_ext_t *)para; + //lv_wechat_ext_t * ext = (lv_wechat_ext_t *)para; - if(NULL != ext->delete_timer_id) - { - Hal_Timer_Stop(ext->delete_timer_id); - ext->delete_timer_id = NULL; - } + //if(NULL != ext->delete_timer_id) + //{ + // Hal_Timer_Stop(ext->delete_timer_id); + // ext->delete_timer_id = NULL; + //} - lv_obj_del(ext->delete_bg); + //lv_obj_del(ext->delete_bg); wechat_main_screen_refresh(); } @@ -531,20 +546,21 @@ void wechat_msg_item_delete_ok_btn_event_cb(lv_obj_t * obj, lv_event_t e) lv_wechat_ext_t * ext = (lv_wechat_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_MAIN); if(NULL != ext && NULL != ext->delete_bg) { + uint32_t value = lv_watch_get_free_num(obj); + if(0 == value) + wechat_msg_info_index_item_delete(s_wechat_selected_item_index); + else if(1 == value) + wechat_msg_info_all_item_delete(); + lv_obj_clean(ext->delete_bg); - //lv_obj_t * img = lv_img_create(ext->delete_bg, NULL); - //lv_img_set_src(img, ICON_COMMON_SUCCESS); - //lv_obj_align(img, NULL, LV_ALIGN_IN_TOP_MID, 0, LV_VER_RES / 4); - lv_obj_t * label_prompt = lv_label_create(ext->delete_bg, NULL); lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26_black); lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_DEL_SUCCESS); lv_obj_align(label_prompt, ext->delete_bg, LV_ALIGN_CENTER, 0, -10); - wechat_msg_info_index_item_delete(s_wechat_selected_item_index); - - ext->delete_timer_id = Hal_Timer_Start(1500, wechat_msg_item_delete_success_timer_cb, ext, false); + //ext->delete_timer_id = Hal_Timer_Start(1500, wechat_msg_item_delete_success_timer_cb, ext, false); + ext->delete_timer_id = Hal_Timer_Start(1500, wechat_msg_item_delete_success_timer_cb, NULL, false); } } } @@ -557,10 +573,34 @@ void wechat_msg_item_delete_cancel_btn_event_cb(lv_obj_t * obj, lv_event_t e) if(NULL != ext && NULL != ext->delete_bg) { lv_obj_del(ext->delete_bg); + ext->delete_bg = NULL; } } } +void wechat_msg_item_delete_select_btn_event_cb(lv_obj_t * obj, lv_event_t e) +{ + if(LV_EVENT_CLICKED != e) + { + return; + } + + lv_wechat_ext_t * ext = (lv_wechat_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_MAIN); + if(NULL != ext) + { + uint32_t value = lv_watch_get_free_num(obj); + + lv_obj_set_hidden(ext->delete_current, true); + lv_obj_set_hidden(ext->delete_all, true); + lv_obj_set_hidden(ext->delete_back, true); + + lv_obj_set_hidden(ext->delete_label_prompt, false); + lv_obj_set_hidden(ext->delete_btn_cancel, false); + lv_obj_set_hidden(ext->delete_btn_ok, false); + lv_watch_set_free_num(ext->delete_btn_ok, value); + } +} + void wechat_chat_list_msg_item_delete_create(void) { lv_wechat_ext_t * ext = (lv_wechat_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_MAIN); @@ -569,41 +609,56 @@ void wechat_chat_list_msg_item_delete_create(void) ext->delete_bg = lv_cont_create(ext->cont, NULL); lv_obj_set_size(ext->delete_bg, LV_HOR_RES, LV_VER_RES); lv_obj_set_style_local_bg_color(ext->delete_bg, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0xB6, 0xF7, 0xFF)); -#if 0 - - lv_obj_t * btn_delete_current = lv_btn_create(ext->delete_bg, NULL); - lv_obj_set_size(btn_delete_current, LV_HOR_RES - 20, 50); - lv_obj_set_style_local_bg_color(btn_delete_current, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0x47, 0xA6, 0xFF)); + // current + lv_obj_t * btn_delete_current = lv_cont_create(ext->delete_bg, NULL); + lv_obj_set_size(btn_delete_current, LV_HOR_RES - 40, 56); + lv_obj_set_style_local_bg_color(btn_delete_current, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xB9, 0x86, 0xFF)); lv_obj_set_style_local_radius(btn_delete_current, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, 10); - lv_obj_set_style_local_bg_color(btn_delete_current, LV_OBJ_PART_MAIN, LV_STATE_PRESSED, lv_color_make(0x47, 0xA6, 0xFF)); - lv_obj_set_style_local_radius(btn_delete_current, LV_OBJ_PART_MAIN, LV_STATE_PRESSED, 10); + lv_obj_set_click(btn_delete_current, true); + lv_obj_set_event_cb(btn_delete_current, wechat_msg_item_delete_select_btn_event_cb); lv_obj_align(btn_delete_current, NULL, LV_ALIGN_IN_TOP_MID, 0, 40); - lv_obj_set_event_cb(btn_delete_current, wechat_msg_item_delete_cancel_btn_event_cb); + lv_watch_set_free_num(btn_delete_current, 0); + ext->delete_current = btn_delete_current; lv_obj_t * label_delete_current = lv_label_create(btn_delete_current, NULL); lv_obj_add_style(label_delete_current, LV_LABEL_PART_MAIN, &lv_watch_font26); - lv_label_set_text_id(label_delete_current, WATCH_TEXT_ID_CANCEL); - - - lv_obj_t * btn_delete_all = lv_btn_create(ext->delete_bg, btn_delete_current); - lv_obj_set_style_local_bg_color(btn_delete_all, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0x47, 0xA6, 0xFF)); - lv_obj_set_style_local_bg_color(btn_delete_all, LV_OBJ_PART_MAIN, LV_STATE_PRESSED, lv_color_make(0x47, 0xA6, 0xFF)); - lv_obj_align(btn_delete_all, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10, -20); - lv_obj_set_event_cb(btn_delete_all, wechat_msg_item_delete_cancel_btn_event_cb); + lv_label_set_text_id(label_delete_current, WATCH_TEXT_ID_DELETE_CURRENT_ITEM); + lv_label_set_align(label_delete_current, LV_LABEL_ALIGN_CENTER); + lv_obj_align(label_delete_current, btn_delete_current, LV_ALIGN_CENTER, 0, 0); + + // all + lv_obj_t * btn_delete_all = lv_cont_create(ext->delete_bg, btn_delete_current); + lv_obj_set_style_local_bg_color(btn_delete_all, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xFF, 0x6F, 0x91)); + lv_obj_align(btn_delete_all, btn_delete_current, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); + lv_watch_set_free_num(btn_delete_all, 1); + ext->delete_all = btn_delete_all; + + lv_obj_t * label_delete_all = lv_label_create(btn_delete_all, NULL); + lv_obj_add_style(label_delete_all, LV_LABEL_PART_MAIN, &lv_watch_font26); + lv_label_set_text_id(label_delete_all, WATCH_TEXT_ID_DELETE_ALL_ITEM); + lv_label_set_align(label_delete_all, LV_LABEL_ALIGN_CENTER); + lv_obj_align(label_delete_all, btn_delete_all, LV_ALIGN_CENTER, 0, 0); + + // back + lv_obj_t * btn_delete_back = lv_cont_create(ext->delete_bg, btn_delete_current); + lv_obj_set_style_local_bg_color(btn_delete_back, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x47, 0xA6, 0xFF)); + lv_obj_set_event_cb(btn_delete_back, wechat_msg_item_delete_cancel_btn_event_cb); + lv_obj_align(btn_delete_back, btn_delete_all, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); + ext->delete_back = btn_delete_back; + + lv_obj_t * label_delete_back = lv_label_create(btn_delete_back, NULL); + lv_obj_add_style(label_delete_back, LV_LABEL_PART_MAIN, &lv_watch_font26); + lv_label_set_text_id(label_delete_back, WATCH_TEXT_ID_CANCEL); + lv_label_set_align(label_delete_back, LV_LABEL_ALIGN_CENTER); + lv_obj_align(label_delete_back, btn_delete_back, LV_ALIGN_CENTER, 0, 0); - lv_obj_t * label_delete_cancel = lv_label_create(btn_0, NULL); - lv_obj_add_style(label_0, LV_LABEL_PART_MAIN, &lv_watch_font26); - lv_label_set_text_id(label_0, WATCH_TEXT_ID_CANCEL); - - - -#endif lv_obj_t * label_prompt = lv_label_create(ext->delete_bg, NULL); lv_obj_add_style(label_prompt, LV_LABEL_PART_MAIN, &lv_watch_font26_black); lv_label_set_text_id(label_prompt, WATCH_TEXT_ID_DEL_Q); lv_obj_align(label_prompt, ext->delete_bg, LV_ALIGN_CENTER, 0, -30); + ext->delete_label_prompt = label_prompt; lv_obj_t * btn_cancel = lv_btn_create(ext->delete_bg, NULL); lv_obj_set_size(btn_cancel, 100, 56); @@ -613,6 +668,7 @@ void wechat_chat_list_msg_item_delete_create(void) lv_obj_set_style_local_radius(btn_cancel, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 30); lv_obj_align(btn_cancel, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10, -20); lv_obj_set_event_cb(btn_cancel, wechat_msg_item_delete_cancel_btn_event_cb); + ext->delete_btn_cancel = btn_cancel; lv_obj_t * label_cancel = lv_label_create(btn_cancel, NULL); lv_obj_add_style(label_cancel, LV_LABEL_PART_MAIN, &lv_watch_font26); @@ -620,14 +676,18 @@ void wechat_chat_list_msg_item_delete_create(void) lv_obj_t * btn_ok = lv_btn_create(ext->delete_bg, btn_cancel); lv_obj_set_style_local_bg_color(btn_ok, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0xFF, 0x6F, 0x91)); - lv_obj_set_style_local_radius(btn_ok, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30); lv_obj_set_style_local_bg_color(btn_ok, LV_BTN_PART_MAIN, LV_STATE_PRESSED, lv_color_make(0xFF, 0x6F, 0x91)); - lv_obj_set_style_local_radius(btn_ok, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 30); lv_obj_align(btn_ok, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -10, -20); lv_obj_set_event_cb(btn_ok, wechat_msg_item_delete_ok_btn_event_cb); + ext->delete_btn_ok = btn_ok; lv_obj_t * label_ok = lv_label_create(btn_ok, label_cancel); lv_label_set_text_id(label_ok, WATCH_TEXT_ID_OK); + + // display + lv_obj_set_hidden(label_prompt, true); + lv_obj_set_hidden(btn_cancel, true); + lv_obj_set_hidden(btn_ok, true); } } @@ -666,7 +726,7 @@ void wechat_msg_sending_result_screen_timeout(void *para) lv_obj_t * obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_SENDING); if(NULL != obj) { - //WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); lv_obj_del(obj); } @@ -1020,17 +1080,17 @@ void wechat_msg_recording_screen_create(void) #else hal_rtc_t cur_time; Hal_Rtc_Gettime(&cur_time); - s_wechat_msg_item_info.msg_time.tm_year = cur_time.tm_year; - s_wechat_msg_item_info.msg_time.tm_mon = cur_time.tm_mon; - s_wechat_msg_item_info.msg_time.tm_mday = cur_time.tm_mday; - s_wechat_msg_item_info.msg_time.tm_hour = cur_time.tm_hour; - s_wechat_msg_item_info.msg_time.tm_min = cur_time.tm_min; - s_wechat_msg_item_info.msg_time.tm_sec = cur_time.tm_sec; + _lv_memcpy(&(s_wechat_msg_item_info.msg_time), &cur_time, sizeof(hal_rtc_t)); #endif s_wechat_msg_item_info.msg_type = WECHAT_MSG_TYPE_VOICE; sprintf(s_wechat_msg_item_info.msg_data_full_file_name, "C:/wechat_s%04d%02d%02d_%02d%02d%02d.amr", /*WECHAT_MSG_DATA_FILE_PATH, */ - s_wechat_msg_item_info.msg_time.tm_year, s_wechat_msg_item_info.msg_time.tm_mon, s_wechat_msg_item_info.msg_time.tm_mday, - s_wechat_msg_item_info.msg_time.tm_hour, s_wechat_msg_item_info.msg_time.tm_min, s_wechat_msg_item_info.msg_time.tm_sec); + s_wechat_msg_item_info.msg_time.tm_year, + s_wechat_msg_item_info.msg_time.tm_mon, + s_wechat_msg_item_info.msg_time.tm_mday, + s_wechat_msg_item_info.msg_time.tm_hour, + s_wechat_msg_item_info.msg_time.tm_min, + s_wechat_msg_item_info.msg_time.tm_sec + ); WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: msg_from=%d, file_name=%s\n", __FUNCTION__, __LINE__, s_wechat_msg_item_info.msg_from, s_wechat_msg_item_info.msg_data_full_file_name); @@ -1115,12 +1175,14 @@ void wechat_msg_record_button_event_cb(lv_obj_t * obj, lv_event_t e) lv_obj_t * obj = wechat_main_get_obj(); wechat_list_out_of_memory_create(obj); } + #if 0 else if(NV_WATCH_WECHAT_NUM_MAX <= wechat_msg_info_count_get()) //else if(2 <= wechat_msg_info_count_get()) { lv_obj_t * obj = wechat_main_get_obj(); wechat_list_out_of_memory_create(obj); } + #endif else { wechat_chat_list_set_slide_enable(&ext->old_ext, false); /*prevent to slide out while recording*/ @@ -1752,14 +1814,24 @@ void wechat_chat_list_create(lv_obj_t * obj, lv_wechat_ext_t * ext) lv_obj_set_style_local_bg_opa(list_page, LV_PAGE_PART_BG, LV_STATE_DEFAULT, LV_OPA_0); lv_obj_set_style_local_border_opa(list_page, LV_PAGE_PART_BG, LV_STATE_DEFAULT, LV_OPA_0); lv_obj_set_style_local_outline_width(list_page, LV_PAGE_PART_BG, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_pad_bottom(list_page, LV_PAGE_PART_SCROLLABLE, LV_STATE_DEFAULT, 4); - lv_obj_set_style_local_pad_top(list_page, LV_PAGE_PART_SCROLLABLE, LV_STATE_DEFAULT, 2); - lv_obj_set_style_local_pad_inner(list_page, LV_PAGE_PART_SCROLLABLE, LV_STATE_DEFAULT, 8); - lv_obj_set_style_local_bg_color(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, lv_color_make(16, 112, 194)); - lv_obj_set_style_local_pad_inner(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, LV_DPI / 20); - lv_obj_set_style_local_pad_left(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_pad_right(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_radius(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, 0); + //lv_obj_set_style_local_pad_bottom(list_page, LV_PAGE_PART_SCROLLABLE, LV_STATE_DEFAULT, 4); + //lv_obj_set_style_local_pad_top(list_page, LV_PAGE_PART_SCROLLABLE, LV_STATE_DEFAULT, 2); + //lv_obj_set_style_local_pad_inner(list_page, LV_PAGE_PART_SCROLLABLE, LV_STATE_DEFAULT, 8); + //lv_obj_set_style_local_bg_color(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, lv_color_make(16, 112, 194)); + //lv_obj_set_style_local_pad_inner(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, LV_DPI / 20); + //lv_obj_set_style_local_pad_left(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, 0); + //lv_obj_set_style_local_pad_right(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, 0); + //lv_obj_set_style_local_radius(list_page, LV_PAGE_PART_SCROLLBAR, LV_STATE_DEFAULT, 0); + + lv_page_set_scrl_layout(list_page, LV_LAYOUT_OFF); + lv_page_set_scrollable_fit2(list_page, LV_FIT_NONE, LV_FIT_TIGHT); + + lv_obj_t * scrl = lv_page_get_scrollable(list_page); + ancient_scrl_signal = lv_obj_get_signal_cb(scrl); + lv_obj_set_signal_cb(scrl, wechat_chat_list_scrl_signal); + + lv_watch_obj_add_element(list_page); + lv_watch_obj_add_element(scrl); lv_style_init(&(list_page_ext->style_label_time)); lv_style_copy(&(list_page_ext->style_label_time), &lv_watch_font20); @@ -1795,16 +1867,6 @@ void wechat_chat_list_create(lv_obj_t * obj, lv_wechat_ext_t * ext) lv_style_set_pad_left(&(list_page_ext->style_cont_other), LV_STATE_DEFAULT, 5); lv_style_set_pad_right(&(list_page_ext->style_cont_other), LV_STATE_DEFAULT, 5); - lv_page_set_scrl_layout(list_page, LV_LAYOUT_OFF); - lv_page_set_scrollable_fit2(list_page, LV_FIT_NONE, LV_FIT_TIGHT); - - lv_obj_t * scrl = lv_page_get_scrollable(list_page); - ancient_scrl_signal = lv_obj_get_signal_cb(scrl); - lv_obj_set_signal_cb(scrl, wechat_chat_list_scrl_signal); - - lv_watch_obj_add_element(list_page); - lv_watch_obj_add_element(scrl); - _lv_memset_00(&(list_page_ext->voice_playing_anim), sizeof(lv_anim_t)); list_page_ext->pressing = false; ext->list = list_page; @@ -1864,6 +1926,19 @@ void wechat_main_screen_refresh(void) lv_obj_del(ext->list); ext->list = NULL; } + + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + if(NULL != ext->delete_timer_id) + { + Hal_Timer_Stop(ext->delete_timer_id); + ext->delete_timer_id = NULL; + } + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + if(NULL != ext->delete_bg) + { + lv_obj_del(ext->delete_bg); + ext->delete_bg = NULL; + } WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); @@ -1914,6 +1989,7 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from) ext->list = NULL; ext->from = from; ext->delete_timer_id = NULL; + ext->delete_bg = NULL; lv_obj_t * cont = lv_cont_create(obj, NULL); lv_obj_set_size(cont, lv_obj_get_width(obj), lv_obj_get_height(obj)); @@ -1962,7 +2038,6 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from) lv_obj_set_event_cb(ext->img_record, wechat_msg_record_button_event_cb); lv_obj_set_adv_hittest(ext->img_record, false); lv_watch_obj_add_element(ext->img_record); - lv_obj_align(ext->img_record, cont, LV_ALIGN_IN_BOTTOM_MID, 0, -8); uint8_t msg_count = wechat_msg_info_count_get(); diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c b/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c index 4d854abd..741f67c1 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c @@ -74,11 +74,16 @@ void phonebook_init(void) void phonebook_create_btn_event_cb(lv_obj_t * btn, lv_event_t e) { +#ifdef __MMI_ZHSX_SUPPORT_PHONEBOOK_LIST_STYLE__ + mmi_phonebook_create_event_cb(btn, e); + +#else (void)btn; if(LV_EVENT_CLICKED == e) { lv_watch_png_cache_all_free(); phonebook_create(NULL); } +#endif } void app_adaptor_update_phonebook_ind(app_adaptor_contact_t * contact_list, uint8_t count) @@ -1142,6 +1147,224 @@ static lv_obj_t * phonebook_create(lv_obj_t * activity_obj) } #ifdef __MMI_ZHSX_SUPPORT__ + +#ifdef __MMI_ZHSX_SUPPORT_PHONEBOOK_LIST_STYLE__ + +static lv_mmi_phonebook_obj_ext_t * mmi_phonebook_get_ext(void) +{ + lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_PHONEBOOK); + if(activity_obj == NULL) + return NULL; + + lv_obj_t * watch_obj; + lv_watch_get_child_obj(activity_obj, lv_watch_obj_signal, &watch_obj); + if(NULL != watch_obj) + { + lv_mmi_phonebook_obj_ext_t * ext = lv_obj_get_ext_attr(watch_obj); + return ext; + } + + return NULL; +} + +static void mmi_phonebook_btn_event_cb(lv_obj_t * btn, lv_event_t e) +{ + if(LV_EVENT_CLICKED != e) + return; + + char * number = NULL; + uint32_t index = lv_watch_get_free_num(btn); + + number = phonebook_get_phone_number(index); + if(NULL != number) + { + phone_voice_call_req(number); + } +} + +void mmi_phonebook_update_ui(nv_watch_phonebook_t * nvm_contact_list, uint16_t count) +{ + + +} + +static void mmi_phonebook_contacts_list_create(lv_obj_t * obj, nv_watch_phonebook_t * nvm_contact_list) +{ + /*Allocate the object type specific extended data*/ + lv_mmi_phonebook_obj_ext_t * ext = (lv_mmi_phonebook_obj_ext_t *)lv_obj_allocate_ext_attr(obj, sizeof(lv_mmi_phonebook_obj_ext_t)); + /*ext realloc based on watch_obj_ext, do not memeset it*/ + LV_ASSERT_MEM(ext); + if(NULL == ext) + return; + + lv_obj_t * label_title = lv_label_create(obj, NULL); + lv_obj_set_size(label_title, LV_HOR_RES, 40); + lv_obj_add_style(label_title, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); + lv_label_set_align(label_title, LV_LABEL_ALIGN_CENTER); + lv_label_set_text_id(label_title, WATCH_TEXT_ID_PHONEBOOK); + lv_obj_align(label_title, NULL, LV_ALIGN_IN_TOP_MID, 0, 10); + lv_obj_set_click(label_title, false); + + lv_obj_t * list = lv_list_create(obj, NULL); + lv_page_set_edge_flash(list, true); + lv_obj_add_style(list, LV_LIST_PART_EDGE_FLASH, &lv_watch_cont_opa1); + lv_obj_add_style(list, LV_LIST_PART_BG, &lv_watch_style_transp); + lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES - 40); + lv_obj_align(list, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + lv_watch_obj_add_element(list); + ext->list = list; + + uint16_t i = 0; + lv_obj_t * btn; + lv_obj_t * label; + nv_watch_phonebook_info_t * contact_info; + uint32_t contact_length = sizeof(nv_watch_phonebook_info_t); + + _lv_ll_init(&(ext->contact_list), contact_length); + for(i = 0; i < NV_WATCH_MAX_CONTACT_NUM; i++) + { + if('\0' == nvm_contact_list->info[i].number[0]) + { + break; + } + // contact ll + contact_info = _lv_ll_ins_tail(&(ext->contact_list)); + memcpy(contact_info, &(nvm_contact_list->info[i]), contact_length); + + // add list item + btn = lv_list_add_btn(list, NULL, NULL); + lv_btn_set_layout(btn, LV_LAYOUT_ROW_MID); + //lv_obj_set_event_cb(btn, call_log_log_btn_event_cb); + //lv_watch_set_free_num(btn, i); + + lv_obj_t * cont = lv_cont_create(btn, NULL); + lv_cont_set_layout(cont, LV_LAYOUT_OFF); + lv_obj_set_width(cont, lv_obj_get_width(btn)); + lv_obj_set_height(cont, 56); // LV_VER_RES / 5); // LV_VER_RES / 4); //lv_obj_get_height(btn)); + lv_obj_add_style(cont, LV_CONT_PART_MAIN, &lv_style_transp); + lv_page_glue_obj(cont, true); + lv_watch_obj_add_element(cont); + lv_obj_set_click(cont, true); + lv_obj_set_event_cb(cont, mmi_phonebook_btn_event_cb); + lv_watch_set_free_num(cont, i); + + label = lv_label_create(cont, NULL); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL); + lv_obj_set_width(label, lv_obj_get_width(cont) - 40); + if('\0' != contact_info->name[0]) + lv_label_set_text(label, contact_info->name); + else + lv_label_set_text(label, contact_info->number); + + lv_obj_align(label, cont, LV_ALIGN_IN_LEFT_MID, 20, 0); + + lv_watch_obj_add_element(btn); + } +} + +static void mmi_phonebook_no_contacts_create(lv_obj_t * obj) +{ + lv_obj_t * label = lv_label_create(obj, NULL); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); + + lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); + lv_obj_set_click(label, false); + lv_label_set_text_id(label, WATCH_TEXT_ID_NO_CONTACTS); + lv_obj_align(label, obj, LV_ALIGN_CENTER, 0, -10); + + return; +} + +static void mmi_phonebook_no_network_create(lv_obj_t * obj) +{ + lv_obj_t * label = lv_label_create(obj, NULL); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); + + lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); + lv_obj_set_click(label, false); + lv_label_set_text_id(label, WATCH_TEXT_ID_NO_NETWORK); + lv_obj_align(label, obj, LV_ALIGN_CENTER, 0, -10); + + return; +} + +static void mmi_phonebook_prepare_destory(lv_obj_t * activity_obj) +{ + PHONEBOOK_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + lv_watch_png_cache_all_free(); + + if(1 == phonebook_get_user_num(activity_obj)) + { + lv_mmi_phonebook_obj_ext_t * ext = mmi_phonebook_get_ext(); + if(NULL != ext && NULL != &(ext->contact_list)) + { + PHONEBOOK_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + _lv_ll_clear(&(ext->contact_list)); + } + } +} + +static lv_obj_t * mmi_phonebook_create(lv_obj_t * activity_obj) +{ + PHONEBOOK_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + nv_watch_phonebook_t * nvm_contact_list = phonebook_read_nvm(); + + if(activity_obj == NULL) + { + lv_watch_activity_ext_t activity_ext = {0}; + + activity_ext.actId = ACT_ID_PHONEBOOK; + activity_ext.create = mmi_phonebook_create; + activity_ext.prepare_destory = mmi_phonebook_prepare_destory; + activity_obj = lv_watch_creat_activity_obj(&activity_ext); + if(NULL == activity_obj) + return NULL; + } + + lv_obj_t * obj = lv_watch_obj_create(activity_obj); + LV_ASSERT_MEM(obj); + if(NULL == obj) + return NULL; + + if('\0' == nvm_contact_list->info[0].number[0]) + { + mmi_phonebook_no_contacts_create(obj); + lv_watch_set_free_num(activity_obj, 0); + } + /* + else if((false == watch_modem_sim_present_check_req()) + || (MMI_MODEM_SIGNAL_BAR_0 == watch_modem_get_signal_bar_req()) + ) + { + mmi_phonebook_no_network_create(obj); + lv_watch_set_free_num(activity_obj, 0); + } + */ + else + { + mmi_phonebook_contacts_list_create(obj, nvm_contact_list); + lv_watch_set_free_num(activity_obj, 1); + } + + lv_mem_free(nvm_contact_list); + + return obj; +} + +void mmi_phonebook_create_event_cb(lv_obj_t * btn, lv_event_t e) +{ + if(LV_EVENT_CLICKED == e) + { + lv_watch_png_cache_all_free(); + mmi_phonebook_create(NULL); + } +} +#endif + + void mmi_phonebook_contact_list_set(app_adaptor_contact_t * contact_list, uint8_t count) { if(NULL == contact_list) @@ -1165,7 +1388,11 @@ void mmi_phonebook_contact_list_set(app_adaptor_contact_t * contact_list, uint8_ phonebook_write_nvm(nvm_contact_list); +#ifdef __MMI_ZHSX_SUPPORT_PHONEBOOK_LIST_STYLE__ + mmi_phonebook_update_ui(nvm_contact_list, count); +#else phonebook_update_ui(contact_list, count, 0, 0); +#endif lv_mem_free(nvm_contact_list); } diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.h b/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.h index 7f36403d..c01bb980 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.h +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.h @@ -69,6 +69,29 @@ phonebook_contact_t * phonebook_get_contact_info(char * number); char * phonebook_get_phone_number(uint8_t id); /*[0, NV_WATCH_MAX_CONTACT_NUM - 1]*/ #ifdef __MMI_ZHSX_SUPPORT__ + +#define __PHONEBOOK_DEBUG__ +#ifdef __PHONEBOOK_DEBUG__ +#define PHONEBOOK_DEBUG_PRINTF(fmt, ...) printf("[WECHAT]"fmt, ##__VA_ARGS__) +#else +#define PHONEBOOK_DEBUG_PRINTF(fmt, ...) +#endif + + + +#ifdef __MMI_ZHSX_SUPPORT_PHONEBOOK_LIST_STYLE__ + +typedef struct +{ + lv_watch_obj_ext_t lv_watch_obj; + /*New data for this type */ + lv_ll_t contact_list; + lv_obj_t * list; + lv_obj_t * page_scrl; +} lv_mmi_phonebook_obj_ext_t; + +#endif + void mmi_phonebook_contact_list_set(app_adaptor_contact_t * contact_list, uint8_t count); #endif diff --git a/2.sdk/sdk/gui/lv_watch/lv_apps/weather/weather.c b/2.sdk/sdk/gui/lv_watch/lv_apps/weather/weather.c index df5d1b28..0112b6b6 100644 --- a/2.sdk/sdk/gui/lv_watch/lv_apps/weather/weather.c +++ b/2.sdk/sdk/gui/lv_watch/lv_apps/weather/weather.c @@ -173,7 +173,7 @@ void weather_update(lv_obj_t * cont) lv_obj_align(weather_ext->content2, weather_ext->content1, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); weather_ext->content3 = weather_city_content_create(cont, &weather_info); - lv_obj_align(weather_ext->content3, weather_ext->content2, LV_ALIGN_OUT_BOTTOM_MID, 0, 15); + lv_obj_align(weather_ext->content3, weather_ext->content2, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); } } diff --git a/2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_common.h b/2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_common.h index c065088a..37aa71eb 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_common.h +++ b/2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_common.h @@ -19,6 +19,10 @@ extern "C" #ifdef __MMI_ZHSX_SUPPORT__ + +#define MMI_ABS(x) (((x) < 0) ? (-(x)) : (x)) + + void mmi_float_to_str(double float_num, uint8_t int_num, char * data_str); char * km_strtok_r(char * s, const char * delim, char ** last);