gengxin
authorCCC <2393524978@qq.com>
Tue, 12 Sep 2023 01:32:58 +0000 (09:32 +0800)
committerCCC <2393524978@qq.com>
Tue, 12 Sep 2023 01:32:58 +0000 (09:32 +0800)
17 files changed:
2.sdk/project/Z5_K7/product/craneg_modem/config/watch/lv_watch_conf_CUSTOM.h
2.sdk/sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c
2.sdk/sdk/gui/lv_watch/framework/message/mmi_msg_zhsx.c
2.sdk/sdk/gui/lv_watch/framework/message/mmi_msg_zhsx.h
2.sdk/sdk/gui/lv_watch/framework/message/watch_msg_handle.c
2.sdk/sdk/gui/lv_watch/framework/message/watch_msg_handle.h
2.sdk/sdk/gui/lv_watch/include/ui_inter_msg_interface.h
2.sdk/sdk/gui/lv_watch/lv_apps/alipay/alipay.c
2.sdk/sdk/gui/lv_watch/lv_apps/alipay/alipay.h
2.sdk/sdk/gui/lv_watch/lv_apps/dial/dial_element.c
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.h
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_ui.c
2.sdk/sdk/gui/lv_watch/lv_apps/pedometer/pedometer.c
2.sdk/sdk/gui/lv_watch/lv_apps/pedometer/pedometer.h
2.sdk/sdk/gui/lv_watch/lv_watch.c
2.sdk/sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c
2.sdk/sdk/gui/lvgl/hal/hal.c

index e6057bb..af1a30a 100644 (file)
 
 #define __MMI_ZHSX_SUPPORT_NO_SIM_POWER_OFF__
 
-#define __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+//#define __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
 
 #define __MMI_ZHSX_SUPPORT_PHONEBOOK_LIST_STYLE__
 
index f130f0e..881e753 100644 (file)
@@ -76,7 +76,7 @@ void asl_pedometer_steps_save(bool to_nv)
        else
        {
        #if USE_LV_WATCH_PEDOMETER != 0
-               pedometer_update_screen();
+               mmi_ui_msg_action_pedometer_update();
        #endif
        }
 }
index 7651220..35d19d5 100644 (file)
@@ -85,6 +85,29 @@ void mmi_ui_msg_action_charging_prompt(uint32_t chg_status)
        Hal_Send_Message((TASK_ID)gui_task_id, (void *)msg_info);
 }
 
+#ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+void mmi_ui_msg_action_do_not_disturb(uint8_t flag)
+{
+       printf("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, flag);
+       
+       mmi_msg_do_not_disturb_t * msg_info = (mmi_msg_do_not_disturb_t *)Hal_Mem_Alloc(sizeof(mmi_msg_do_not_disturb_t));
+
+       memset(msg_info, 0x0, sizeof(mmi_msg_do_not_disturb_t));
+       msg_info->header.MsgId = MMI_MSG_DO_NOT_DISTURB;
+       msg_info->flag = flag;
+
+       Hal_Send_Message((TASK_ID)gui_task_id, (void *)msg_info);
+}
+#endif
+
+#if USE_LV_WATCH_PEDOMETER != 0
+void mmi_ui_msg_action_pedometer_update(void)
+{
+       mmi_ui_msg_action_no_para_msg(MMI_MSG_PEDOMETER_UPDATE);
+}
+#endif
+
+
 
 
 #if 0
@@ -164,6 +187,30 @@ static VOID MMI_ModemAdp_Video_Call_Main(VOID * para)
 #endif
 
 
+void mmi_watch_lv_ui_message_action(uint16_t msgid, void * msg)
+{
+    switch(msgid) 
+       {
+        case UI_MSG_MMI_LV_UI_000:
+
+            break;
+
+        case UI_MSG_MMI_LV_UI_001:
+
+            break;
+                       
+               case UI_MSG_MMI_LV_UI_002:
+               
+                       break;
+
+
+       
+        default:
+            break;
+    }
+}
+
+
 #endif
 
 
index a11dc65..4ee82d3 100644 (file)
@@ -18,6 +18,42 @@ extern "C" {
 
 #ifdef __MMI_ZHSX_SUPPORT__
 
+
+enum
+{
+    UI_MSG_MMI_LV_UI_000 = UI_MSG_MMI_LV_UI_BASE,
+    UI_MSG_MMI_LV_UI_001,
+       UI_MSG_MMI_LV_UI_002,
+       UI_MSG_MMI_LV_UI_003,
+       UI_MSG_MMI_LV_UI_004,
+       UI_MSG_MMI_LV_UI_005,
+       UI_MSG_MMI_LV_UI_006,
+       UI_MSG_MMI_LV_UI_007,
+       UI_MSG_MMI_LV_UI_008,
+       UI_MSG_MMI_LV_UI_009,
+       UI_MSG_MMI_LV_UI_010,
+       UI_MSG_MMI_LV_UI_011,
+       UI_MSG_MMI_LV_UI_012,
+       UI_MSG_MMI_LV_UI_013,
+       UI_MSG_MMI_LV_UI_014,
+       UI_MSG_MMI_LV_UI_015,
+       UI_MSG_MMI_LV_UI_016,
+       UI_MSG_MMI_LV_UI_017,
+       UI_MSG_MMI_LV_UI_018,
+       UI_MSG_MMI_LV_UI_019,
+       UI_MSG_MMI_LV_UI_020,
+
+
+
+///******** add before this line ********///
+       UI_MSG_MMI_LV_UI_MAX
+};
+
+void mmi_watch_lv_ui_message_action(uint16_t msgid, void * msg);
+
+
+
+
 void mmi_ui_msg_action_watch_factory(void);
 void mmi_ui_msg_action_watch_power_off(void);
 void mmi_ui_msg_action_watch_searching(void);
@@ -33,6 +69,12 @@ void mmi_ui_msg_action_center_number_dialing(void);
 void mmi_ui_msg_action_no_sim_power_off(void);
 #endif
 void mmi_ui_msg_action_charging_prompt(uint32_t chg_status);
+#ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+void mmi_ui_msg_action_do_not_disturb(uint8_t flag);
+#endif
+#if USE_LV_WATCH_PEDOMETER != 0
+void mmi_ui_msg_action_pedometer_update(void);
+#endif
 
 
 
index c90b087..90a86c2 100644 (file)
@@ -412,6 +412,17 @@ void watch_ui_message_handle(uint16_t msgid, void * msg)
                        mmi_ui_msg_update_charging_prompt(((mmi_msg_charging_prompt_t *)msg)->chg_status);
                        break;
                        
+       #ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+               case MMI_MSG_DO_NOT_DISTURB:
+                       mmi_ui_msg_update_do_not_disturb(((mmi_msg_do_not_disturb_t *)msg)->flag);
+                       break;
+       #endif
+
+       #if USE_LV_WATCH_PEDOMETER != 0
+               case MMI_MSG_PEDOMETER_UPDATE:
+                       mmi_ui_msg_update_pedometer_screen();
+                       break;
+       #endif
 
                        
        #endif
@@ -432,10 +443,15 @@ void watch_message_handle_entry(lv_task_t * task)
         msg = (UI_Inter_Msg_Header_t *)Hal_Receive_Message((TASK_ID)gui_task_id, false);
         if(NULL != msg) {
                        printf("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, msg->MsgId);
-            watch_ui_message_handle(msg->MsgId, (void *)msg);
-                       //add handle UI update
-                       sw_ui_message_handle(msg->MsgId, (void *)msg);
-                       //end
+                       if(UI_MSG_WATCH_UI_BASE <= msg->MsgId && UI_MSG_WATCH_UI_MAX > msg->MsgId)
+                       {
+                   watch_ui_message_handle(msg->MsgId, (void *)msg);
+                       }
+                       else if((UI_MSG_MMI_LV_UI_BASE <= msg->MsgId) && (UI_MSG_MMI_LV_UI_MAX > msg->MsgId))
+                       {
+                               mmi_watch_lv_ui_message_action(msg->MsgId, (void *)msg);
+                       }
+
             lv_mem_free(msg);
         } else {
             return;
index 533293f..8eb2406 100644 (file)
@@ -115,9 +115,21 @@ enum
        MMI_MSG_NO_SIM_POWER_OFF,
 #endif
        MMI_MSG_CHARGING_PROMPT,
+#ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+       MMI_MSG_DO_NOT_DISTURB,
+#endif
+#if USE_LV_WATCH_PEDOMETER != 0
+       MMI_MSG_PEDOMETER_UPDATE,
+#endif
        
        
 #endif
+
+
+
+
+///******** add before this line ********///
+       UI_MSG_WATCH_UI_MAX
 };
 
 typedef struct
@@ -539,6 +551,13 @@ typedef struct
        uint32_t chg_status;
 } mmi_msg_charging_prompt_t;
 
+#ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+typedef struct
+{
+    UI_Inter_Msg_Header_t header;
+       uint8_t flag;
+} mmi_msg_do_not_disturb_t;
+#endif
 
 
 #endif
index 77ff256..eed8340 100644 (file)
@@ -26,6 +26,7 @@ enum {
     UI_MSG_SW_TCP_UI_BASE           = 0x400,
     UI_MSG_SW_SENSORHUB_UI_BASE     = 0x500,
     UI_MSG_SW_NORMAL_UI_BASE        = 0x600,
+       UI_MSG_MMI_LV_UI_BASE                   = 0X700,
 };
 typedef uint16_t   UI_INTER_MSG_ID;
 
index d1ef956..e32469f 100644 (file)
@@ -281,50 +281,92 @@ void mmi_identify_info_do(void)
        ret = aos_set_identify_info(&identify_info);
        ALIPAY_DEBUG_PRINTF("[%s][%d]: ret=%d,imei=%s\n", __FUNCTION__, __LINE__, ret, imei);
 }
-#endif
 
-lv_obj_t * upay_create(lv_obj_t * activity_obj)
-{
-#ifdef __MMI_ZHSX_SUPPORT_ALIPAY__
+static lv_task_t * s_alipay_task_p;
+static uint8_t s_id2_init_result = 0;
 
-    upay_rc_t bind_st = UPAY_RC_FALSE;
+static void mmi_watch_alipay_id2_init(void)
+{
+       int32_t ret = aos_start_simcard_identify();
+       ALIPAY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret);
 
-       //upay_set_log_limit(0);
-       mmi_identify_info_do();
+       ret = aos_upay_check_id2();
+       ALIPAY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret);
+       if(ret) 
+       {
+               if(alipay_init_flag == UPAY_ALIPAY_IDE)
+               {
+                       aos_mutex_lock(&alipay_init_task_lock, AOS_WAIT_FOREVER);
+                       alipay_task_id = uos_create_task(alipay_init, NULL, 64, 0xA000, 209, "alipay_task");
+                       if(alipay_task_id != NULL) 
+                       {
+                               alipay_init_flag = UPAY_ALIPAY_INITING;
+                               aos_sem_signal(&alipay_init_task_sem);
+                       }
+                       aos_mutex_unlock(&alipay_init_task_lock);
+               }
+               
+               s_id2_init_result = 1;
+       } 
+       else
+       {
+               ALIPAY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ID2 error\n", __FUNCTION__, __LINE__);
+       }
+}
 
