From: hcj <1224667075@qq.com> Date: Mon, 22 Jul 2024 03:47:28 +0000 (+0800) Subject: 电话增加特殊符号* + # X-Git-Tag: release_V1.2.70_20241020_135402~745^2~18 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=01d170596295193b6303813c21e056f3bc83ad84;p=mirrors%2FFD230.git 电话增加特殊符号* + # --- diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index d7829cc96..e7edc78eb 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -649,9 +649,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/sleep/src/SleepControlPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/sleep/src/SleepModel.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhonePresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneDirView.cpp diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h index 212e3ee39..57b8cf404 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h @@ -100,7 +100,7 @@ namespace OHOS void InitFastTrainingSlice(void); void InitFastTrainingAttentionSlice(void); /* -------------------------------------------------------------------------- */ - void InitPhoneSlice(void); + // void InitPhoneSlice(void); void InitPhoneCallSlice(void); void InitPhoneDirSlice(void); void InitPhoneCallingSlice(void); diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 2da956644..373a5d552 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -128,8 +128,8 @@ #include "ConfigModel.h" #include "rebootdevice/include/RebootModel.h" -#include "phone/include/PhoneView.h" -#include "phone/include/PhonePresenter.h" +//#include "phone/include/PhoneView.h" +//#include "phone/include/PhonePresenter.h" #include "phone/include/PhoneCallView.h" #include "phone/include/PhoneCallPresenter.h" #include "phone/include/PhoneDirView.h" @@ -315,7 +315,7 @@ namespace OHOS {VIEW_ROTATE, &NativeLauncher::InitRotateSlice}, // {VIEW_DIALUPDATE, &NativeLauncher::InitDialUpdateSlice}, - {VIEW_PHONE, &NativeLauncher::InitPhoneSlice}, // 电话 + //{VIEW_PHONE, &NativeLauncher::InitPhoneSlice}, // 电话 {VIEW_PHONECALL, &NativeLauncher::InitPhoneCallSlice}, {VIEW_PHONEDIR, &NativeLauncher::InitPhoneDirSlice}, {VIEW_PHONECALLING, &NativeLauncher::InitPhoneCallingSlice}, @@ -392,7 +392,7 @@ namespace OHOS {VIEW_BLOODOXY, "bloodOxygenView"}, {VIEW_COMPASS, "mainCompassView"}, {VIEW_CONNECT_PHONE, "ConnectPhoneView"}, - {VIEW_PHONE, "phoneview"}, + //{VIEW_PHONE, "phoneview"}, {VIEW_INDOORWALK, "IndoorWalkView"}, {VIEW_SHUTDOWN_OR_REBOOT, "RebootView"}, {VIEW_TEST, "testView"}}; @@ -878,17 +878,17 @@ namespace OHOS NativeAbility::GetInstance().AddSliceProxy(VIEW_RECORD, record); } - void NativeLauncher::InitPhoneSlice(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneSlice"); - SliceProxy *phoneview = new AbilitySliceProxy; - if (phoneview == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneview"); - return; - } - NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONE, phoneview); - } + // void NativeLauncher::InitPhoneSlice(void) + // { + // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitPhoneSlice"); + // SliceProxy *phoneview = new AbilitySliceProxy; + // if (phoneview == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneview"); + // return; + // } + // NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONE, phoneview); + // } void NativeLauncher::InitPhoneCallSlice(void) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallPresenter.h index 6f995e328..d51b5a67d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/include/PhoneCallPresenter.h @@ -12,6 +12,7 @@ namespace OHOS class PhoneCallPresenter : public Presenter, public UIView::OnClickListener, public RootView::OnKeyActListener, + public UIView::OnLongPressListener, public UIView::OnDragListener { @@ -32,6 +33,7 @@ namespace OHOS // 声明一个字符串变量用于存储用户输入的号码 // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; + bool OnLongPress(UIView& view, const LongPressEvent& event) override; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp index 572bc5957..93328c05b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp @@ -60,16 +60,7 @@ namespace OHOS bool PhoneCallPresenter::OnDrag(UIView &view, const DragEvent &event) { - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && - (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) - { - if(strcmp( view.GetViewId(), "button_4G_and_BT") == 0) - { - PhoneCallView::GetInstance()->container_child_SetVisible(false); - return true; - } - - } + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) { @@ -89,22 +80,46 @@ namespace OHOS UNUSED(view); return true; } - bool PhoneCallPresenter::OnClick(UIView &view, const ClickEvent &event) - { - // 获取控件id - const char *viewId = view.GetViewId(); - if (strcmp(viewId, "button_4G") == 0) + bool PhoneCallPresenter::OnLongPress(UIView& view, const LongPressEvent& event) + { + const char *viewId = view.GetViewId(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnLongPress"); + if (strcmp(viewId, BUTTON7) == 0) { - // 拨号键 - //NativeAbility::GetInstance().ChangeSlice(VIEW_PHONERING); - calldial_event_sendmsg_toUI((char *)phoneNumber.c_str()); + // 点击7键,将字符'7'追加到号码字符串中 + phoneNumber += "*"; } - else if (strcmp(viewId, "button_BT") == 0) + if (strcmp(viewId, BUTTON9) == 0) { - - DialCall((unsigned char *)phoneNumber.c_str(),phoneNumber.length()); + // 点击7键,将字符'7'追加到号码字符串中 + phoneNumber += "#"; } + if (strcmp(viewId, BUTTON0) == 0) + { + // 点击7键,将字符'7'追加到号码字符串中 + phoneNumber += "+"; + } + printf("**************************\n"); + printf("per phoneNumber: %s\n", phoneNumber.c_str()); + + PhoneCallView::GetInstance()->ReLabel(); + + // view.Invalidate(); + // RootView::GetInstance()->Invalidate(); + + printf("now phoneNumber: %s\n", phoneNumber.c_str()); + printf("**************************\n"); + + + return true; + } + + bool PhoneCallPresenter::OnClick(UIView &view, const ClickEvent &event) + { + // 获取控件id + const char *viewId = view.GetViewId(); + // 根据控件id处理点击事件 if (strcmp(viewId, BUTTONCALL) == 0) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallView.cpp index 496d085d4..331f000df 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallView.cpp @@ -49,15 +49,19 @@ namespace OHOS button->SetPosition(leftPos, topPos); button->Resize(width, height); button->SetViewId(buttonNumber); - button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); + button->SetStyle(STYLE_BORDER_COLOR, 0xff191919); // Set additional properties button->SetImageSrc(defaultImgSrc, triggeredImgSrc); - button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - + button->SetStyleForState(STYLE_BORDER_COLOR, 0xff191919, UIButton::PRESSED); + button->SetStyleForState(STYLE_BORDER_WIDTH, 0, UIButton::PRESSED); + button->SetStyleForState(STYLE_BORDER_COLOR, 0xff191919, UIButton::PRESSED); // Add the callback for events UIView::OnClickListener *buttonClick = static_cast(PhoneCallPresenter::GetInstance()); button->SetOnClickListener(buttonClick); + UIView::OnLongPressListener*buttonlongpress=static_cast(PhoneCallPresenter::GetInstance()); + button->SetOnLongPressListener(buttonlongpress); // Add to rootView container_->Add(button); @@ -66,100 +70,7 @@ namespace OHOS } - void PhoneCallView ::container_child_init() - { - if (container_child == nullptr) - { - container_child = new UIViewGroup(); - container_child->SetPosition(0, 0, 466, 466); - //container_child->SetStyle(STYLE_BACKGROUND_OPA, 0); - } - container_child->SetViewId("button_4G_and_BT"); - //button_4G = params.button; - if (button_4G == nullptr) - { - button_4G = new UIButton(); - } - button_4G->SetPosition(73, 144); - button_4G->Resize(140, 188); - button_4G->SetViewId("button_4G"); - button_4G->SetStyle(STYLE_BACKGROUND_COLOR, 0xff14ff00); - button_4G->SetStyle(STYLE_BORDER_RADIUS, 50); - // Set additional properties - //button->SetImageSrc(defaultImgSrc, triggeredImgSrc); - button_4G->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - button_4G->SetStyleForState(STYLE_BORDER_RADIUS,50,UIButton::PRESSED); - // Add the callback for events - UIView::OnClickListener *buttonClick = static_cast(PhoneCallPresenter::GetInstance()); - button_4G->SetOnClickListener(buttonClick); - - // Add to rootView - container_child->Add(button_4G); - - if (button_BT == nullptr) - { - button_BT = new UIButton(); - } - button_BT->SetPosition(263, 144); - button_BT->Resize(140, 188); - button_BT->SetViewId("button_BT"); - button_BT->SetStyle(STYLE_BACKGROUND_COLOR, 0xff0092ff); - button_BT->SetStyle(STYLE_BORDER_RADIUS, 50); - // Set additional properties - //button->SetImageSrc(defaultImgSrc, triggeredImgSrc); - button_BT->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - button_BT->SetStyleForState(STYLE_BORDER_RADIUS,50,UIButton::PRESSED); - // Add the callback for events - //UIView::OnClickListener *buttonClick = static_cast(PhoneCallPresenter::GetInstance()); - button_BT->SetOnClickListener(buttonClick); - - // Add to rootView - container_child->Add(button_BT); - - if (label_4G == nullptr) - { - label_4G = new UILabel(); - } - label_4G->SetPosition(112, 211); // widget's left position and top position - label_4G->Resize(236, 47); // widget's width and height - label_4G->SetViewId("label1"); // Set style - label_4G->SetStyle(STYLE_TEXT_FONT, 40); - - // Set additional property - - label_4G->SetText("4G"); - //printf("view phoneNumber: %s\n", PhoneCallPresenter::GetInstance()->phoneNumber.c_str()); - label_4G->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label_4G->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label_4G->SetRollSpeed(0); - label_4G->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); - container_child->Add(label_4G); - - if (label_BT == nullptr) - { - label_BT = new UILabel(); - } - label_BT->SetPosition(302, 211); // widget's left position and top position - label_BT->Resize(236, 47); // widget's width and height - label_BT->SetViewId("label2"); // Set style - label_BT->SetStyle(STYLE_TEXT_FONT, 40); - - // Set additional property - - label_BT->SetText("BT"); - //printf("view phoneNumber: %s\n", PhoneCallPresenter::GetInstance()->phoneNumber.c_str()); - label_BT->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label_BT->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label_BT->SetRollSpeed(0); - label_BT->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); - container_child->Add(label_BT); - - - container_child->SetVisible(false); - - - } void PhoneCallView::container_child_SetVisible(bool falg) { @@ -197,26 +108,24 @@ namespace OHOS container_->Add(label_); label_->SetVisible(true); ButtonInitParams buttonParams[] = { - {button1_, BUTTON1, 68, 104, 104, 70, button1Path, nullptr}, - {button2_, BUTTON2, 181, 104, 104, 70, button2Path, nullptr}, - {button3_, BUTTON3, 293, 104, 104, 70, button3Path, nullptr}, - {button4_, BUTTON4, 69, 182, 104, 70, button4Path, nullptr}, - {button5_, BUTTON5, 182, 182, 104, 70, button5Path, nullptr}, - {button6_, BUTTON6, 293, 182, 104, 70, button6Path, nullptr}, - {button7_, BUTTON7, 69, 260, 104, 70, button7Path, nullptr}, - {button8_, BUTTON8, 181, 260, 104, 70, button8Path, nullptr}, - {button9_, BUTTON9, 293, 260, 104, 70, button9Path, nullptr}, - {button0_, BUTTON0, 181, 338, 104, 70, button0Path, nullptr}, - {buttoncall_, BUTTONCALL, 69, 338, 104, 70, buttonCallPath, nullptr}, - {buttondel_, BUTTONDEL, 293, 338, 104, 70, buttonDelPath, nullptr}, + {button1_, BUTTON1, 68, 104, 104, 70, button1Path, button1Path}, + {button2_, BUTTON2, 181, 104, 104, 70, button2Path, button2Path}, + {button3_, BUTTON3, 293, 104, 104, 70, button3Path, button3Path}, + {button4_, BUTTON4, 69, 182, 104, 70, button4Path, button4Path}, + {button5_, BUTTON5, 182, 182, 104, 70, button5Path, button5Path}, + {button6_, BUTTON6, 293, 182, 104, 70, button6Path, button6Path}, + {button7_, BUTTON7, 69, 260, 104, 70, button7Path, button7Path}, + {button8_, BUTTON8, 181, 260, 104, 70, button8Path, button8Path}, + {button9_, BUTTON9, 293, 260, 104, 70, button9Path, button9Path}, + {button0_, BUTTON0, 181, 338, 104, 70, button0Path, button0Path}, + {buttoncall_, BUTTONCALL, 69, 338, 104, 70, buttonCallPath, buttonCallPath}, + {buttondel_, BUTTONDEL, 293, 338, 104, 70, buttonDelPath, buttonDelPath}, }; for (const auto ¶ms : buttonParams) { initButton(params); } - container_child_init(); - container_->Add(container_child); } void PhoneCallView::ReLabel() { diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhonePresenter.cpp deleted file mode 100644 index b2af1c717..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhonePresenter.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include"ui_resource_string.h" -#include "NativeAbility.h" - -#include "phone/include/PhonePresenter.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static PhonePresenter *g_pPhonePresenter = nullptr; - - PhonePresenter::PhonePresenter() - { - - g_pPhonePresenter = this; - } - - PhonePresenter::~PhonePresenter() - { - - g_pPhonePresenter = nullptr; - } - - PhonePresenter *PhonePresenter::GetInstance() - { - - return g_pPhonePresenter; - } - - void PhonePresenter::OnStart() - { - - Presenter::OnStart(); - } - - void PhonePresenter::OnPause(void) - { - - Presenter::OnPause(); - } - - void PhonePresenter::OnResume(void) - { - - Presenter::OnResume(); - } - - void PhonePresenter::OnStop(void) - { - - Presenter::OnStop(); - } - - bool PhonePresenter::OnDrag(UIView &view, const DragEvent &event) - { - - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && - (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); - } - UNUSED(view); - return true; - } - - bool PhonePresenter::OnClick(UIView &view, const ClickEvent &event) - { - // 根据控件id查找是哪个控件触发了点击回调 - // if (strcmp(view.GetViewId(), 控件ID) == 0) - if (strcmp(view.GetViewId(), RINGBUTTON) == 0) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_PHONEDIR); - } - if (strcmp(view.GetViewId(), CALLBUTTON) == 0) - { - printf("phonecall!\n"); - NativeAbility::GetInstance().ChangeSlice(VIEW_PHONECALL); - } - return true; - } -} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneView.cpp deleted file mode 100644 index 326c969a9..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneView.cpp +++ /dev/null @@ -1,627 +0,0 @@ - - -#include "phone/include/PhoneView.h" - -#include "common/image_cache_manager.h" -#include "UiConfig.h" -#include "ui_resource_image.h" -#include -#include "components/ui_button.h" -namespace OHOS -{ - - static PhoneView *g_pPhoneView{nullptr}; - - PhoneView::PhoneView() - { - - g_pPhoneView = this; - } - - PhoneView::~PhoneView() - { - DeInit(); - g_pPhoneView = nullptr; - } - - PhoneView *PhoneView::GetInstance() - { - - return g_pPhoneView; - } - - void PhoneView::Init() - { - // if (container_ == nullptr) - // { - // container_ = new UIViewGroup(); - // container_->SetPosition(0, 0, 466, 466); - // container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - // } - - // Add ScrollView to App - if (container_ == nullptr) - { - container_ = new UIScrollView(); - } - container_->SetPosition(0, 0); // widget's left position and top position - container_->Resize(466, 466); // widget's width and height - container_->SetViewId("scrollView1"); // Set style - container_->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - - // Set additional property - - // // Add the CallBack about events - // UIView::OnDragListener *scrollView1Drag = static_cast(PhonePresenter::GetInstance()); - // container_->SetOnDragListener(scrollView1Drag); - // Add to rootView - //container_->Add(scrollView1_); - container_->SetVisible(true); - - // Add Label to App - if (label1_ == nullptr) - { - label1_ = new UILabel(); - } - label1_->SetPosition(203, 52); // widget's left position and top position - label1_->Resize(200, 60); // widget's width and height - label1_->SetViewId("label1"); // Set style - label1_->SetStyle(STYLE_TEXT_FONT, 30); - - // Set additional property - label1_->SetText("电话"); - label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label1_->SetRollSpeed(0); - label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - - // Add to scrollView1 - container_->Add(label1_); - label1_->SetVisible(true); - - // Add ImageView to App - if (image1_ == nullptr) - { - image1_ = new UIImageView(); - } - image1_->SetPosition(183, -73); // widget's left position and top position - image1_->Resize(100, 100); // widget's width and height - image1_->SetViewId("image1"); // Set style - - // Set additional property - - // Add to scrollView1 - container_->Add(image1_); - image1_->SetVisible(true); - - // Add Button to App - if (button2_ == nullptr) - { - button2_ = new UIButton(); - } - button2_->SetPosition(263, 116); // widget's left position and top position - button2_->Resize(140, 140); // widget's width and height - button2_->SetViewId("Call"); // Set style - button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); - button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - - // Set additional property -#ifdef _WIN32 - char *button2defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/Phone_Call.bin"; -#else - char *button2defaultImgSrc = "/user/res/Phone/Phone_Call.bin"; -#endif - char *button2triggeredImgSrc = nullptr; - button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc); - button2_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - - // Add the CallBack about events - UIView::OnClickListener *button2Click = static_cast(PhonePresenter::GetInstance()); - button2_->SetOnClickListener(button2Click); - // Add to scrollView1 - container_->Add(button2_); - button2_->SetVisible(true); - - // Add Button to App - if (button1_ == nullptr) - { - button1_ = new UIButton(); - } - button1_->SetPosition(63, 116); // widget's left position and top position - button1_->Resize(140, 140); // widget's width and height - button1_->SetViewId("Ring"); // Set style - button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); - button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - - // Set additional property -#ifdef _WIN32 - char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/ring.bin"; -#else - char *button1defaultImgSrc = "/user/res/Phone/Phone_Ring.bin"; -#endif - char *button1triggeredImgSrc = nullptr; - button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc); - button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - - // Add the CallBack about events - UIView::OnClickListener *button1Click = static_cast(PhonePresenter::GetInstance()); - button1_->SetOnClickListener(button1Click); - // Add to scrollView1 - container_->Add(button1_); - button1_->SetVisible(true); - - // Add Button to App - if (button5_ == nullptr) - { - button5_ = new UIButton(); - } - button5_->SetPosition(54, 358); // widget's left position and top position - button5_->Resize(390, 104); // widget's width and height - button5_->SetViewId("test1"); // Set style - button5_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - - // Set additional property - button5_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - - // Add the CallBack about events - UIView::OnClickListener *button5Click = static_cast(PhonePresenter::GetInstance()); - button5_->SetOnClickListener(button5Click); - // Add to scrollView1 - container_->Add(button5_); - button5_->SetVisible(true); - - // Add Label to App - if (label2_ == nullptr) - { - label2_ = new UILabel(); - } - label2_->SetPosition(173, 290); // widget's left position and top position - label2_->Resize(200, 60); // widget's width and height - label2_->SetViewId("label2"); // Set style - label2_->SetStyle(STYLE_TEXT_FONT, 30); - - // Set additional property - label2_->SetText("最近通话"); - label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label2_->SetRollSpeed(0); - label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - - // Add to scrollView1 - container_->Add(label2_); - label2_->SetVisible(true); - - // Add Label to App - if (label3_ == nullptr) - { - label3_ = new UILabel(); - } - label3_->SetPosition(83, 379); // widget's left position and top position - label3_->Resize(200, 60); // widget's width and height - label3_->SetViewId("label3"); // Set style - label3_->SetStyle(STYLE_TEXT_FONT, 35); - - // Set additional property - label3_->SetText("138 8888 4270"); - label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label3_->SetRollSpeed(0); - label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); - - // Add to scrollView1 - container_->Add(label3_); - label3_->SetVisible(true); - - // Add Label to App - if (label4_ == nullptr) - { - label4_ = new UILabel(); - } - label4_->SetPosition(87, 420); // widget's left position and top position - label4_->Resize(200, 60); // widget's width and height - label4_->SetViewId("label4"); // Set style - label4_->SetStyle(STYLE_TEXT_FONT, 20); - - // Set additional property - label4_->SetText("2023-11-11 14:56"); - label4_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label4_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label4_->SetRollSpeed(0); - label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); - - // Add to scrollView1 - container_->Add(label4_); - label4_->SetVisible(true); - - // Add Label to App - if (label9_ == nullptr) - { - label9_ = new UILabel(); - } - label9_->SetPosition(262, 419); // widget's left position and top position - label9_->Resize(200, 60); // widget's width and height - label9_->SetViewId("label5"); // Set style - label9_->SetStyle(STYLE_TEXT_FONT, 20); - - // Set additional property - label9_->SetText("拨入来电"); - label9_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label9_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label9_->SetRollSpeed(0); - label9_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); - - // Add to scrollView1 - container_->Add(label9_); - label9_->SetVisible(true); - - // Add Label to App - if (label14_ == nullptr) - { - label14_ = new UILabel(); - } - label14_->SetPosition(62, 850); // widget's left position and top position - label14_->Resize(200, 60); // widget's width and height - label14_->SetViewId("label14"); // Set style - label14_->SetStyle(STYLE_TEXT_FONT, 26); - - // Set additional property - label14_->SetText("注:只保留最近20条通话记录"); - label14_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label14_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); - label14_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label14_->SetRollSpeed(0); - label14_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); - - // Add to scrollView1 - container_->Add(label14_); - label14_->SetVisible(true); - - // Add Button to App - if (button3_ == nullptr) - { - button3_ = new UIButton(); - } - button3_->SetPosition(54, 482); // widget's left position and top position - button3_->Resize(390, 104); // widget's width and height - button3_->SetViewId("test2"); // Set style - button3_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - - // Set additional property - button3_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff4266c3, UIButton::PRESSED); - button3_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - - // Add the CallBack about events - UIView::OnClickListener *button3Click = static_cast(PhonePresenter::GetInstance()); - button3_->SetOnClickListener(button3Click); - // Add to scrollView1 - container_->Add(button3_); - button3_->SetVisible(true); - - // Add Label to App - if (label13_ == nullptr) - { - label13_ = new UILabel(); - } - label13_->SetPosition(90, 537); // widget's left position and top position - label13_->Resize(200, 60); // widget's width and height - label13_->SetViewId("label4"); // Set style - label13_->SetStyle(STYLE_TEXT_FONT, 20); - - // Set additional property - label13_->SetText("2023-11-10 17:00"); - label13_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label13_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label13_->SetRollSpeed(0); - label13_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); - - // Add to scrollView1 - container_->Add(label13_); - label13_->SetVisible(true); - - // Add Label to App - if (label12_ == nullptr) - { - label12_ = new UILabel(); - } - label12_->SetPosition(86, 491); // widget's left position and top position - label12_->Resize(200, 60); // widget's width and height - label12_->SetViewId("label3"); // Set style - label12_->SetStyle(STYLE_TEXT_FONT, 35); - - // Set additional property - label12_->SetText("0734 5411 6565"); - label12_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label12_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label12_->SetRollSpeed(0); - label12_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); - - // Add to scrollView1 - container_->Add(label12_); - label12_->SetVisible(true); - - // Add Label to App - if (label10_ == nullptr) - { - label10_ = new UILabel(); - } - label10_->SetPosition(269, 536); // widget's left position and top position - label10_->Resize(200, 60); // widget's width and height - label10_->SetViewId("lable10"); // Set style - label10_->SetStyle(STYLE_TEXT_FONT, 20); - - // Set additional property - label10_->SetText("未接来电"); - label10_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label10_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff)); - label10_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label10_->SetRollSpeed(0); - label10_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); - - // Add to scrollView1 - container_->Add(label10_); - label10_->SetVisible(true); - - // Add Button to App - if (button7_ == nullptr) - { - button7_ = new UIButton(); - } - button7_->SetPosition(54, 603); // widget's left position and top position - button7_->Resize(390, 104); // widget's width and height - button7_->SetViewId("test3"); // Set style - button7_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - button7_->SetStyle(STYLE_BORDER_RADIUS, 52); - - // Set additional property - button7_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - button7_->SetStyleForState(STYLE_BORDER_RADIUS, 52, UIButton::PRESSED); - - // Add the CallBack about events - UIView::OnClickListener *button7Click = static_cast(PhonePresenter::GetInstance()); - button7_->SetOnClickListener(button7Click); - // Add to scrollView1 - container_->Add(button7_); - button7_->SetVisible(true); - - // Add Label to App - if (label11_ == nullptr) - { - label11_ = new UILabel(); - } - label11_->SetPosition(89, 650); // widget's left position and top position - label11_->Resize(200, 60); // widget's width and height - label11_->SetViewId("label11"); // Set style - label11_->SetStyle(STYLE_TEXT_FONT, 20); - - // Set additional property - label11_->SetText("2023-11-9 12:00"); - label11_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label11_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label11_->SetRollSpeed(0); - label11_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); - - // Add to scrollView1 - container_->Add(label11_); - label11_->SetVisible(true); - - // Add Label to App - if (label16_ == nullptr) - { - label16_ = new UILabel(); - } - label16_->SetPosition(86, 613); // widget's left position and top position - label16_->Resize(200, 60); // widget's width and height - label16_->SetViewId("label11"); // Set style - label16_->SetStyle(STYLE_TEXT_FONT, 26); - - // Set additional property - label16_->SetText("小梦同学"); - label16_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label16_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label16_->SetRollSpeed(0); - label16_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); - - // Add to scrollView1 - container_->Add(label16_); - label16_->SetVisible(true); - - // Add Label to App - if (label15_ == nullptr) - { - label15_ = new UILabel(); - } - label15_->SetPosition(257, 650); // widget's left position and top position - label15_->Resize(200, 60); // widget's width and height - label15_->SetViewId("label11"); // Set style - label15_->SetStyle(STYLE_TEXT_FONT, 20); - - // Set additional property - label15_->SetText("拨出电话"); - label15_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label15_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label15_->SetRollSpeed(0); - label15_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20); - - // Add to scrollView1 - container_->Add(label15_); - label15_->SetVisible(true); - - // Add ImageView to App - if (image3_ == nullptr) - { - image3_ = new UIImageView(); - } - image3_->SetPosition(183, 927); // widget's left position and top position - image3_->Resize(100, 100); // widget's width and height - image3_->SetViewId("image3"); // Set style - - // Set additional property - - // Add to scrollView1 - container_->Add(image3_); - image3_->SetVisible(true); - } - - void PhoneView::DeInit() - { - // if (container_ != nullptr) - // { - // container_->RemoveAll(); - // delete container_; - // container_ = nullptr; - // } - if (container_ != nullptr) - { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } - if (label1_ != nullptr) - { - delete label1_; - label1_ = nullptr; - } - if (image1_ != nullptr) - { - delete image1_; - image1_ = nullptr; - } - if (button2_ != nullptr) - { - delete button2_; - button2_ = nullptr; - } - if (button1_ != nullptr) - { - delete button1_; - button1_ = nullptr; - } - if (button5_ != nullptr) - { - delete button5_; - button5_ = nullptr; - } - if (label2_ != nullptr) - { - delete label2_; - label2_ = nullptr; - } - if (label3_ != nullptr) - { - delete label3_; - label3_ = nullptr; - } - if (label4_ != nullptr) - { - delete label4_; - label4_ = nullptr; - } - if (label9_ != nullptr) - { - delete label9_; - label9_ = nullptr; - } - if (label14_ != nullptr) - { - delete label14_; - label14_ = nullptr; - } - if (button3_ != nullptr) - { - delete button3_; - button3_ = nullptr; - } - if (label13_ != nullptr) - { - delete label13_; - label13_ = nullptr; - } - if (label12_ != nullptr) - { - delete label12_; - label12_ = nullptr; - } - if (label10_ != nullptr) - { - delete label10_; - label10_ = nullptr; - } - if (button7_ != nullptr) - { - delete button7_; - button7_ = nullptr; - } - if (label11_ != nullptr) - { - delete label11_; - label11_ = nullptr; - } - if (label16_ != nullptr) - { - delete label16_; - label16_ = nullptr; - } - if (label15_ != nullptr) - { - delete label15_; - label15_ = nullptr; - } - if (image3_ != nullptr) - { - delete image3_; - image3_ = nullptr; - } - } - - UIView *PhoneView::GetView() - { - Init(); - return container_; - } - void PhoneView::OnStart() - { - container_ = new UIScrollView(); - if (container_ == nullptr) - { - return; - } - container_->SetPosition(0, 0); - container_->SetWidth(Screen::GetInstance().GetWidth()); - container_->SetHeight(Screen::GetInstance().GetHeight()); - - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(PhonePresenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - - container_->SetTouchable(true); - container_->SetDraggable(true); - - GetView(); - RootView::GetInstance()->Add(container_); - } - - void PhoneView::OnSetUpView() - { - - View::OnSetUpView(); - Draw(); - } - - void PhoneView::OnTearDownView() - { - - View::OnTearDownView(); - return; - } - - void PhoneView::OnStop() - { - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index f7e132cdf..90bfbd696 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -1874,17 +1874,18 @@ int uapi_hfp_connect(void) int ret; bd_addr_t bdaddr={0}; get_phone_addr(&bdaddr); - if(false==bt_is_acl_connected(&bdaddr)) - { - ret= gap_connect_remote_device(&bdaddr); + // if(false==bt_is_acl_connected(&bdaddr)) + // { + // ret= gap_connect_remote_device(&bdaddr); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[bt_is_acl_connected] ret:%X", ret); - } - else - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[bt_is_acl_connected is true"); - } - + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[bt_is_acl_connected] ret:%X", ret); + // } + // else + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[bt_is_acl_connected is true"); + // } + // ret= hfp_hf_send_dtmf_tone(&bdaddr,'1'); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[hfp_hf_send_dtmf_tone] ret:%X", ret); ret = hfp_hf_connect(&bdaddr); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "addr: ****%02x %02x %02x %02x g_bdAddr.type: %x\n", diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/0.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/0.bin index a64a3d611..0c098fbee 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/0.bin +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/0.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43704d2e265a3fef9caed1b75ea17180d9fa7bf6796c6e6132623d94d7fb3d71 +oid sha256:b92873550c64f5aff487c72c005850c758f41aa218a2fe6b28ac0b619cc4e173 size 5208 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/7.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/7.bin index 38530602d..d2f4026b1 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/7.bin +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/7.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8651c5e8ea1d750738bc0a12cc4f29eafab315efcb790f9fe12f00a4bb1d8672 +oid sha256:1150094abc7f4d0bfba0f9e04d43e8eff3eb9d04a53c8a868a8a84792ca3174a size 5208 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/9.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/9.bin index 8f5f14f88..8f0d4d04b 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/9.bin +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Phone/9.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a6f57b86f42a68fbdc9936c1fe5dce1f0f612fea96390e99c9c629e9ef0572a0 +oid sha256:48c584e97a798b1d1d3de726ae1eeff61f497b144992a1136783084fd1d3351a size 5208