gengxin
authorCCC <2393524978@qq.com>
Tue, 7 Nov 2023 09:46:54 +0000 (17:46 +0800)
committerCCC <2393524978@qq.com>
Tue, 7 Nov 2023 09:46:54 +0000 (17:46 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/alarm/alarm.c
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.c
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat.h
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_circle.c
2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.c

index d93200d..5762a23 100644 (file)
@@ -81,6 +81,7 @@ lv_obj_t * alarm_create(lv_obj_t * activity_obj)
 
        lv_obj_t * cont_gif = lv_cont_create(cont, NULL);
        lv_obj_set_size(cont_gif, 170, 170); // gif size
+    lv_obj_set_style_local_bg_color(cont_gif, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
        lv_obj_align(cont_gif, cont, LV_ALIGN_CENTER, 0, -30);
 
     hal_rtc_t cur_time;
index 9f2bde1..aff4fbc 100644 (file)
@@ -1885,9 +1885,10 @@ void wechat_main_screen_refresh(void)
 
        lv_wechat_ext_t * ext = wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
        if(NULL == ext)
+       {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                return;
-       
-       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       }       
        
        wechat_chat_list_set_slide_enable(&ext->old_ext, true);
        
@@ -1899,14 +1900,11 @@ 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);
@@ -1915,6 +1913,10 @@ void wechat_main_screen_refresh(void)
        
        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);      
        
+       lv_obj_set_hidden(ext->label_no_network, true);
+       lv_obj_set_hidden(ext->label_not_bind, true);
+       lv_obj_set_hidden(ext->img_record, false);
+       
        uint8_t msg_count = wechat_msg_info_count_get();
        if(0 == msg_count)
        {
@@ -1973,36 +1975,23 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from)
        lv_watch_obj_add_element(cont);
        ext->cont = cont;
 