-    static init_lock_st = 0;
-    if(!init_lock_st) {
+static void mmi_watch_alipay_init_task(lv_task_t * task)
+{
+    upay_rc_t bind_st = UPAY_RC_FALSE;
+       
+    static uint8_t init_lock_st = 0;
+    if(0 == init_lock_st) 
+       {
         aos_mutex_new(&alipay_init_task_lock);
         aos_sem_new(&alipay_init_task_sem, 0);
         init_lock_st = 1;
     }
 
     bind_st = upay_check_bind_status();
-       ALIPAY_DEBUG_PRINTF("[%s][%d]: bind_st=%d\n", __FUNCTION__, __LINE__, bind_st);
+       ALIPAY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: bind_st=%d\n", __FUNCTION__, __LINE__, bind_st);
 
-    if( !((netif_get_default_nw() == NULL) && (bind_st != UPAY_RC_TRUE)) )     {
-               int32_t ret = aos_start_simcard_identify();
-               ALIPAY_DEBUG_PRINTF("[%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret);
+    if((NULL != netif_get_default_nw()) && (UPAY_RC_TRUE != bind_st))
+       {
+               mmi_watch_alipay_id2_init();
                
-               ret = aos_upay_check_id2();
-               ALIPAY_DEBUG_PRINTF("[%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret);
-        if(ret) {
-            if(alipay_init_flag == UPAY_ALIPAY_IDE)
-            {
-                aos_mutex_lock(&alipay_init_task_lock, AOS_WAIT_FOREVER);
-                alipay_task_id = uos_create_task(alipay_init, NULL, 64, 0xA000, 209, "alipay_task");
-                if(alipay_task_id != NULL) {
-                    alipay_init_flag = UPAY_ALIPAY_INITING;
-                    aos_sem_signal(&alipay_init_task_sem);
-                }
-                aos_mutex_unlock(&alipay_init_task_lock);
-            }
-        } else {
-            uart_printf("ID2 error, do not init.");
-        }
-    } else {
-        uart_printf("network not ok and alipay is unbind, do not create init task");
+               lv_task_del(s_alipay_task_p);
+               s_alipay_task_p = NULL;
     }
+}
+
+void mmi_watch_alipay_info_init(void)
+{
+    if(false == watch_modem_sim_present_check_req())
+       {
+               ALIPAY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               return;
+       }
+       
+       mmi_identify_info_do();
+       s_alipay_task_p = lv_task_create(mmi_watch_alipay_init_task, 3000, LV_TASK_PRIO_MID, NULL);
+}
+#endif
+
+lv_obj_t * upay_create(lv_obj_t * activity_obj)
+{
+#ifdef __MMI_ZHSX_SUPPORT_ALIPAY__
+
+       if(0 == s_id2_init_result)
+       {
+               upay_rc_t bind_st = UPAY_RC_FALSE;
+               
+           bind_st = upay_check_bind_status();
+               ALIPAY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: bind_st=%d\n", __FUNCTION__, __LINE__, bind_st);
+
+           if((NULL != netif_get_default_nw()) && (UPAY_RC_TRUE != bind_st))
+       {
+                       mmi_watch_alipay_id2_init();
+               }
+       }
 
     if(activity_obj == NULL) {
         lv_watch_activity_ext_t activity_ext;
@@ -649,7 +691,11 @@ static void upay_init_task(lv_task_t * task)
     bind_st = upay_check_bind_status();
     printf("upay_init_task, upay_check_bind_status is %d\n", bind_st);
 
-    if( (netif_get_default_nw() == NULL) && (bind_st != UPAY_RC_TRUE))
+    if( (netif_get_default_nw() == NULL) && (bind_st != UPAY_RC_TRUE)
+               #ifdef __MMI_ZHSX_SUPPORT_ALIPAY__
+               || (0 == s_id2_init_result)
+               #endif
+               )
     {
         //printf("[%s %d] network error\n\r",__func__,__LINE__);
                ALIPAY_DEBUG_PRINTF("[%s][%d]: \n", __FUNCTION__, __LINE__);
index b8103e4..892d7b5 100644 (file)
@@ -32,6 +32,8 @@ extern "C" {
 #else
 #define ALIPAY_DEBUG_PRINTF(fmt, ...)
 #endif
+
+void mmi_watch_alipay_info_init(void);
 #endif
 
 /**********************
index bbd3e4a..0af7701 100644 (file)
@@ -619,7 +619,7 @@ static void dial_update_canvas_label(watch_element_base_t * base)
                                if(health_info.heart_value)
                        sprintf(infotxt, "%-3d", health_info.heart_value);
                                else
-                       sprintf(infotxt, "%--");
+                       sprintf(infotxt, "--");
                 dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
                 break;
             case LABEL_TYPE_DISTANCE:
@@ -631,7 +631,7 @@ static void dial_update_canvas_label(watch_element_base_t * base)
                                if(health_info.spo2_value)
                        sprintf(infotxt, "%d%%", health_info.spo2_value);
                                else
-                       sprintf(infotxt, "%--");
+                       sprintf(infotxt, "--");
                 dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
                 break;
             case LABEL_TYPE_PRESSURE:
@@ -639,7 +639,7 @@ static void dial_update_canvas_label(watch_element_base_t * base)
                                if(health_info.blood_low_value && health_info.blood_high_value)
                        sprintf(infotxt, "%-3d-%-3d", health_info.blood_low_value, health_info.blood_high_value);
                                else
-                       sprintf(infotxt, "%--");
+                       sprintf(infotxt, "--");
                 dial_create_canvas_text(infotxt, label_dsc->label_font, label_dsc->text_color, pos.x + label_dsc->text_pos.x, pos.y + label_dsc->text_pos.y);
                 break;
             case LABEL_TYPE_SLEEP_QUALITY:
index dc8c0f2..7b265b3 100644 (file)
@@ -37,7 +37,7 @@ extern "C" {
 
 #define WECHAT_MSG_CHAT_TIME_INTERVAL  (3 * 60) /*display the time of current chat msg if more than 3 mins from the previous chat msgs*/
 
-#define WECHAT_MSG_SENDING_TIME_MAX            (1000 * 3) // ms
+//#define WECHAT_MSG_SENDING_TIME_MAX          (1000 * 3) // ms
 
 #define WECHAT_MSG_TEXT_LEN_MAX                (32) // (64) // unicode
 
@@ -62,7 +62,6 @@ typedef struct
 {
     lv_watch_obj_ext_t old_ext;
     lv_obj_t * label;
-       uint32_t file_size;
 } lv_wechat_msg_recording_ext_t;
 
 typedef struct
@@ -75,6 +74,7 @@ typedef struct
 typedef struct {
     lv_page_ext_t old_ext;
     lv_anim_t voice_playing_anim;
+       uint8_t voice_playing_msg_from;         // 0-slef; 1-other
     bool pressing;
     lv_style_t style_cont_self;
     lv_style_t style_cont_other;
@@ -104,6 +104,8 @@ typedef struct
        TIMER_ID delete_timer_id;
 
     MCI_EVNET_T event;
+       uint8_t * record_buffer;
+       uint32_t record_size;
 }lv_wechat_ext_t;
 
 
index 0260e1b..ab66962 100644 (file)
@@ -12,7 +12,8 @@ static uint8_t s_wechat_msg_init_flag = 0;
 static nv_watch_wechat_msg_info_t * s_wechat_msg_info = NULL;
 static nv_watch_wechat_msg_item_info_t s_wechat_msg_item_info = {0};
 static uint8_t s_wechat_play_anim_count = 0;
-char s_wechat_selected_item_index = -1;
+static char s_wechat_selected_item_index = -1;
+static bool s_item_receive_playing = false;
 
 
 void wechat_msg_info_nv_write(void)
@@ -91,8 +92,6 @@ void wechat_msg_info_index_item_delete(uint8_t msg_index)
                }
        }
        s_wechat_msg_info->msg_count--;
-
-       wechat_msg_info_nv_write();
 }
 
 void wechat_msg_info_all_item_delete(void)
@@ -106,8 +105,6 @@ void wechat_msg_info_all_item_delete(void)
                _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)
@@ -133,8 +130,6 @@ void wechat_msg_info_new_item_add(nv_watch_wechat_msg_item_info_t * msg_item)
        
        s_wechat_msg_info->msg_count++;
        _lv_memcpy(&(s_wechat_msg_info->msg_item[s_wechat_msg_info->msg_count - 1]), msg_item, msg_item_info_size);
-
-       wechat_msg_info_nv_write();
 }
 
 void * wechat_actId_ext_get(lv_watch_Activity_Id_t actId)
@@ -201,14 +196,15 @@ void wechat_prepare_destory(lv_obj_t * activity_obj)
                ext->delete_timer_id = NULL;
        }
 
-       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-
        wechat_msg_voice_item_playing_stop(ext);
-
-       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-       
        wechat_chat_list_msg_item_style_reset(ext);
 
+       //
+       Hal_NFFS_File_Play_End();
+       Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
+       Hal_Vibrator_Play_End();
+       s_item_receive_playing = false;
+
        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
 }
 
@@ -278,6 +274,7 @@ void wechat_receive_audio_play_audio_ctrl_callback(AUDIO_CTRL_PRIORITY priority)
                Hal_NFFS_File_Play_End();
                Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
                Hal_Vibrator_Play_End();
+               s_item_receive_playing = false;
     }
 }
 
