/**********************
* STATIC PROTOTYPES
**********************/
+static void calc_get_result(char * fac1, char * fac2);
static lv_obj_t * calc_create(lv_obj_t * activity_obj);
/**********************
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) {
}
}
}
+ printf("[@CHENG_DEBUG][%s][%d]: %s\n", __FUNCTION__, __LINE__, ext->oper);
ext->oper = ptr;
calc_label_add_text(ext, ptr);
}
}
s_wechat_msg_info->msg_count--;
+
+ wechat_msg_info_nv_write();
}
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)
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)
{
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);
{
lv_obj_del(obj);
}
+#endif
}
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);
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);
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