gengxin
authorCCC <2393524978@qq.com>
Wed, 6 Sep 2023 01:23:04 +0000 (09:23 +0800)
committerCCC <2393524978@qq.com>
Wed, 6 Sep 2023 01:23:04 +0000 (09:23 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/calculator/calculator.c
2.sdk/sdk/gui/lv_watch/lv_apps/mmi_wechat/wechat_ui.c
2.sdk/sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c
2.sdk/sdk/gui/lvgl/hal/hal.c

index d083eda..b887211 100644 (file)
@@ -27,6 +27,7 @@
 /**********************
  *  STATIC PROTOTYPES
  **********************/
+static void calc_get_result(char * fac1, char * fac2);
 static lv_obj_t * calc_create(lv_obj_t * activity_obj);
 
 /**********************
@@ -132,11 +133,58 @@ static void calc_warn_task(lv_task_t * task)
 static void calc_add_oper(char * ptr)
 {
     lv_calculator_obj_ext_t * ext = calc_get_ext();
+       printf("[@CHENG_DEBUG][%s][%d]: %s\n", __FUNCTION__, __LINE__, ext->oper);
     if(ext->oper) {
         if(ext->point == false && ext->input_len == 0) {
             calc_label_del_char(ext);
-        } else
+        } 
+               else
+       {
+                       printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               #ifdef __MMI_ZHSX_SUPPORT__
+                       char * fac1 = NULL;
+                       char * fac2 = NULL;
+                       char * temp = NULL;
+                       const char * text = lv_label_get_text(ext->label);
+                       uint8_t len = strlen(text);
+
+                       if(ext->oper && ((ext->point == true) || (ext->point == false && ext->input_len > 0)))
+                       {
+                               if(text[len - 1] == '.') {
+                                       calc_label_del_char(ext);
+                               }
+                               calc_label_add_text(ext, ptr);
+       
+                               text = lv_label_get_text(ext->label);
+                               temp = (char *)text;
+                               if(temp[0] == '-') {
+                                       temp = &temp[1];
+                               }
+                               char * sn = strchr(text, 'e');
+                               if(sn) {
+                                       temp = &sn[2];
+                               }
+                               strtok(temp, ext->oper);
+                               fac2 = strtok(NULL, ptr);
+                       #if CALC_LATIN_SYMBOL_MUL_AND_DIV_SUP != 0
+                               if(strcmp(ext->oper, CALC_MUL) == 0 || strcmp(ext->oper, CALC_DIV) == 0) {
+                                       fac2 = &fac2[1];
+                               }
+                       #endif
+                               fac1 = (char *)text;
+                               printf("[@CHENG_DEBUG][%s][%d]: fac1=%s,fac2=%s\n", __FUNCTION__, __LINE__, fac1, fac2);
+                               calc_get_result(fac1, fac2);
+
+                               ext->oper = ptr;
+                               calc_label_add_text(ext, ptr);
+                               ext->finish_flag = false;
+                               ext->input_len = 0;
+                               ext->point = false;
+                       }
+               #endif
+                       
             return;
+       }
     } else {
         if(ext->input_len == 0) {
             if(ext->point) {
@@ -150,6 +198,7 @@ static void calc_add_oper(char * ptr)
             }
         }
     }
+       printf("[@CHENG_DEBUG][%s][%d]: %s\n", __FUNCTION__, __LINE__, ext->oper);
 
     ext->oper = ptr;
     calc_label_add_text(ext, ptr);
index 55ab6e6..0260e1b 100644 (file)
@@ -91,6 +91,8 @@ 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)
@@ -105,7 +107,7 @@ void wechat_msg_info_all_item_delete(void)
        }
        s_wechat_msg_info->msg_count = 0;
 
-       //wechat_msg_info_nv_write();
+       wechat_msg_info_nv_write();
 }
 
 void wechat_msg_info_new_item_add(nv_watch_wechat_msg_item_info_t * msg_item)
@@ -131,6 +133,8 @@ 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)
@@ -1010,6 +1014,7 @@ void wechat_msg_recording_screen_prepare_destory(lv_obj_t * activity_obj)
 {
        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);
@@ -1017,6 +1022,7 @@ void wechat_msg_recording_screen_prepare_destory(lv_obj_t * activity_obj)
        {
                lv_obj_del(obj);
        }
+#endif
 }
 
 void wechat_msg_recording_screen_create(void)
@@ -1041,9 +1047,9 @@ void wechat_msg_recording_screen_create(void)
     lv_obj_set_size(cont, lv_obj_get_width(obj), lv_obj_get_height(obj));
     lv_obj_align(cont, obj, LV_ALIGN_CENTER, 0, 0);
     lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(194, 252, 252));
-    lv_obj_set_click(cont, true);
-    lv_obj_set_event_cb(cont, wechat_msg_recording_release_event_cb);  
-    lv_obj_add_protect(cont, LV_PROTECT_PRESS_LOST);
+    //lv_obj_set_click(cont, true);
+    //lv_obj_set_event_cb(cont, wechat_msg_recording_release_event_cb);        
+    //lv_obj_add_protect(cont, LV_PROTECT_PRESS_LOST);
 
     lv_obj_t * img = lv_img_create(cont, NULL);
     lv_img_set_src(img, ICON_WECHAT_RECORDING1);
@@ -2049,6 +2055,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_watch_obj_add_element(ext->img_record);
        lv_obj_align(ext->img_record, cont, LV_ALIGN_IN_BOTTOM_MID, 0, -8);
 
@@ -2074,42 +2081,12 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from)
 
 void wechat_create_event_cb(lv_obj_t * btn, lv_event_t e)
 {
-    (void)btn;
-    if(LV_EVENT_CLICKED == e) {
+    if(LV_EVENT_CLICKED == e) 
+       {
         lv_watch_png_cache_all_free();
         lv_obj_t * obj = wechat_create(NULL, WECHAT_CREATED_FROM_APP);
         LV_ASSERT_MEM(obj);
     }
 }
 
-#if 0
-void wechat_chat_list_empty_create(lv_obj_t * obj, lv_wechat_ext_t * ext)
-{
-       WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-       
-       //create no msg label
-       ext->label_no_msg = lv_label_create(obj, NULL);
-       lv_obj_add_style(ext->label_no_msg, LV_LABEL_PART_MAIN, &lv_watch_font30_black);
-       lv_label_set_text_id(ext->label_no_msg, WATCH_TEXT_ID_NO_VOICE_MSG);
-       lv_obj_align(ext->label_no_msg, obj, LV_ALIGN_CENTER, 0, -10);
-
-       ext->img_emo = lv_img_create(obj, NULL);
-       lv_img_set_src(ext->img_emo, ICON_SEND_EMO);
-       lv_obj_set_click(ext->img_emo, true);
-       //lv_obj_set_event_cb(ext->img_emo, wechat_chat_list_send_expression_event_cb);
-       lv_obj_set_adv_hittest(ext->img_emo, false);
-       lv_watch_obj_add_element(ext->img_emo);
-
-       ext->img_record = lv_img_create(obj, NULL);
-       lv_img_set_src(ext->img_record, ICON_WECHAT_RECORD_BUTTON);
-       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_watch_obj_add_element(ext->img_record);
-
-       lv_obj_align(ext->img_emo, obj, LV_ALIGN_IN_BOTTOM_LEFT, 14, -8);
-       lv_obj_align(ext->img_record, obj, LV_ALIGN_IN_BOTTOM_RIGHT, -14, -8);
-}
-#endif
-
 #endif
index 741f67c..ac47c2b 100644 (file)
@@ -399,6 +399,10 @@ static void phonebook_copy_contact(nv_watch_phonebook_info_t * dest, app_adaptor
 
 static char * phonebook_get_img_src(uint8_t portrait_id, uint8_t small_flg)
 {
+#ifdef __MMI_ZHSX_SUPPORT_PHONEBOOK_LIST_STYLE__
+       return NULL;
+
+#else
     switch(portrait_id) {
         case WATCH_PORTRAIT_ID_FATHER:
             if(small_flg) {
@@ -489,6 +493,7 @@ static char * phonebook_get_img_src(uint8_t portrait_id, uint8_t small_flg)
             break;
     }
     return NULL;
+#endif
 }
 
 static lv_phonebook_obj_ext_t * phonebook_get_ext(void)
index 0bac5c2..131bfbd 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