@@ -288,18 +285,47 @@ void wechat_receive_audio_play_over_cb(void *para)
        Hal_NFFS_File_Play_End();
        Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
        Hal_Vibrator_Play_End();
+       s_item_receive_playing = false;
+}
+
+static bool wechat_msg_item_info_write_to_file(char * file_path, char * file_buf, uint32_t file_size)
+{
+       lv_fs_file_t file_p;
+       lv_fs_res_t res;
+       uint32_t bytes_write = 0;
+       
+       res = lv_fs_open(&file_p, file_path, LV_FS_MODE_WR);
+       if(LV_FS_RES_OK != res) 
+       {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
+               lv_fs_close(&file_p);
+               return false;
+       }
+       res = lv_fs_write(&file_p, file_buf, file_size, &bytes_write);
+       lv_fs_close(&file_p);
+       if(LV_FS_RES_OK != res)
+       {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
+               return false;
+       }
+       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: file_size=%d,write_size=%d\n", __FUNCTION__, __LINE__, file_size, bytes_write);
+
+       return true;
 }
 
-#if 1
 void wechat_msg_receive_update_ui(void)
 {
        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
        
        if(AUDIO_CTRL_PRIORITY_5 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_5, wechat_receive_audio_play_audio_ctrl_callback))
        {
-               Hal_NFFS_File_Play_Onetime(AUDIO_WECHAT_RECEIVE, (HAL_SPEAKER_GAIN)query_current_volume(), wechat_receive_audio_play_over_cb, NULL);
-
-               Hal_Vibrator_Play_Onetime(NULL, 1000);
+               if(false == s_item_receive_playing)
+               {
+                       s_item_receive_playing = true;
+               
+                       Hal_NFFS_File_Play_Onetime(AUDIO_WECHAT_RECEIVE, (HAL_SPEAKER_GAIN)query_current_volume(), wechat_receive_audio_play_over_cb, NULL);
+                       Hal_Vibrator_Play_Onetime(NULL, 1000);
+               }
        
                if(lv_watch_get_activity_obj(ACT_ID_WECHAT_MAIN)) 
                {
@@ -330,51 +356,39 @@ bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len, nv_wech
        char * t_file_ext[WECHAT_MSG_TYPE_MAX] = {"amr", "txt", "png", "png"}; // match nv_wechat_msg_type_e
        
        Hal_Rtc_Gettime(&cur_time);
-       wechat_msg_item_info.msg_time.tm_year = cur_time.tm_year;
-       wechat_msg_item_info.msg_time.tm_mon = cur_time.tm_mon;
-       wechat_msg_item_info.msg_time.tm_mday = cur_time.tm_mday;
-       wechat_msg_item_info.msg_time.tm_hour = cur_time.tm_hour;
-       wechat_msg_item_info.msg_time.tm_min = cur_time.tm_min;
-       wechat_msg_item_info.msg_time.tm_sec = cur_time.tm_sec;
+       _lv_memcpy(&(wechat_msg_item_info.msg_time), &cur_time, sizeof(hal_rtc_t));
        
        wechat_msg_item_info.msg_from = 1;
        wechat_msg_item_info.unread_flag = 1;
        wechat_msg_item_info.msg_type = type; // WECHAT_MSG_TYPE_VOICE;
+       wechat_msg_item_info.msg_data_size = data_buff_len;
        sprintf(wechat_msg_item_info.msg_data_full_file_name, "C:/wechat_r%04d%02d%02d_%02d%02d%02d.%s", /*WECHAT_MSG_DATA_FILE_PATH, */
-                       wechat_msg_item_info.msg_time.tm_year, wechat_msg_item_info.msg_time.tm_mon, wechat_msg_item_info.msg_time.tm_mday,
-                       wechat_msg_item_info.msg_time.tm_hour, wechat_msg_item_info.msg_time.tm_min, wechat_msg_item_info.msg_time.tm_sec,
+                       wechat_msg_item_info.msg_time.tm_year,
+                       wechat_msg_item_info.msg_time.tm_mon,
+                       wechat_msg_item_info.msg_time.tm_mday,
+                       wechat_msg_item_info.msg_time.tm_hour,
+                       wechat_msg_item_info.msg_time.tm_min,
+                       wechat_msg_item_info.msg_time.tm_sec,
                        t_file_ext[type]);
 
-       lv_fs_file_t file_p = {0};
-       lv_fs_res_t res = 0;
-       uint32_t bytes_write = 0;
-
-       res = lv_fs_open(&file_p, wechat_msg_item_info.msg_data_full_file_name, LV_FS_MODE_WR);
-       if(LV_FS_RES_OK != res)
+       if(false == wechat_msg_item_info_write_to_file(wechat_msg_item_info.msg_data_full_file_name, data_buff, data_buff_len))
        {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
-               lv_fs_close(&file_p);
-               
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                return false;
        }
-       
-       lv_fs_seek(&file_p, 0);
-       res = lv_fs_write(&file_p, data_buff, data_buff_len, &bytes_write);
-       if(LV_FS_RES_OK != res)
+
+       lv_wechat_ext_t * ext = wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
+       if(NULL != ext) 
        {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
-               lv_fs_close(&file_p);
-               
-               return false;
+               wechat_msg_voice_item_playing_stop(ext);
        }
-       lv_fs_close(&file_p);
        
        wechat_msg_info_new_item_add(&wechat_msg_item_info);
 
        // ui
        if(false == mmi_active_screen_is_prohibit_interrupted() 
                && false == mmi_health_measure_state_is_ui_measure()
-               && false == wechat_msg_voice_is_playing() 
+//             && false == wechat_msg_voice_is_playing() 
                && false == wechat_msg_voice_is_recording()
                && false == wechat_msg_item_is_sending()
                #ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
@@ -391,140 +405,41 @@ bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len, nv_wech
        return true;
 }
 
-#else
-
-bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len, nv_wechat_msg_type_e type)
-{
-       if(NULL == data_buff || 0 == data_buff_len)
-       {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-               return false;
-       }
-       if(WECHAT_MSG_TYPE_MAX <= type)
-       {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-               return false;
-       }
-       
-       nv_watch_wechat_msg_item_info_t wechat_msg_item_info = {0};
-       hal_rtc_t cur_time = {0};
-       char * t_file_ext[WECHAT_MSG_TYPE_MAX] = {"amr", "txt", "png", "png"};
-       
-       Hal_Rtc_Gettime(&cur_time);
-       wechat_msg_item_info.msg_time.tm_year = cur_time.tm_year;
-       wechat_msg_item_info.msg_time.tm_mon = cur_time.tm_mon;
-       wechat_msg_item_info.msg_time.tm_mday = cur_time.tm_mday;
-       wechat_msg_item_info.msg_time.tm_hour = cur_time.tm_hour;
-       wechat_msg_item_info.msg_time.tm_min = cur_time.tm_min;
-       wechat_msg_item_info.msg_time.tm_sec = cur_time.tm_sec;
-       
-       wechat_msg_item_info.msg_from = 1;
-       wechat_msg_item_info.unread_flag = 1;
-       wechat_msg_item_info.msg_type = type; // WECHAT_MSG_TYPE_VOICE;
-       sprintf(wechat_msg_item_info.msg_data_full_file_name, "C:/wechat_r%04d%02d%02d_%02d%02d%02d.%s", /*WECHAT_MSG_DATA_FILE_PATH, */
-                       wechat_msg_item_info.msg_time.tm_year, wechat_msg_item_info.msg_time.tm_mon, wechat_msg_item_info.msg_time.tm_mday,
-                       wechat_msg_item_info.msg_time.tm_hour, wechat_msg_item_info.msg_time.tm_min, wechat_msg_item_info.msg_time.tm_sec,
-                       t_file_ext[type]);
-
-       lv_fs_file_t file_p = {0};
-       lv_fs_res_t res = 0;
-       uint32_t bytes_write = 0;
-
-       res = lv_fs_open(&file_p, wechat_msg_item_info.msg_data_full_file_name, LV_FS_MODE_WR);
-       if(LV_FS_RES_OK != res)
-       {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
-               lv_fs_close(&file_p);
-               
-               return false;
-       }
-       
-       lv_fs_seek(&file_p, 0);
-       res = lv_fs_write(&file_p, data_buff, data_buff_len, &bytes_write);
-       if(LV_FS_RES_OK != res)
-       {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
-               lv_fs_close(&file_p);
-               
-               return false;
-       }
-       lv_fs_close(&file_p);
-       
-       wechat_msg_info_new_item_add(&wechat_msg_item_info);
-
-       if(false == mmi_active_screen_is_prohibit_interrupted() 
-               && false == mmi_health_measure_state_is_ui_measure()
-               && false == wechat_msg_voice_is_playing() 
-               && false == wechat_msg_voice_is_recording()
-               && false == wechat_msg_item_is_sending()
-               )
-       {
-               mmi_watch_wake_up();            
-               
-               if(AUDIO_CTRL_PRIORITY_5 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_5, wechat_receive_audio_play_audio_ctrl_callback))
-               {
-                       Hal_NFFS_File_Play_Onetime(AUDIO_WECHAT_RECEIVE, (HAL_SPEAKER_GAIN)query_current_volume(), wechat_receive_audio_play_over_cb, NULL);
-               }
-       
-               Hal_Vibrator_Play_Onetime(NULL, 1000);
-               
-               if(lv_watch_get_activity_obj(ACT_ID_WECHAT_MAIN)) 
-               {
-                       wechat_main_screen_refresh();
-               }
-               else
-               {
-                       wechat_create_event_cb(NULL, LV_EVENT_CLICKED);
-               }
-       }
-
-       return true;
-}
-#endif
-
 bool wechat_msg_send_to_server(void)
 {
        bool result = false; // true-success; false-fail
-       lv_fs_file_t file_p;
-       lv_fs_res_t res;
-       uint32_t file_size = 0, bytes_read = 0;
-       char * file_buf = NULL;
        
-       res = lv_fs_open(&file_p, s_wechat_msg_item_info.msg_data_full_file_name, LV_FS_MODE_RD);
-       if(LV_FS_RES_OK != res) 
-       {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
-               lv_fs_close(&file_p);
-               
+       lv_wechat_ext_t * ext = (lv_wechat_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
+       if(NULL == ext) 
                return false;
-       }
-       
-       lv_fs_size(&file_p, &file_size);
-    file_buf = lv_mem_alloc(file_size + 1);
-       _lv_memset_00(file_buf, file_size + 1);
-       res = lv_fs_read(&file_p, file_buf, file_size, &bytes_read);
-       lv_fs_close(&file_p);
-       if(LV_FS_RES_OK != res)
+
+       uint32_t file_size = ext->record_size;
+    char * file_buf = lv_mem_alloc(file_size + 1);
+       if(NULL == file_buf)
        {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
-               
-               result = false;
-       }
-       else
+        lv_mem_free(ext->record_buffer);
+        ext->record_buffer = NULL;
+        return false;
+    }
+       _lv_memset_00(file_buf, file_size + 1);
+       _lv_memcpy(file_buf, ext->record_buffer, file_size);
+       lv_mem_free(ext->record_buffer);
+       ext->record_buffer = NULL;
+
+       if(true == wechat_msg_item_info_write_to_file(s_wechat_msg_item_info.msg_data_full_file_name, file_buf, file_size))
        {
-               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d,file_size=%d\n", __FUNCTION__, __LINE__, res, file_size);
-               
                if(true == mmi_protocol_action_send_talk(file_buf, file_size))
                {
+                       s_wechat_msg_item_info.msg_data_size = file_size;
                        wechat_msg_info_new_item_add(&s_wechat_msg_item_info);
                        result = true;
                }
                else
                {
                        lv_fs_remove(s_wechat_msg_item_info.msg_data_full_file_name);
-                       result = false;
                }
        }
+       
        lv_mem_free(file_buf);
        _lv_memset_00(&s_wechat_msg_item_info, sizeof(nv_watch_wechat_msg_item_info_t));
 
@@ -535,13 +450,6 @@ void wechat_msg_item_delete_success_timer_cb(void *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;
-       //}
-
-       //lv_obj_del(ext->delete_bg);
        wechat_main_screen_refresh();
 }
 
@@ -784,13 +692,6 @@ void wechat_msg_sending_screen_prepare_destory(lv_obj_t * activity_obj)
                        Hal_Timer_Stop(sending_ext->result_timer_id);
                        sending_ext->result_timer_id = NULL;
                }
