From: hcj <1224667075@qq.com> Date: Wed, 25 Sep 2024 14:03:34 +0000 (+0800) Subject: 适配通讯录人名长度修改 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a90a66871f840422cf45b80ac001415c41d4fe2c;p=mirrors%2FFD230.git 适配通讯录人名长度修改 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp index 55d105770..eb5a5ef4b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallerDisplayView.cpp @@ -121,7 +121,7 @@ bool CallerDisplayView::InitImageViewDisplay() imageperson->SetTouchable(true); imageperson->SetViewId("headset"); - char name_buf[30]={0}; + char name_buf[NAME_LEN+1]={0}; uint8_t sex; if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex)) { @@ -158,7 +158,7 @@ bool CallerDisplayView::InitUILabelDisplay() TITLE_LABEL_DEFAULT_HEIGHT); callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - char name_buf[30]={0}; + char name_buf[NAME_LEN+1]={0}; if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) { callerDisplay->SetText(name_buf); diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp index 6e89244c4..e354eabc3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/CallingView.cpp @@ -212,7 +212,7 @@ bool CallingView::InitImageViewDisplay() imageperson->SetViewId("headset"); group->Add(imageperson); - char name_buf[30]={0}; + char name_buf[NAME_LEN+1]={0}; uint8_t sex; if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex)) { @@ -245,7 +245,7 @@ bool CallingView::InitUILabelDisplay() 289, 40); callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - char name_buf[30]={0}; + char name_buf[NAME_LEN+1]={0}; if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) { callerDisplay->SetText(name_buf); diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/DialingScreenView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/DialingScreenView.cpp index f9b20d5db..1c11fc2eb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/DialingScreenView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/DialingScreenView.cpp @@ -77,7 +77,9 @@ bool DialingScreenView::InitUILabelDisplay() dialingId->SetPosition(LABEL_ADRESS_POSITION_X, LABEL_ADRESS_POSITION_Y, VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT); dialingId->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + dialingId->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + dialingId->SetAlign(TEXT_ALIGNMENT_CENTER); dialingId->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_AIALING_SIZE); dialingId->SetTextColor(Color::White()); diff --git a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp index a8d08adaa..d6f8faaa3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/makephone/src/WaitingHintsView.cpp @@ -163,7 +163,7 @@ bool WaitingHintsView::InitImageViewDisplay() imageperson->SetTouchable(true); imageperson->SetViewId("headset"); - char name_buf[30]={0}; + char name_buf[NAME_LEN+1]={0}; uint8_t sex; if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),&sex)) { @@ -188,7 +188,7 @@ bool WaitingHintsView::InitUILabelDisplay() TITLE_LABEL_DEFAULT_HEIGHT); callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - char name_buf[30]={0}; + char name_buf[NAME_LEN+1]={0}; if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) { callerDisplay->SetText(name_buf); diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp index eb3cc077c..383d136ec 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp @@ -54,8 +54,9 @@ namespace OHOS button->SetText(buttonconfig.str); button->SetAlign(TEXT_ALIGNMENT_LEFT); - button->SetLabelPosition(50,-23); - button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); + button->SetLabelPosition(50,30); + button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 23); + button->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); button->SetStyleForState(STYLE_BACKGROUND_COLOR,0xff191919, UIButton::PRESSED); return button; @@ -278,13 +279,15 @@ namespace OHOS void MainPhoneView:: NewcalllogButtonExtupdata(CallLogInfo *data, uint8_t index,uint8_t i) { + return; + if(index==0) { //SwipeViewItem[i][0] char *txt; char buf[20]={0}; sprintf_s(buf,20,"%s",(const char*)(data)->tel); - char name[64]={0}; + char name[NAME_LEN+1]={0}; if(get_phone_addrss_name(name,buf,NULL)) { txt=name; @@ -362,16 +365,17 @@ namespace OHOS buttonconfig.h = 104; buttonconfig.ViewId="xxxx"; - char buf[20]={0}; - sprintf_s(buf,20,"%s",(const char*)(data)->tel); - char name[64]={0}; - if(get_phone_addrss_name(name,buf,NULL)) - { - buttonconfig.str=name; - }else - { - buttonconfig.str=buf; - } + + time_t currtime; + struct tm *timeinfo; + currtime=(data)->creationTime; + timeinfo = localtime(&currtime); + char time_buf[20]={0}; + + + sprintf_s(time_buf,20 ,"%d-%d-%d %d:%02d", timeinfo->tm_year + 1900,timeinfo->tm_mon + 1,timeinfo->tm_mday,timeinfo->tm_hour,timeinfo->tm_min); + buttonconfig.str=time_buf; + buttonconfig.ViewId=(const char*)(data)->tel; button_calllog[i]=SetTheButton_ext(buttonconfig,ButtonOnclickListen); if(button_calllog[i]==nullptr) @@ -381,30 +385,32 @@ namespace OHOS TempGroup_->Add(button_calllog[i]); + + + TelephonyInitInterface::LabelParams labelParam = { - .x = 50, - .y = 60, - .width = 160, - .height = 35, - .fontSize = 23, + .x = 49, + .y = 19, + .width = 280, + .height = 41, + .fontSize = 35, .lineHeigh = 0, - .text = "2023-1-23 14:22", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .text = "xxx", + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; - time_t currtime; - struct tm *timeinfo; - currtime=(data)->creationTime; - timeinfo = localtime(&currtime); - char time_buf[20]={0}; - - labelParam.x=50, - labelParam.text=time_buf; - labelParam.fontSize = 23; - sprintf_s(time_buf,20 ,"%d-%d-%d %d:%02d", timeinfo->tm_year + 1900,timeinfo->tm_mon + 1,timeinfo->tm_mday,timeinfo->tm_hour,timeinfo->tm_min); - - - button_calllog_time[i] = TelephonyInitInterface::LabelViewInit(labelParam,Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); + char buf[20]={0}; + sprintf_s(buf,20,"%s",(const char*)(data)->tel); + char name[NAME_LEN+1]={0}; + if(get_phone_addrss_name(name,buf,NULL)) + { + labelParam.text=name; + } + else + { + labelParam.text=buf; + } + button_calllog_time[i] = TelephonyInitInterface::LabelViewInit(labelParam,Color::GetColorFromRGBA(0xEE, 0xEE, 0xEE, 0xEE)); if (button_calllog_time[i] == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!"); @@ -413,6 +419,7 @@ namespace OHOS labelParam.fontSize=18; labelParam.x=223+30; + labelParam.y=60; labelParam.lineBreakMode=UILabel::LINE_BREAK_MARQUEE; labelParam.width=72; labelParam.height=21; diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp index f8c00f864..756ca2279 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/TelephonyInitInterface.cpp @@ -69,7 +69,7 @@ namespace OHOS label->SetText(params.text); // 内容 label->SetTextColor(color); label->SetLineBreakMode(params.lineBreakMode); // 断行模式 - // label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); // 设置此文本的对齐模式 + label->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); // 设置此文本的对齐模式 label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, params.fontSize); // 设置标签的字体 return label; diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp index 7d38343aa..e63161b7a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp @@ -174,7 +174,7 @@ namespace OHOS //if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[0].number)==0) if(addrss_strcmp((char *)phone,addressbook_t.Contact_t[i].phone_number_t[0].number)) { - strcpy(name,addressbook_t.Contact_t[i].name); + strcpy_s(name,NAME_LEN+1,addressbook_t.Contact_t[i].name); if(sex!=NULL) *sex=addressbook_t.Contact_t[i].sex; return true; @@ -184,14 +184,14 @@ namespace OHOS //if(strcmp(phone,addressbook_t.Contact_t[i].phone_number_t[1].number)==0) if(addrss_strcmp((char *)phone,addressbook_t.Contact_t[i].phone_number_t[1].number)) { - strcpy(name,addressbook_t.Contact_t[i].name); + strcpy_s(name,NAME_LEN+1,addressbook_t.Contact_t[i].name); if(sex!=NULL) *sex=addressbook_t.Contact_t[i].sex; return true; } } } - strcpy(name,"未知"); + strcpy_s(name,NAME_LEN+1,"未知"); return false; } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index 3d9b07b73..66ba68590 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -1145,7 +1145,7 @@ static bool DrawPhoneCallViewLabel(void) // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "CreatePhoneCallView phonenum:%s!", // CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); const char *number=CallerLogModel::GetInstance()->GetPhoneNumber().c_str(); - char name[32]={0}; + char name[NAME_LEN+1]={0}; #ifdef FD230 get_phone_addrss_name(name,number,NULL); #endif @@ -1293,7 +1293,7 @@ UIViewGroup* CreateCalldialView(void) Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); diallabl2->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - char name_buf[30]={0}; + char name_buf[NAME_LEN+1]={0}; if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),NULL)) {