-    if(false == watch_modem_sim_present_check_req()
-               //|| (MMI_MODEM_SIGNAL_BAR_0 == watch_modem_get_signal_bar_req())
-               )
-    {
-               // no network
-               lv_obj_t * label = lv_label_create(cont, NULL);
-               lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
-               lv_label_set_text_id(label, WATCH_TEXT_ID_DEVICE_NO_NETWORK);
-               lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
-               lv_obj_align(label, cont, LV_ALIGN_CENTER, 0, -10);
-               
-        return obj;
-    }
-    else if(true != mmi_watch_tcp_connect_state_get()
-                       || true != mmi_protocol_watch_bind_state_get()
-                       )
-    {
-               // not bind
-               lv_obj_t * label = lv_label_create(cont, NULL);
-               lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
-               lv_label_set_text_id(label, WATCH_TEXT_ID_DEVICE_NOT_BIND);
-               lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
-               lv_obj_align(label, cont, LV_ALIGN_CENTER, 0, -10);
-               
-        return obj;
-    }
+       // no network
+       ext->label_no_network = lv_label_create(cont, NULL);
+       lv_obj_add_style(ext->label_no_network, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+       lv_label_set_text_id(ext->label_no_network, WATCH_TEXT_ID_DEVICE_NO_NETWORK);
+       lv_label_set_align(ext->label_no_network, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(ext->label_no_network, cont, LV_ALIGN_CENTER, 0, -10);
+
+       // not bind
+       ext->label_not_bind = lv_label_create(cont, ext->label_no_network);
+       //lv_obj_add_style(ext->label_not_bind, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+       lv_label_set_text_id(ext->label_not_bind, WATCH_TEXT_ID_DEVICE_NOT_BIND);
+       //lv_label_set_align(ext->label_not_bind, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(ext->label_not_bind, cont, LV_ALIGN_CENTER, 0, -10);
 
        //create no msg label
-       ext->label_no_msg = lv_label_create(cont, NULL);
-       lv_obj_add_style(ext->label_no_msg, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+       ext->label_no_msg = lv_label_create(cont, ext->label_no_network);
+       //lv_obj_add_style(ext->label_no_msg, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
        lv_label_set_text_id(ext->label_no_msg, WATCH_TEXT_ID_NO_VOICE_MSG);
        //lv_label_set_align(ext->label_no_msg, LV_LABEL_ALIGN_CENTER);
        lv_obj_align(ext->label_no_msg, cont, LV_ALIGN_CENTER, 0, -10);
@@ -2016,16 +2005,41 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from)
        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();
-       if(0 == msg_count)
-       {
-               lv_obj_set_hidden(ext->label_no_msg, false);
-       }
+    if(false == watch_modem_sim_present_check_req()
+               //|| (MMI_MODEM_SIGNAL_BAR_0 == watch_modem_get_signal_bar_req())
+               )
+    {
+               lv_obj_set_hidden(ext->label_no_network, false);
+               lv_obj_set_hidden(ext->label_not_bind, true);
+               lv_obj_set_hidden(ext->label_no_msg, true);
+               lv_obj_set_hidden(ext->img_record, true);
+    }
+    else if(true != mmi_watch_tcp_connect_state_get()
+                       || true != mmi_protocol_watch_bind_state_get()
+                       )
+    {
+               lv_obj_set_hidden(ext->label_no_network, true);
+               lv_obj_set_hidden(ext->label_not_bind, false);
+               lv_obj_set_hidden(ext->label_no_msg, true);
+               lv_obj_set_hidden(ext->img_record, true);
+    }
        else
        {
-               lv_obj_set_hidden(ext->label_no_msg, true);
+               lv_obj_set_hidden(ext->label_no_network, true);
+               lv_obj_set_hidden(ext->label_not_bind, true);
+               lv_obj_set_hidden(ext->img_record, false);
                
-               wechat_chat_list_create(cont, ext);
+               uint8_t msg_count = wechat_msg_info_count_get();
+               if(0 == msg_count)
+               {
+                       lv_obj_set_hidden(ext->label_no_msg, false);
+               }
+               else
+               {
+                       lv_obj_set_hidden(ext->label_no_msg, true);
+                       
+                       wechat_chat_list_create(cont, ext);
+               }
        }
 
        //uint32_t fs_total = 0;
index b1e32f4..0c5fed9 100644 (file)
@@ -88,9 +88,11 @@ typedef struct
        lv_watch_obj_ext_t old_ext;
        lv_obj_t * cont;
        lv_obj_t * list; // chat list
-       lv_obj_t * label_no_msg; // mo msg prompt
        //lv_obj_t * img_emo;
        lv_obj_t * img_record; // record button
+       lv_obj_t * label_no_network; // no network prompt
+       lv_obj_t * label_not_bind; // not bind prompt
+       lv_obj_t * label_no_msg; // no msg prompt
        
        lv_wechat_created_from_e from; // msg from
 
index fcea522..33416a7 100644 (file)
@@ -1847,9 +1847,10 @@ void wechat_main_screen_refresh(void)
 
        lv_wechat_ext_t * ext = wechat_actId_ext_get(ACT_ID_WECHAT_MAIN);
        if(NULL == ext)
+       {
+               WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
                return;
-       
-       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       }       
        
        wechat_chat_list_set_slide_enable(&ext->old_ext, true);
        
@@ -1861,14 +1862,11 @@ 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);
@@ -1877,6 +1875,10 @@ void wechat_main_screen_refresh(void)
        
        WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);      
        
+       lv_obj_set_hidden(ext->label_no_network, true);
+       lv_obj_set_hidden(ext->label_not_bind, true);
+       lv_obj_set_hidden(ext->img_record, false);
+       
        uint8_t msg_count = wechat_msg_info_count_get();
        if(0 == msg_count)
        {
@@ -1935,36 +1937,23 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from)
        lv_watch_obj_add_element(cont);
        ext->cont = cont;
 