-               
-               //WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-               //if(NULL != sending_ext->sending_anim.var)
-               //{
-               //      lv_anim_del(sending_ext->sending_anim.var, NULL);
-               //      sending_ext->sending_anim.var = NULL;
-               //}
        }
 }
 
@@ -818,9 +719,10 @@ lv_obj_t * wechat_msg_sending_screen_create(lv_obj_t * activity_obj)
                return NULL;
                
        wechat_chat_list_set_slide_enable(&sending_ext->old_ext, false); /*prevent to slide out while recording*/
-       sending_ext->result_timer_id = NULL;
+       _lv_memset_00(&(sending_ext->sending_anim), sizeof(lv_anim_t));
        sending_ext->send_result = wechat_msg_send_to_server();
        sending_ext->sending_timer_id = Hal_Timer_Start(1000 * 3, wechat_msg_sending_screen_timeout, sending_ext, FALSE);
+       sending_ext->result_timer_id = NULL;
 
     lv_obj_t * img_bkg = lv_img_create(obj, NULL);
     lv_img_set_src(img_bkg, ICON_WECHAT_SENDING_BG);
@@ -899,21 +801,7 @@ void wechat_msg_recording_anim(lv_anim_t * a)
         int8_t count_down = WECHAT_MSG_DATA_RECORD_DURATION_MAX - s_wechat_play_anim_count / 4;
         WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: count down=%d\n", __FUNCTION__, __LINE__, count_down);
                
