From 68924ced87f450f54489652e5d85f3e309335960 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Mon, 26 Aug 2024 11:43:49 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E5=9B=BD=E8=AF=AD?= =?utf8?q?=E8=A8=80=E7=94=B5=E8=AF=9DUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../phone/include/DialingMethodView.h | 8 +- .../nativeui/phone/include/PhoneDirView.h | 8 +- .../nativeui/phone/src/DialingMethodView.cpp | 152 +++++++++++++++--- .../nativeui/phone/src/MainPhoneView.cpp | 30 ++-- .../nativeui/phone/src/PhoneDirView.cpp | 68 ++++---- 5 files changed, 203 insertions(+), 63 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/DialingMethodView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/DialingMethodView.h index af53ff237..68dd4f260 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/include/DialingMethodView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/include/DialingMethodView.h @@ -64,7 +64,13 @@ namespace OHOS UIScrollView *OPEN_HFP_ScrollView{nullptr}; UILabelExt *OPEN_HFP_TITLE_Label{nullptr}; - UILabelExt *OPEN_HFP_Label{nullptr}; + + UILabelExt *IPoneLabel{nullptr}; + UILabelExt *AndroidLabel{nullptr}; + UILabelExt *BTNoteLabel1{nullptr}; + UILabelExt *BTNoteLabel2{nullptr}; + UILabelExt *BTNoteLabel3{nullptr}; + UILabelExt *OPEN_HFP_button_Label{nullptr}; UIButton *OPEN_HFP_Button{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirView.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirView.h index d4b589a9b..ee2ba9a00 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneDirView.h @@ -67,14 +67,14 @@ namespace OHOS PhoneDirView &operator=(PhoneDirView &&) = delete; UILabelButtonExt *button[20]={NULL}; UILabelButtonExt *number_button[2]={NULL}; - UILabel * label1_phone_name=nullptr; + UILabelExt * label1_phone_name=nullptr; UIImageView *phone_name=nullptr; - UILabel *label1_ =nullptr; + UILabelExt *label1_ =nullptr; UIScrollView *container_ =nullptr; UIScrollView *container_one_page=nullptr; - UILabel *label1_no =nullptr; - UILabel *label2_no=nullptr; + UILabelExt *label1_no =nullptr; + UILabelExt *label2_no=nullptr; UIImageView *image1_no=nullptr; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodView.cpp index 1d9935aee..ca2a58c61 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodView.cpp @@ -10,6 +10,7 @@ #include "wearable_log.h" #include "phone/include/TelephonyInitInterface.h" #include "UiConfig.h" +#include "ui_resource_string.h" namespace OHOS { @@ -109,8 +110,31 @@ namespace OHOS delete OPEN_HFP_TITLE_Label; OPEN_HFP_TITLE_Label = nullptr; - delete OPEN_HFP_Label; - OPEN_HFP_Label = nullptr; + if (IPoneLabel != nullptr) + { + delete IPoneLabel; + IPoneLabel = nullptr; + } + if (AndroidLabel != nullptr) + { + delete AndroidLabel; + AndroidLabel = nullptr; + } + if (BTNoteLabel1 != nullptr) + { + delete BTNoteLabel1; + BTNoteLabel1 = nullptr; + } + if (BTNoteLabel2 != nullptr) + { + delete BTNoteLabel2; + BTNoteLabel2 = nullptr; + } + if (BTNoteLabel3 != nullptr) + { + delete BTNoteLabel3; + BTNoteLabel3 = nullptr; + } delete OPEN_HFP_button_Label; OPEN_HFP_button_Label = nullptr; @@ -165,6 +189,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; No_HFP_TITLE_Label = TelephonyInitInterface::LabelViewInit(labelParam); + No_HFP_TITLE_Label->SetTextId(STR_CONNECTION_ERROR); if (No_HFP_TITLE_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -184,6 +209,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; No_HFP_Label = TelephonyInitInterface::LabelViewInit(labelParam); + No_HFP_Label->SetTextId(STR_INSERT_WATCH_SIM_OR_CONNECT_PHONE); if (No_HFP_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -205,6 +231,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; No_HFP_button_Label = TelephonyInitInterface::LabelViewInit(labelParam); + No_HFP_button_Label->SetTextId(STR_KONW); if (No_HFP_button_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -305,6 +332,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; NO_SIM_TITLE_Label = TelephonyInitInterface::LabelViewInit(labelParam); + NO_SIM_TITLE_Label->SetTextId(STR_SIM_CARD_ERROR); if (NO_SIM_TITLE_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -324,6 +352,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; NO_SIM_Label = TelephonyInitInterface::LabelViewInit(labelParam); + NO_SIM_Label->SetTextId(STR_CHECK_SIM_CARD_INSERTION); if (NO_SIM_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -343,6 +372,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; NO_SIM_button_Label = TelephonyInitInterface::LabelViewInit(labelParam); + NO_SIM_button_Label->SetTextId(STR_KONW); if (NO_SIM_button_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -441,6 +471,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; OPEN_HFP_TITLE_Label = TelephonyInitInterface::LabelViewInit(labelParam); + OPEN_HFP_TITLE_Label->SetTextId(STR_ENABLE_BLUETOOTH_CALL); if (OPEN_HFP_TITLE_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -449,24 +480,86 @@ namespace OHOS OPEN_HFP_TITLE_Label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - labelParam = { - .x = 53, - .y = 105, - .width = 360, - .height = 466, - .fontSize = 30, - .lineHeigh = 35, - .text = - "解决方法:\n1.苹果手机\n请前往手机“设置”→“蓝牙”列表找到\n“KUMI_XXXX”\n并点击后重试\n\n2.安卓手机\n请前往手机“设置”→“蓝牙”列表找到\n“KUMI_XXXX”\n点击右侧图标进入蓝牙设置\n开启通话及媒体功能后重试", - .lineBreakMode = UILabel::LINE_BREAK_WRAP, - }; - OPEN_HFP_Label = TelephonyInitInterface::LabelViewInit(labelParam); - if (OPEN_HFP_Label == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); - return; - } - OPEN_HFP_Label->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); + if (BTNoteLabel1 == nullptr) + { + BTNoteLabel1 = new UILabelExt(); + if (BTNoteLabel1 == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BTNoteLabel1 new fail"); + return ; + } + } + BTNoteLabel1->SetPosition(53, 140, 360, 35); + BTNoteLabel1->SetStyle(STYLE_TEXT_FONT, 30); + BTNoteLabel1->SetStyle(STYLE_LINE_HEIGHT, 35); + BTNoteLabel1->SetTextId(STR_SOLUTION); + BTNoteLabel1->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + BTNoteLabel1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ------------------------------- IPoneLabel ------------------------------- */ + if (IPoneLabel == nullptr) + { + IPoneLabel = new UILabelExt(); + if (IPoneLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IPoneLabel new fail"); + return ; + } + } + IPoneLabel->SetPosition(53, BTNoteLabel1->GetY() + BTNoteLabel1->GetTextHeight(), 360, 35); + IPoneLabel->SetStyle(STYLE_TEXT_FONT, 30); + IPoneLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + IPoneLabel->SetTextId(STR_IPHONE); + IPoneLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + IPoneLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ------------------------------ BTNoteLabel2 ------------------------------ */ + if (BTNoteLabel2 == nullptr) + { + BTNoteLabel2 = new UILabelExt(); + if (BTNoteLabel2 == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BTNoteLabel2 new fail"); + return ; + } + } + BTNoteLabel2->SetPosition(53, IPoneLabel->GetY() + IPoneLabel->GetTextHeight(), 360, 455); + BTNoteLabel2->SetStyle(STYLE_TEXT_FONT, 30); + BTNoteLabel2->SetStyle(STYLE_LINE_HEIGHT, 35); + BTNoteLabel2->SetTextId(STR_ENABLE_BLUETOOTH_CALL_NOTE_IPHONE); + BTNoteLabel2->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + BTNoteLabel2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ------------------------------- AndroidLabel ------------------------------- */ + if (AndroidLabel == nullptr) + { + AndroidLabel = new UILabelExt(); + if (AndroidLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AndroidLabel new fail"); + return ; + } + } + AndroidLabel->SetPosition(53, BTNoteLabel2->GetY() + BTNoteLabel2->GetTextHeight() + 40, 360, 35); + AndroidLabel->SetStyle(STYLE_TEXT_FONT, 30); + AndroidLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + AndroidLabel->SetTextId(STR_IPHONE); + AndroidLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + AndroidLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ------------------------------ BTNoteLabel3 ------------------------------ */ + if (BTNoteLabel3 == nullptr) + { + BTNoteLabel3 = new UILabelExt(); + if (BTNoteLabel3 == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BTNoteLabel2 new fail"); + return ; + } + } + BTNoteLabel3->SetPosition(53, AndroidLabel->GetY() + AndroidLabel->GetTextHeight(), 360, 455); + BTNoteLabel3->SetStyle(STYLE_TEXT_FONT, 30); + BTNoteLabel3->SetStyle(STYLE_LINE_HEIGHT, 35); + BTNoteLabel3->SetTextId(STR_ENABLE_BLUETOOTH_CALL_NOTE_ANDROID); + BTNoteLabel3->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + BTNoteLabel3->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + labelParam = { @@ -479,7 +572,11 @@ namespace OHOS .text = "关闭", .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; + //STR_CLOSE + OPEN_HFP_button_Label = TelephonyInitInterface::LabelViewInit(labelParam); + OPEN_HFP_button_Label->SetPosition(83, BTNoteLabel3->GetY() + BTNoteLabel3->GetTextHeight() + 40 + 29, 300, 35); + OPEN_HFP_button_Label->SetTextId(STR_CLOSE); if (OPEN_HFP_button_Label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -500,6 +597,7 @@ namespace OHOS .pressedBackgroundColor = 0xff1996ff, }; OPEN_HFP_Button = TelephonyInitInterface::ButtonViewInit(buttonParam); + OPEN_HFP_Button->SetPosition(43, BTNoteLabel3->GetY() + BTNoteLabel3->GetTextHeight() + 40, 380, 100); if (OPEN_HFP_Button == nullptr) { @@ -517,10 +615,16 @@ namespace OHOS OPEN_HFP_Button->SetOnClickListener(ButtonOnclickListen); OPEN_HFP_ScrollView->Add(OPEN_HFP_TITLE_Label); - OPEN_HFP_ScrollView->Add(OPEN_HFP_Label); + OPEN_HFP_ScrollView->Add(OPEN_HFP_Button); OPEN_HFP_ScrollView->Add(OPEN_HFP_button_Label); - + + OPEN_HFP_ScrollView->Add(BTNoteLabel1); + OPEN_HFP_ScrollView->Add(IPoneLabel); + OPEN_HFP_ScrollView->Add(AndroidLabel); + OPEN_HFP_ScrollView->Add(BTNoteLabel2); + OPEN_HFP_ScrollView->Add(BTNoteLabel3); + OPEN_HFP_ScrollView->SetVisible(false); @@ -607,6 +711,8 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; DialingMethodTitleLabel = TelephonyInitInterface::LabelViewInit(labelParam); + //STR_DIAL_MODE + DialingMethodTitleLabel->SetTextId(STR_DIAL_MODE); if (DialingMethodTitleLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::DialingMethodTitleLabel new fail!"); @@ -666,6 +772,7 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; UsingWatchSimLabel = TelephonyInitInterface::LabelViewInit(labelParam); + UsingWatchSimLabel->SetTextId(STR_DIAL_VIA_WATCH_SIM); if (UsingWatchSimLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::UsingWatchSimLabel new fail!"); @@ -690,6 +797,7 @@ namespace OHOS return; } UsingPhoneLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + UsingPhoneLabel->SetTextId(STR_DIAL_VIA_PHONE); } 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 d02fa0629..691f5a2d8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhoneView.cpp @@ -10,6 +10,7 @@ #include "components/ui_label_button_ext.h" #include "phone/include/phoneaddressmodel.h" #include "wearable_log.h" +#include "ui_resource_string.h" namespace OHOS { @@ -170,6 +171,8 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; MainPhoneViewTitleLabel = TelephonyInitInterface::LabelViewInit(labelParam); + MainPhoneViewTitleLabel->SetTextId(STR_TELEPHONE); + //MainPhoneViewTitleLabel->SetText("通话"); if (MainPhoneViewTitleLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!"); @@ -226,6 +229,8 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; RecentCallLabel = TelephonyInitInterface::LabelViewInit(labelParam); + RecentCallLabel->SetTextId(STR_RECENT_CALLS); + // STR_RECENT_CALLS if (RecentCallLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::RecentCallLabel new fail!"); @@ -337,29 +342,34 @@ namespace OHOS ColorType color; + + + + button_calllog_status[i] = TelephonyInitInterface::LabelViewInit(labelParam,color); + if (button_calllog_status[i] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!"); + } + if((info + i - 1)->status==CALL_MISSED) { labelParam.text="未接来电"; + button_calllog_status[i]->SetTextId(STR_MISSED_CALLS); color=Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff); } else if((info + i - 1)->status==CALL_INCOMING) { labelParam.text="拨入电话"; + button_calllog_status[i]->SetTextId(STR_RECEIVED_CALLS); color=Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff); } - else if((info + i - 1)->status==CALL_OUTGOING) + else //if((info + i - 1)->status==CALL_OUTGOING) { labelParam.text="拨出电话"; + button_calllog_status[i]->SetTextId(STR_DIALED_CALLS); color=Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff); } - - - button_calllog_status[i] = TelephonyInitInterface::LabelViewInit(labelParam,color); - if (button_calllog_status[i] == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!"); - } - MainPhoneViewScrollView->Add(button_calllog_status[i]); + MainPhoneViewScrollView->Add(button_calllog_status[i]); labelParam.y += 20+104; } @@ -378,6 +388,7 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPhoneView::MainPhoneViewTitleLabel new fail!"); } + hintCallsLabel->SetTextId(STR_NOTE_RECENT_CALLS_LIMITATION); MainPhoneViewScrollView->Add(hintCallsLabel); } @@ -401,6 +412,7 @@ namespace OHOS } NoCallsLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); NoCallsLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + NoCallsLabel->SetTextId(STR_NO_CALLS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp index 3d338ee3a..b170de595 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirView.cpp @@ -1,6 +1,7 @@ #include "phone/include/PhoneDirView.h" +#include "ui_resource_string.h" #include "phone/include/phoneaddressmodel.h" #define PHONE_DIR_GIRL "/user/res/Phone/little-girl.bin" @@ -103,7 +104,7 @@ namespace OHOS // Add Label to App if (label1_phone_name == nullptr) { - label1_phone_name = new UILabel(); + label1_phone_name = new UILabelExt(); } label1_phone_name->SetPosition(0, 53); // widget's left position and top position label1_phone_name->Resize(466, 55); // widget's width and height @@ -217,8 +218,6 @@ namespace OHOS } RootView::GetInstance()->Invalidate(); return; - - } @@ -230,35 +229,39 @@ namespace OHOS container_->RemoveAll(); delete container_; container_ = nullptr; - if(label1_no==NULL) + + if(label1_) { - if(label1_) + delete label1_; + label1_ = nullptr; + } + for(int i=0;iRemoveAll(); delete container_one_page; container_one_page = nullptr; + if(phone_name) { delete phone_name; phone_name = nullptr; } + if(label1_phone_name) { delete label1_phone_name; label1_phone_name = nullptr; } + for(int i=0;i<2;i++) { if( number_button[i]) @@ -267,26 +270,33 @@ namespace OHOS number_button[i] = nullptr; } } - write_addressbook_bin_flle(); + } - else + + if(label1_no) { delete label1_no; label1_no=nullptr; + } + if(label2_no) + { delete label2_no; label2_no=nullptr; + } + if(image1_no) + { delete image1_no; image1_no=nullptr; - } } - } + + UIView *PhoneDirView::GetView() { if (label1_no == nullptr) { - label1_no = new UILabel(); + label1_no = new UILabelExt(); } label1_no->SetPosition(158, 52); // widget's left position and top position label1_no->Resize(200, 60); // widget's width and height @@ -295,10 +305,12 @@ namespace OHOS // Set additional property label1_no->SetText("常用联系人"); - label1_no->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + label1_no->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); label1_no->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label1_no->SetRollSpeed(0); label1_no->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + label1_no->SetTextId(STR_FAVORITE_CONTACTS); + label1_no->SetTextId(STR_FAVORITE_CONTACTS); // Add to scrollView1 container_->Add(label1_no); @@ -307,15 +319,16 @@ namespace OHOS // Add Label to App if (label2_no == nullptr) { - label2_no = new UILabel(); + label2_no = new UILabelExt(); } - label2_no->SetPosition(53, 310); // widget's left position and top position - label2_no->Resize(360, 70); // widget's width and height + label2_no->SetPosition(76, 310); // widget's left position and top position + label2_no->Resize(312, 70); // widget's width and height label2_no->SetViewId("label2"); // Set style label2_no->SetStyle(STYLE_TEXT_FONT, 26); // Set additional property - label2_no->SetText("未添加联系人,请前往\nAPP进行设置"); + label2_no->SetText("未添加联系人,请前往APP进行设置"); + label2_no->SetTextId(STR_NO_CONTACTS_ADDED); label2_no->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); label2_no->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); label2_no->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); @@ -375,7 +388,7 @@ namespace OHOS if (label1_ == nullptr) { - label1_ = new UILabel(); + label1_ = new UILabelExt(); } label1_->SetPosition(0, 18); // widget's left position and top position label1_->Resize(466, 88); // widget's width and height @@ -383,7 +396,8 @@ namespace OHOS label1_->SetStyle(STYLE_TEXT_FONT, 30); label1_->SetText("常用联系人"); - label1_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + label1_->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + label1_->SetTextId(STR_FAVORITE_CONTACTS); //label1_->SetTextColor(Color::GetColorFromRGBA(0xac, 0xa4, 0xa4, 0xff)); label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label1_->SetRollSpeed(0); -- 2.17.1