-    if(false == watch_modem_sim_present_check_req()
-               //|| (MMI_MODEM_SIGNAL_BAR_0 == watch_modem_get_signal_bar_req())
-               )
-    {
-               // no network
-               lv_obj_t * label = lv_label_create(cont, NULL);
-               lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
-               lv_label_set_text_id(label, WATCH_TEXT_ID_DEVICE_NO_NETWORK);
-               lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
-               lv_obj_align(label, cont, LV_ALIGN_CENTER, 0, -10);
-               
-        return obj;
-    }
-    else if(true != mmi_watch_tcp_connect_state_get()
-                       || true != mmi_protocol_watch_bind_state_get()
-                       )
-    {
-               // not bind
-               lv_obj_t * label = lv_label_create(cont, NULL);
-               lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
-               lv_label_set_text_id(label, WATCH_TEXT_ID_DEVICE_NOT_BIND);
-               lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
-               lv_obj_align(label, cont, LV_ALIGN_CENTER, 0, -10);
-               
-        return obj;
-    }
+       // no network
+       ext->label_no_network = lv_label_create(cont, NULL);
+       lv_obj_add_style(ext->label_no_network, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+       lv_label_set_text_id(ext->label_no_network, WATCH_TEXT_ID_DEVICE_NO_NETWORK);
+       lv_label_set_align(ext->label_no_network, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(ext->label_no_network, cont, LV_ALIGN_CENTER, 0, -10);
+
+       // not bind
+       ext->label_not_bind = lv_label_create(cont, ext->label_no_network);
+       //lv_obj_add_style(ext->label_not_bind, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+       lv_label_set_text_id(ext->label_not_bind, WATCH_TEXT_ID_DEVICE_NOT_BIND);
+       //lv_label_set_align(ext->label_not_bind, LV_LABEL_ALIGN_CENTER);
+       lv_obj_align(ext->label_not_bind, cont, LV_ALIGN_CENTER, 0, -10);
 
        //create no msg label
-       ext->label_no_msg = lv_label_create(cont, NULL);
-       lv_obj_add_style(ext->label_no_msg, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
+       ext->label_no_msg = lv_label_create(cont, ext->label_no_network);
+       //lv_obj_add_style(ext->label_no_msg, LV_LABEL_PART_MAIN, &lv_watch_font26_black);
        lv_label_set_text_id(ext->label_no_msg, WATCH_TEXT_ID_NO_VOICE_MSG);
        //lv_label_set_align(ext->label_no_msg, LV_LABEL_ALIGN_CENTER);
        lv_obj_align(ext->label_no_msg, cont, LV_ALIGN_CENTER, 0, -10);
@@ -1978,16 +1967,41 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from)
        lv_watch_obj_add_element(ext->img_record);
        lv_obj_align(ext->img_record, cont, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
 
-       uint8_t msg_count = wechat_msg_info_count_get();
-       if(0 == msg_count)
-       {
-               lv_obj_set_hidden(ext->label_no_msg, false);
-       }
+    if(false == watch_modem_sim_present_check_req()
+               //|| (MMI_MODEM_SIGNAL_BAR_0 == watch_modem_get_signal_bar_req())
+               )
+    {
+               lv_obj_set_hidden(ext->label_no_network, false);
+               lv_obj_set_hidden(ext->label_not_bind, true);
+               lv_obj_set_hidden(ext->label_no_msg, true);
+               lv_obj_set_hidden(ext->img_record, true);
+    }
+    else if(true != mmi_watch_tcp_connect_state_get()
+                       || true != mmi_protocol_watch_bind_state_get()
+                       )
+    {
+               lv_obj_set_hidden(ext->label_no_network, true);
+               lv_obj_set_hidden(ext->label_not_bind, false);
+               lv_obj_set_hidden(ext->label_no_msg, true);
+               lv_obj_set_hidden(ext->img_record, true);
+    }
        else
        {
-               lv_obj_set_hidden(ext->label_no_msg, true);
+               lv_obj_set_hidden(ext->label_no_network, true);
+               lv_obj_set_hidden(ext->label_not_bind, true);
+               lv_obj_set_hidden(ext->img_record, false);
                
-               wechat_chat_list_create(cont, ext);
+               uint8_t msg_count = wechat_msg_info_count_get();
+               if(0 == msg_count)
+               {
+                       lv_obj_set_hidden(ext->label_no_msg, false);
+               }
+               else
+               {
+                       lv_obj_set_hidden(ext->label_no_msg, true);
+                       
+                       wechat_chat_list_create(cont, ext);
+               }
        }
 
        //uint32_t fs_total = 0;
index 96c610e..2478dc5 100644 (file)
@@ -15,6 +15,7 @@ static uint8_t s_watch_location_state = 0; // 0-default; 1-locating
 static MMI_WATCH_LOCATION_STATE_E s_watch_location_gps_state = 0, s_watch_location_cell_state = 0, s_watch_location_wifi_state = 0;
 static MMI_WATCH_LOCATION_DATA_T s_watch_location_data = {0};
 static lv_ll_t s_watch_location_mission_ll = {0};
+static uint8_t s_watch_location_mission_ll_locked = 0;
 static void * s_watch_location_timer_id = NULL;
 static uint8_t s_watch_location_times_check_count = 0;
 
@@ -23,9 +24,11 @@ static void mmi_watch_location_mission_timer_cb(uint32_t para);
 
 void mmi_watch_location_mission_list_init(void)
 {
+       s_watch_location_mission_ll_locked = 0;
        _lv_ll_init(&s_watch_location_mission_ll, sizeof(MMI_WATCH_LOCATION_TYPE_E));
 }
 
+/*
 void mmi_watch_location_mission_list_node_remove(MMI_WATCH_LOCATION_TYPE_E location_type)
 {
        if(true == _lv_ll_is_empty(&s_watch_location_mission_ll))
@@ -45,27 +48,36 @@ void mmi_watch_location_mission_list_node_remove(MMI_WATCH_LOCATION_TYPE_E locat
         node = _lv_ll_get_prev(&s_watch_location_mission_ll, node);
     }
 }
+*/
 
-void mmi_watch_location_mission_list_node_add(MMI_WATCH_LOCATION_TYPE_E location_type)
+bool mmi_watch_location_mission_list_node_add(MMI_WATCH_LOCATION_TYPE_E location_type)
 {
+       if(1 == s_watch_location_mission_ll_locked)
+       {
+               LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: location ll locked\n", __FUNCTION__, __LINE__);
+               return false;
+       }
+       
     MMI_WATCH_LOCATION_TYPE_E * node = _lv_ll_get_head(&s_watch_location_mission_ll);
        
-       LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, (NULL != node) ? 1 : 0);
+       LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: location ll head=0x%x\n", __FUNCTION__, __LINE__, (NULL != node) ? node : 0);
        
     while(NULL != node)
        {
                if(location_type == * node)
                {
-                       LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-                       return ; // exist
+                       LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: location type exist\n", __FUNCTION__, __LINE__);
+                       return false;
                }
         node = _lv_ll_get_next(&s_watch_location_mission_ll, node);
     }
        
-       LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: location type add\n", __FUNCTION__, __LINE__);
        
        MMI_WATCH_LOCATION_TYPE_E * new_node = _lv_ll_ins_head(&s_watch_location_mission_ll);
        * new_node = location_type;
+
+       return true;
 }
 
 void mmi_watch_location_mission_list_data_send(void)
@@ -75,6 +87,7 @@ void mmi_watch_location_mission_list_data_send(void)
        if(true == _lv_ll_is_empty(&s_watch_location_mission_ll))
                return;
        
+       s_watch_location_mission_ll_locked = 1;
        MMI_WATCH_LOCATION_TYPE_E * node = _lv_ll_get_tail(&s_watch_location_mission_ll);
        
        LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
@@ -117,11 +130,10 @@ void mmi_watch_location_mission_list_data_send(void)
                                break;
                }
 
-               MMI_WATCH_LOCATION_TYPE_E * old_node = node;
-               node = _lv_ll_get_prev(&s_watch_location_mission_ll, node);
-               _lv_ll_remove(&s_watch_location_mission_ll, old_node);
-               lv_mem_free(old_node);
-               old_node = NULL;
+               MMI_WATCH_LOCATION_TYPE_E * pre_node = _lv_ll_get_prev(&s_watch_location_mission_ll, node);
+               _lv_ll_remove(&s_watch_location_mission_ll, node);
+               lv_mem_free(node);
+               node = pre_node;
        }
 }
 
@@ -321,6 +333,7 @@ void mmi_watch_location_mission_stop(void)
 {
        LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
        
+       s_watch_location_mission_ll_locked = 0;
        s_watch_location_state = 0;
        if(NULL != s_watch_location_timer_id)
        {
@@ -400,8 +413,11 @@ static void mmi_watch_location_mission_action(MMI_WATCH_LOCATION_TYPE_E location
                return;
        }
 
-       mmi_watch_location_mission_list_node_add(location_type);
-       mmi_watch_location_mission_start();
+       if(true == mmi_watch_location_mission_list_node_add(location_type))
+       {
+               LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               mmi_watch_location_mission_start();
+       }
 }
 
 void mmi_watch_location_mission_timed_location_action(void)