-        if(0 == count_down)
-               {
-                       Hal_File_Record_Stop_Req(&(recording_ext->file_size));
-                       recording_ext->file_size = 0;
-                       Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
-                       
-                       //lv_watch_del_interface(ACT_ID_WECHAT_RECORDING);
-                       lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
-                       if(NULL != activity_obj)
-                       {
-                               lv_obj_del(activity_obj);
-                       }
-                       wechat_msg_sending_screen_create(NULL);
-               }
-               else
+        if(0 < count_down)
                {
                const char * content = lv_lang_get_text(WATCH_TEXT_ID_RELEASE_SENDING);
                uint8_t len = strlen(content) + 8;
@@ -926,6 +814,36 @@ void wechat_msg_recording_anim(lv_anim_t * a)
     }
 }
 
+bool wechat_msg_recording_stop(bool is_cancel)
+{
+       uint32_t duration_ms = 0;
+       uint32_t size = 0;
+       
+       Hal_Record_Buffer_Stop_Req(&size, &duration_ms);
+    Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
+       
+       lv_wechat_ext_t * ext = (lv_wechat_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
+       if(NULL == ext) 
+               return false;
+
+       if(true == is_cancel)
+       {
+        lv_mem_free(ext->record_buffer);
+        ext->record_buffer = NULL;
+        return false;
+    }
+       
+    if(WECHAT_MSG_DATA_AMR_HEAD_SIZE >= size) 
+       {
+        lv_mem_free(ext->record_buffer);
+        ext->record_buffer = NULL;
+        return false;
+    }
+       ext->record_size = size;
+
+       return true;
+}
+
 void wechat_msg_recording_audio_ctrl_callback(AUDIO_CTRL_PRIORITY priority)
 {
        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: priority=%d\n", __FUNCTION__, __LINE__, priority);
@@ -940,13 +858,7 @@ void wechat_msg_recording_audio_ctrl_callback(AUDIO_CTRL_PRIORITY priority)
     }
     else if(AUDIO_CTRL_PRIORITY_5 > priority)
     {
-               lv_wechat_msg_recording_ext_t * recording_ext = (lv_wechat_msg_recording_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_RECORDING);
-               if(NULL != recording_ext)
-               {
-                       Hal_File_Record_Stop_Req(&(recording_ext->file_size));
-                       recording_ext->file_size = 0;
-               }
-               Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
+               wechat_msg_recording_stop(true);
                
                //lv_watch_del_interface(ACT_ID_WECHAT_RECORDING);
                lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
@@ -957,10 +869,8 @@ void wechat_msg_recording_audio_ctrl_callback(AUDIO_CTRL_PRIORITY priority)
     }
 }
 
-void wechat_msg_recording_cb(MCI_EVNET_T event , MCI_INFO_T info_type, int32_t value)
+void wechat_msg_recording_task_cb(lv_task_t * task)
 {
-       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: event=%d\n", __FUNCTION__, __LINE__, event);
-
        lv_wechat_ext_t * ext = (lv_wechat_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
        if(NULL == ext) 
                return ;
@@ -970,14 +880,18 @@ void wechat_msg_recording_cb(MCI_EVNET_T event , MCI_INFO_T info_type, int32_t v
                /*sliding to the right, not click button*/
                return;
        }
-       
-       lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
 
-       switch(ext->event) 
+       lv_obj_t * activity_obj;
+       MCI_EVNET_T event = (MCI_EVNET_T) (task->user_data);
+       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: event=%d\n", __FUNCTION__, __LINE__, event);
+       
+       switch(event) 
        {
                case MCI_EVENT_EOS:
                        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-                       //lv_watch_del_interface(ACT_ID_WECHAT_RECORDING);
+                       
+                       wechat_msg_recording_stop(false);
+                       activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
                        if(NULL != activity_obj)
                        {
                                lv_obj_del(activity_obj);
@@ -987,55 +901,60 @@ void wechat_msg_recording_cb(MCI_EVNET_T event , MCI_INFO_T info_type, int32_t v
                        
                case MCI_EVENT_ERROR:
                        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-                       lv_wechat_msg_recording_ext_t * recording_ext = (lv_wechat_msg_recording_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_RECORDING);
-                       if(NULL != recording_ext)
-                       {
-                               Hal_File_Record_Stop_Req(&(recording_ext->file_size));
-                               recording_ext->file_size = 0;
-                       }
-                       Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
-                       lv_fs_remove(s_wechat_msg_item_info.msg_data_full_file_name);
-                       //lv_watch_del_interface(ACT_ID_WECHAT_RECORDING);
+
+                       wechat_msg_recording_stop(true);
+                       activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
                        if(NULL != activity_obj)
                        {
                                lv_obj_del(activity_obj);
                        }
                        break;
                        
-               case MCI_EVENT_INFO:
-                       break;
+               //case MCI_EVENT_INFO:
+               //      break;
                        
                default:
                        break;
        }
 }
 
+void wechat_msg_recording_cb(MCI_EVNET_T event, MCI_INFO_T info_type, int32_t value)
+{
+       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: event=%d,type=%d,value=%d\n", __FUNCTION__, __LINE__, event, info_type, value);
+
+    if(MCI_EVENT_INFO != event) 
+       {
+        //recording_ext->event = event;
+           lv_task_t * record_task = lv_task_create(wechat_msg_recording_task_cb, 10, LV_TASK_PRIO_HIGH, event);
+       lv_task_once(record_task);
+    }
+}
+
+
 void wechat_msg_recording_screen_prepare_destory(lv_obj_t * activity_obj)
 {
-       printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
        
-#if 0
     lv_watch_png_cache_all_free();
 
-       lv_obj_t * obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
-       if(NULL != obj)
-       {
-               lv_obj_del(obj);
-       }
-#endif
+       wechat_msg_recording_stop(true);
 }
 
-void wechat_msg_recording_screen_create(void)
+lv_obj_t * wechat_msg_recording_screen_create(lv_obj_t * activity_obj)
 {
        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
 
-    lv_watch_activity_ext_t activity_ext = {0};
+    if(NULL == activity_obj) 
+       {
+        lv_watch_activity_ext_t activity_ext = {0};
 
-    activity_ext.actId = ACT_ID_WECHAT_RECORDING;
-    activity_ext.create = NULL;
-    activity_ext.prepare_destory = wechat_common_screen_prepare_destory;
-    lv_obj_t * activity_obj = lv_watch_creat_activity_obj(&activity_ext);
-    LV_ASSERT_MEM(activity_obj);
+               activity_ext.actId = ACT_ID_WECHAT_RECORDING;
+               activity_ext.create = wechat_msg_recording_screen_create;
+               activity_ext.prepare_destory = wechat_msg_recording_screen_prepare_destory; // wechat_common_screen_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);
@@ -1112,12 +1031,39 @@ void wechat_msg_recording_screen_create(void)
                                                        s_wechat_msg_item_info.msg_from, s_wechat_msg_item_info.msg_data_full_file_name);
        
        //recording
+#if 0
        if(AUDIO_CTRL_PRIORITY_5 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_5, wechat_msg_recording_audio_ctrl_callback))
        {
                Hal_File_Record_Start_Req(s_wechat_msg_item_info.msg_data_full_file_name, wechat_msg_recording_cb);
        }
+
+#else
+
+       lv_wechat_ext_t * ext = (lv_wechat_ext_t *)wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
+       if(NULL == ext) 
+               return NULL;
        
-    return;
+       if(NULL != ext->record_buffer)
+       {
+               lv_mem_free(ext->record_buffer);
+               ext->record_buffer = NULL;
+       }
+       ext->record_buffer = (uint8_t *)lv_mem_alloc(WECHAT_MSG_DATA_RECORD_SIZE_MAX);
+       if(NULL != ext->record_buffer)
+       {
+               _lv_memset_00(ext->record_buffer, WECHAT_MSG_DATA_RECORD_SIZE_MAX);
+
+               if(AUDIO_CTRL_PRIORITY_5 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_5, wechat_msg_recording_audio_ctrl_callback))
+               {
+                       Hal_Record_Buffer_Start_Req(ext->record_buffer,
+                                                                               WECHAT_MSG_DATA_RECORD_SIZE_MAX,
+                                                                               WECHAT_MSG_DATA_RECORD_DURATION_MAX * 1000,
+                                                                               wechat_msg_recording_cb);
+               }
+       }
+#endif
+       
+    return obj;
 }
 
 static void wechat_out_of_memory_btn_event_cb(lv_obj_t * btn, lv_event_t e)
@@ -1203,12 +1149,13 @@ void wechat_msg_record_button_event_cb(lv_obj_t * obj, lv_event_t e)
                {
                        wechat_chat_list_set_slide_enable(&ext->old_ext, false); /*prevent to slide out while recording*/
 
-                       wechat_msg_recording_screen_create();
+                       wechat_msg_recording_screen_create(NULL);
        }
     } 
        else if(LV_EVENT_CLICKED == e || LV_EVENT_PRESS_LOST == e) 
        {
-        if(lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING)) 
+               lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
+               if(NULL != activity_obj)
                {
                        lv_wechat_ext_t * ext = wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
                        if(NULL == ext) 
@@ -1228,19 +1175,9 @@ void wechat_msg_record_button_event_cb(lv_obj_t * obj, lv_event_t e)
                                lv_coord_t img_record_top = obj->coords.y1;
                 if(30 < img_record_top - point_y) // (point_y < (img_record_top - 20))
                                {
-                    /*last point is above img, consider as sliding up and cancel recording*/
                                        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: indev_y=%d, img_y=%d\n", __FUNCTION__, __LINE__, point_y, img_record_top);
-                                       
-                                       Hal_File_Record_Stop_Req(&(recording_ext->file_size));
-                                       recording_ext->file_size = 0;
-                                       Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
-                                       lv_fs_remove(s_wechat_msg_item_info.msg_data_full_file_name);
-                                       //lv_watch_del_interface(ACT_ID_WECHAT_RECORDING);
-                                       lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
-                                       if(NULL != activity_obj)
-                                       {
-                                               lv_obj_del(activity_obj);
-                                       }
+                                       wechat_msg_recording_stop(true);
+                                       lv_obj_del(activity_obj);
                                        //return main list screen
                                        wechat_main_screen_refresh();
 
@@ -1249,15 +1186,8 @@ void wechat_msg_record_button_event_cb(lv_obj_t * obj, lv_event_t e)
             }
 
                        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-                       Hal_File_Record_Stop_Req(&(recording_ext->file_size));
-                       recording_ext->file_size = 0;
-                       Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
-                       //lv_watch_del_interface(ACT_ID_WECHAT_RECORDING);
-                       lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_WECHAT_RECORDING);
-                       if(NULL != activity_obj)
-                       {
-                               lv_obj_del(activity_obj);
-                       }
+                       wechat_msg_recording_stop(false);
+                       lv_obj_del(activity_obj);
                        wechat_msg_sending_screen_create(NULL);            
         }
     }
@@ -1267,30 +1197,52 @@ void wechat_msg_record_button_event_cb(lv_obj_t * obj, lv_event_t e)
                if(NULL == ext) 
                        return ;
 
+               //
+               Hal_NFFS_File_Play_End();
+               Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
+               Hal_Vibrator_Play_End();
+
                wechat_msg_voice_item_playing_stop(ext);
        }
 }
 
+void wechat_msg_voice_item_reset_play_state(lv_wechat_msg_list_ext_t * list_page_ext)
+{
+       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       
+       if(NULL == list_page_ext || NULL == list_page_ext->voice_playing_anim.var) 
+       {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               return;
+       }
+
+       uint8_t msg_from = list_page_ext->voice_playing_msg_from;
+       
+       lv_anim_del(list_page_ext->voice_playing_anim.var, NULL);
+       lv_img_set_src(list_page_ext->voice_playing_anim.var, ((0 == msg_from) ? ICON_WECHAT_MY_VOICE_ITEM_PLAYING3 : ICON_WECHAT_OTHER_VOICE_ITEM_PLAYING3));
+       list_page_ext->voice_playing_anim.var = NULL;
+}
+
 void wechat_msg_voice_item_playing_stop(lv_wechat_ext_t * ext)
 {
+       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       
     if(NULL == ext || NULL == ext->list) 
+       {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                return;
+       }
 
-       lv_wechat_msg_list_ext_t * list_page_ext = lv_obj_get_ext_attr(ext->list);
-    if(NULL == list_page_ext) 
+       lv_wechat_msg_list_ext_t * list_page_ext = (lv_wechat_msg_list_ext_t *)lv_obj_get_ext_attr(ext->list);
+       if(NULL == list_page_ext || NULL == list_page_ext->voice_playing_anim.var) 
+       {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                return;
+       }
        
-    if(NULL != list_page_ext->voice_playing_anim.var) 
-       {
-               Hal_File_Play_End();
-        Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
-                               
-               uint8_t msg_from = wechat_msg_info_index_item_msg_from_get(s_wechat_selected_item_index);
-               
-        lv_anim_del(list_page_ext->voice_playing_anim.var, NULL);
-               lv_img_set_src(list_page_ext->voice_playing_anim.var, (0 == msg_from) ? ICON_WECHAT_MY_VOICE_ITEM_PLAYING3 : ICON_WECHAT_OTHER_VOICE_ITEM_PLAYING3);
-        list_page_ext->voice_playing_anim.var = NULL;
-    }
+       Hal_File_Play_End();
+       Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
+       wechat_msg_voice_item_reset_play_state(list_page_ext);
 }
 
 void wechat_chat_list_msg_item_style_reset(lv_wechat_ext_t * ext)
@@ -1464,22 +1416,18 @@ void wechat_chat_list_voice_item_play_over_cb(void * para)
     Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
        
        lv_wechat_msg_list_ext_t * list_page_ext = (lv_wechat_msg_list_ext_t *)para;
-       
     if(NULL == list_page_ext || NULL == list_page_ext->voice_playing_anim.var) 
        {
                WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                return;
     }
-
-       uint8_t msg_from = wechat_msg_info_index_item_msg_from_get(s_wechat_selected_item_index);
-       
-       lv_anim_del(list_page_ext->voice_playing_anim.var, NULL);
-       lv_img_set_src(list_page_ext->voice_playing_anim.var, ((0 == msg_from) ? ICON_WECHAT_MY_VOICE_ITEM_PLAYING3 : ICON_WECHAT_OTHER_VOICE_ITEM_PLAYING3));
-       list_page_ext->voice_playing_anim.var = NULL;    
+       wechat_msg_voice_item_reset_play_state(list_page_ext);   
 }
 
 void wechat_chat_list_voice_item_play_action(lv_wechat_msg_list_ext_t * list_page_ext, lv_obj_t * play_img, lv_obj_t * unread_img)
 {
+       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       
        //display ui
        lv_anim_t * a = &(list_page_ext->voice_playing_anim);
 
@@ -1497,11 +1445,14 @@ void wechat_chat_list_voice_item_play_action(lv_wechat_msg_list_ext_t * list_pag
        if(NULL != unread_img) 
        {
                lv_obj_del(unread_img);
+               unread_img = NULL;
        }
+       list_page_ext->voice_playing_msg_from = msg_item->msg_from;
 
        //play voice
        if(AUDIO_CTRL_PRIORITY_5 == Hal_Audio_Manage_Start_Req(AUDIO_CTRL_PRIORITY_5, wechat_chat_list_voice_item_playing_audio_ctrl_callback))
        {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                Hal_File_Play_Onetime(msg_item->msg_data_full_file_name, query_current_volume(), wechat_chat_list_voice_item_play_over_cb, list_page_ext, 0);
        }
 }
@@ -1536,32 +1487,28 @@ void wechat_chat_list_voice_item_event_cb(lv_obj_t * cont, lv_event_t e)
        {
                list_page_ext->pressing = false;
                
-        lv_obj_t * play_img = lv_obj_get_child_back(cont, NULL);
                nv_watch_wechat_msg_item_info_t * msg_item = NULL;
                wechat_msg_info_index_item_get(s_wechat_selected_item_index, &msg_item);
 
-        if(NULL != list_page_ext->voice_playing_anim.var) // exist voice playing
+               if(0 != msg_item->msg_data_size)
                {
-            lv_obj_t * old_img = list_page_ext->voice_playing_anim.var;
-
-                       //stop old item voice
-                       Hal_File_Play_End();
-                       Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
-                       
-                       lv_anim_del(list_page_ext->voice_playing_anim.var, NULL);
-                       lv_img_set_src(list_page_ext->voice_playing_anim.var, ((0 == msg_item->msg_from) ? ICON_WECHAT_MY_VOICE_ITEM_PLAYING3 : ICON_WECHAT_OTHER_VOICE_ITEM_PLAYING3));
-                       list_page_ext->voice_playing_anim.var = NULL;
-                       
-                       //play new item voice
-                       if((play_img != old_img) && (NULL != msg_item->msg_data_full_file_name))
+               if(NULL != list_page_ext->voice_playing_anim.var) // exist voice playing
                        {
-                               wechat_chat_list_voice_item_play_action(list_page_ext, play_img, list_item_ext->unread_img);
-            }
-        }
-               else if(NULL != msg_item->msg_data_full_file_name) 
-               {
-                       wechat_chat_list_voice_item_play_action(list_page_ext, play_img, list_item_ext->unread_img);
-        }              
+                               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: index=%d\n", __FUNCTION__, __LINE__, list_item_ext->item_index);
+
+                               //stop item voice
+                               Hal_File_Play_End();
+                               Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5);
+                               wechat_msg_voice_item_reset_play_state(list_page_ext);
+               }
+                       else if(NULL != msg_item->msg_data_full_file_name) 
+                       {
+                               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: index=%d\n", __FUNCTION__, __LINE__, list_item_ext->item_index);
+                               
+                               lv_obj_t * play_img = lv_obj_get_child_back(cont, NULL);
+                               wechat_chat_list_voice_item_play_action(list_page_ext, play_img, ((1 == msg_item->unread_flag) ? list_item_ext->unread_img : NULL));
+               }               
+               }
     }
 }
 
@@ -1687,7 +1634,7 @@ lv_obj_t * wechat_chat_list_msg_item_add(lv_obj_t * list_page, nv_watch_wechat_m
                                        lv_img_set_src(play_img, ICON_WECHAT_MY_VOICE_ITEM_PLAYING3);
                                }
                                lv_obj_align(play_img, obj, LV_ALIGN_IN_LEFT_MID, 15, 0);
-                               lv_obj_align(len_label, play_img, LV_ALIGN_OUT_RIGHT_MID, 20, 0);
+                               lv_obj_align(len_label, play_img, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
                                lv_obj_del(unread_img);
                        }
                        else // msg from other
@@ -1701,7 +1648,7 @@ lv_obj_t * wechat_chat_list_msg_item_add(lv_obj_t * list_page, nv_watch_wechat_m
                                        lv_img_set_src(play_img, ICON_WECHAT_OTHER_VOICE_ITEM_PLAYING3);
                                }
                                lv_obj_align(play_img, obj, LV_ALIGN_IN_RIGHT_MID, -15, 0);
-                               lv_obj_align(len_label, play_img, LV_ALIGN_OUT_LEFT_MID, -20, 0);
+                               lv_obj_align(len_label, play_img, LV_ALIGN_OUT_LEFT_MID, -10, 0);
                                if(1 == msg_item->unread_flag) 
                                {
                                        lv_img_set_src(unread_img, ICON_WECHAT_UNREAD_FLAG);
@@ -1747,7 +1694,7 @@ lv_obj_t * wechat_chat_list_msg_item_add(lv_obj_t * list_page, nv_watch_wechat_m
                        }
                        
                        lv_fs_size(&file_p, &file_size);
-                       file_buf = lv_mem_alloc(file_size + 1);
+                       file_buf = (char *)lv_mem_alloc(file_size + 1);
                        _lv_memset_00(file_buf, file_size + 1);
                        res = lv_fs_read(&file_p, file_buf, file_size, &bytes_read);
                        lv_fs_close(&file_p);
@@ -1886,6 +1833,7 @@ void wechat_chat_list_create(lv_obj_t * obj, lv_wechat_ext_t * ext)
        lv_style_set_pad_right(&(list_page_ext->style_cont_other), LV_STATE_DEFAULT, 5);
 
        _lv_memset_00(&(list_page_ext->voice_playing_anim), sizeof(lv_anim_t));
+       list_page_ext->voice_playing_msg_from = 0;
        list_page_ext->pressing = false;
        ext->list = list_page;
 
@@ -1915,15 +1863,6 @@ void wechat_chat_list_create(lv_obj_t * obj, lv_wechat_ext_t * ext)
        }
 }
 
-//void wechat_no_network_create(lv_obj_t * obj)
-//{
-//    lv_obj_t * img = lv_img_create(obj, NULL);
-//    //lv_obj_set_size(img, lv_obj_get_width(obj), lv_obj_get_height(obj));
-//    lv_img_set_src(img, ICON_WECHAT_NO_NETWORK);
-//    lv_obj_align(img, obj, LV_ALIGN_CENTER, 0, 0);
-//    lv_obj_set_click(img, false);
-//}
-
 void wechat_main_screen_refresh(void)
 {
        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
@@ -2008,6 +1947,8 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from)
        ext->from = from;
        ext->delete_timer_id = NULL;
        ext->delete_bg = NULL;
+       ext->record_buffer = NULL;
+       ext->record_size = 0;
 
        lv_obj_t * cont = lv_cont_create(obj, NULL);
        lv_obj_set_size(cont, lv_obj_get_width(obj), lv_obj_get_height(obj));
@@ -2055,7 +1996,7 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from)
        lv_obj_set_click(ext->img_record, true);
        lv_obj_set_event_cb(ext->img_record, wechat_msg_record_button_event_cb);
        lv_obj_set_adv_hittest(ext->img_record, false);
-    //lv_obj_add_protect(ext->img_record, LV_PROTECT_PRESS_LOST);
+    lv_obj_add_protect(ext->img_record, LV_PROTECT_PRESS_LOST);
        lv_watch_obj_add_element(ext->img_record);
        lv_obj_align(ext->img_record, cont, LV_ALIGN_IN_BOTTOM_MID, 0, -8);
 
index dfe5153..8cde3c8 100644 (file)
@@ -139,6 +139,11 @@ void pedometer_update_screen(void)
        digital_content_create(pedometer_cont, pedometer_get_steps(), 0);
 }
 
+void mmi_ui_msg_update_pedometer_screen(void)
+{
+       pedometer_update_screen();
+}
+
 void pedometer_update_goal(uint16_t goal)
 {
     pedometer_set_goalsteps(goal);
index a441744..fb415af 100644 (file)
@@ -65,6 +65,7 @@ uint16_t pedometer_get_goalsteps(void);
 uint16_t pedometer_get_steps(void);
 void pedometer_update_goal(uint16_t goal);
 void pedometer_update_screen(void);
+void mmi_ui_msg_update_pedometer_screen(void);
 #else
 
 lv_obj_t * pedometer_create(lv_obj_t * tileview, uint16_t id);
index aae4509..019566a 100644 (file)
@@ -507,8 +507,15 @@ static lv_obj_t * watch_create(bool silentReset)
     //app_adaptor_get_pedometer_info_req(&record);
 
     app_adaptor_timing_control_init();
+#ifdef __MMI_ZHSX_SUPPORT__
+#ifdef __MMI_ZHSX_SUPPORT_ALIPAY__
+       mmi_watch_alipay_info_init();
+#endif
 #ifdef __MMI_ZHSX_SUPPORT_NO_SIM_POWER_OFF__
        mmi_watch_no_sim_power_off_check_mission();     
+#endif
+
+
 #endif
 
     return obj;
index ebc9eb8..8bc6712 100644 (file)
@@ -248,7 +248,10 @@ void mmi_watch_searching_aciton(void)
        {
                return ;
        }
-       if(true == wechat_msg_voice_is_recording() || true == wechat_msg_item_is_sending())
+       if(true == wechat_msg_voice_is_recording()
+               || true == wechat_msg_item_is_sending()
+               || true == wechat_msg_voice_is_playing()
+               )
        {
                return;
        }
index 131bfbd..0bac5c2 100644 (file)
@@ -1794,7 +1794,7 @@ VOID Hal_Power_Off(HAL_POWER_OFF_TYPE type)
 {
 #ifdef __MMI_ZHSX_SUPPORT__
 #ifdef __MMI_WECHAT_SUPPORT__
-       //wechat_msg_info_nv_write();
+       wechat_msg_info_nv_write();
 #endif
        asl_pedometer_steps_save(true);
 #endif