From: hcj <1224667075@qq.com> Date: Mon, 1 Apr 2024 10:02:42 +0000 (+0800) Subject: 产测UI修改 X-Git-Tag: release_V1.2.70_20241020_135402~1239^2^2 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=e51939e3cdf3c56cb48ac2e2777c2fc93ff26600;p=mirrors%2FFD230.git 产测UI修改 --- diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 444d9ace0..ef3aae1fe 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -554,7 +554,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testspeak.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testmotor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testbutton.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testmakephone.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testmicrophone.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testcat1.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testhrsenson.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testgsenson.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h index 750592faa..3c9024ae9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h @@ -28,7 +28,8 @@ namespace OHOS bool testLCDScrollViewcrollViewinit(void); UIScrollView *testLCDScrollView{nullptr}; bool initViewStatus{false}; - UILabelButtonExt* labelButton_next = nullptr; + UILabelButtonExt* labelButton_next = nullptr; + UILabel *Title{nullptr}; // 标题 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h index a863774f9..d714525af 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h @@ -11,7 +11,7 @@ #include "components/ui_radio_button.h" #include "producttest/include/testmotor.h" #include "producttest/include/testbutton.h" -#include "producttest/include/testmakephone.h" +#include "producttest/include/testmicrophone.h" #include "producttest/include/testcat1.h" #include "producttest/include/testhrsenson.h" #include "components/ui_label_button_ext.h" @@ -31,7 +31,7 @@ namespace OHOS MOTOR, CAT1, BUTTON, - MAKEPHONE, + MICROPHONE, HRSENSON, GSENSON, OLDTEST, diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h index 8da8c72fe..dd71274f0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h @@ -41,6 +41,7 @@ namespace OHOS UIScrollView *testTPScrollView{nullptr}; bool initViewStatus{false}; UILabelButtonExt* labelButton_next = nullptr; + UILabel *Title{nullptr}; // 标题 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h index 98ddfc22c..663ecfaa4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h @@ -21,7 +21,7 @@ #include "producttest/include/testmotor.h" #include "producttest/include/testbutton.h" #include "producttest/include/testmagnetic.h" -#include "producttest/include/testmakephone.h" +#include "producttest/include/testmicrophone.h" #include "producttest/include/testcat1.h" #include "producttest/include/testhrsenson.h" #include "producttest/include/testgsenson.h" @@ -114,7 +114,7 @@ namespace OHOS testbuttonView *test_KEY_view{nullptr}; testMagicView *test_MG_view{nullptr}; testhrsenson1View *test_hr_view{nullptr}; - testmakephoneView *test_MP_view{nullptr}; + testmicrohoneView *test_MP_view{nullptr}; testgsensonView *test_G_view{nullptr}; testoldView *test_old_view{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h index 62b80ab00..8eb5cdad6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h @@ -34,6 +34,7 @@ namespace OHOS void ClearAll(void); UILabel *InitLabel(LabelConfig &labelConfig); UILabelButtonExt* init_button_next(int x,int y,char *view_id); + UILabel *init_title(int x,int y,char *view_text); private: bool testAboutTheWatchScrollViewinit(void); @@ -52,6 +53,7 @@ namespace OHOS UILabel *FONTTitle = nullptr; UILabel *FONT = nullptr; UILabelButtonExt* labelButton_next = nullptr; + UILabel *Title{nullptr}; // 标题 bool initViewStatus{false}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h index 02d5bca69..be5fee9da 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h @@ -49,6 +49,7 @@ namespace OHOS UIScrollView *testBUTTONScrollView{nullptr}; UILabelButtonExt* labelButton_next = nullptr; UILabelButtonExt* button[2]{NULL}; + UILabel *Title{nullptr}; // 标题 bool initViewStatus{false}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h index a76eb5e92..a02cd9f13 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h @@ -91,6 +91,7 @@ namespace OHOS UILabel *label_1_cat1vison{nullptr}; UILabel *label_1_cat1vison_1{nullptr}; bool initViewStatus{false}; + UILabel *Title{nullptr}; // 标题 UILabelButtonExt* button{NULL}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h index 0992a41f8..15985e4ac 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h @@ -47,7 +47,8 @@ namespace OHOS bool testCHANINGScrollViewcrollViewinit(void); UIScrollView *testCHANINGScrollView{nullptr}; bool initViewStatus{false}; - UILabelButtonExt* labelButton_next = nullptr; + UILabel *Title{nullptr}; // 标题 + UILabelButtonExt* labelButton_next = nullptr; }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testhrsenson.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testhrsenson.h index cb42b9d7e..f9051667c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testhrsenson.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testhrsenson.h @@ -91,7 +91,8 @@ namespace OHOS UILabelButtonExt* button_2{NULL}; UILabel *label_hrsenson_value_vison{nullptr}; bool initViewStatus{false}; - UILabelButtonExt* labelButton_next = nullptr; + UILabelButtonExt* labelButton_next = nullptr; + UILabel *Title{nullptr}; // 标题 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h index 543b479f5..e5c8c34cf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h @@ -37,6 +37,7 @@ namespace OHOS UISlider *BrightnessControlViewSlider = nullptr; UILabelButtonExt* labelButton_next = nullptr; + UILabel *Title{nullptr}; // 标题 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmakephone.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h similarity index 76% rename from code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmakephone.h rename to code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h index 57c97403b..e93389ff3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmakephone.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h @@ -1,5 +1,5 @@ -#ifndef TEST_MAKPHONE_VIEW_H -#define TEST_MAKPHONE_VIEW_H +#ifndef TEST_MICRPHONE_VIEW_H +#define TEST_MICRPHONE_VIEW_H #include "BaseView.h" #include "View.h" @@ -9,13 +9,13 @@ #include "components/ui_button.h" #include "components/ui_image_view.h" #include "components/ui_label_button_ext.h" -#include "producttest/include/testPresenter.h" +#include "producttest/include/testPresenter.h" #include "record/include/RecordingModel.h" //#include "cmsis_os.h" #include namespace OHOS { - class testmakephoneView + class testmicrohoneView { public: @@ -37,12 +37,12 @@ namespace OHOS }; - testmakephoneView(); - virtual ~testmakephoneView(); - static testmakephoneView *GetInstance(void); + testmicrohoneView(); + virtual ~testmicrohoneView(); + static testmicrohoneView *GetInstance(void); void buttoncallback(); - UIScrollView *testmakephoneInitIView(void); + UIScrollView *testmicrophoneInitIView(void); void ClearAll(void); private: UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); @@ -51,6 +51,7 @@ namespace OHOS UILabelButtonExt* labelButton_next = nullptr; UILabelButtonExt* button{NULL}; bool initViewStatus{false}; + UILabel *Title{nullptr}; // 标题 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h index 66ef48095..6fc494714 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h @@ -51,6 +51,7 @@ namespace OHOS UILabelButtonExt* labelButton_next = nullptr; UILabelButtonExt* button[2]{NULL}; bool initViewStatus{false}; + UILabel *Title{nullptr}; // 标题 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h index 0358e4bf2..9b50f80d6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h @@ -50,6 +50,7 @@ namespace OHOS bool initViewStatus{false}; UILabelButtonExt* labelButton_next = nullptr; UILabelButtonExt* button[2]{NULL}; + UILabel *Title{nullptr}; // 标题 }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp index 51bbd1f5d..900594883 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp @@ -18,7 +18,7 @@ namespace OHOS testLCDView::~testLCDView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testLCDView::~testLCDView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -33,8 +33,7 @@ namespace OHOS { if(testLCDScrollView) { - - + testLCDScrollView->RemoveAll(); if(MG_TEST_timer!=NULL) { osTimerStop(MG_TEST_timer); @@ -48,6 +47,11 @@ namespace OHOS delete labelButton_next; labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } delete testLCDScrollView; testLCDScrollView=nullptr; @@ -118,15 +122,19 @@ namespace OHOS testLCDScrollView->SetScrollBlankSize(35); testLCDScrollView->SetReboundSize(50); testLCDScrollView->SetDirection(1); - //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); - // if (draglistener == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); - // return false; - // } - // testLCDScrollView->SetOnDragListener(draglistener); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testLCDScrollView->SetOnDragListener(draglistener); testLCDScrollView->SetTouchable(true); - testLCDScrollView->SetDraggable(false); + testLCDScrollView->SetDraggable(true); + + Title= testAboutView::GetInstance()->init_title(163,45,"LCD_TEST"); + testLCDScrollView->Add(Title); + return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp index 1ec1fff41..75b74da11 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp @@ -47,11 +47,11 @@ namespace OHOS {SPEAK,"speakButton", "motorButton_next",true}, {MOTOR,"motorButton", "cat1button_next",true}, {CAT1,"cat1button", "buttonbutton_next",true}, - {BUTTON,"buttonbutton", "makephonebutton_next",true}, - {MAKEPHONE,"makephonebutton", "hrsensonbutton_next",true}, + {BUTTON,"buttonbutton", "microphonebutton_next",true}, + {MICROPHONE,"microphonebutton", "hrsensonbutton_next",true}, {HRSENSON,"hrsensonbutton", "gsensonbutton_next",true}, {GSENSON,"gsensonbutton","xxxx" ,true}, - {OLDTEST,"oldtestbutton","xxxx",true}, + {OLDTEST,"oldtestbutton","oldtestexit",true}, {shutdown,"shutdown","xxxxxxxxx",true}, }; // {FACTORYRESETVIEW,"FactoryResetButton",true}, @@ -119,7 +119,7 @@ namespace OHOS bool testPresenter::OnDrag(UIView &view, const DragEvent &event) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::"); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::"); if(strcmp(view.GetViewId(),"BrightnessControl") == 0 || strcmp(view.GetViewId(),"Brightnesview") == 0 ) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxx::"); @@ -152,18 +152,18 @@ namespace OHOS { return true; } - // if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) - // { - // for (int i = 1; i < MAX_TESTVIEWID; i++) - // { - // if (p_SystemView->GetSystemScrollView(i) != nullptr && p_SystemView->GetSystemScrollView(i)->IsVisible() == true) - // { - // p_SystemView->ChangeView(i, TESTVIEW); - // break; - // } - // } - // return true; - // } + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) + { + for (int i = 1; i < MAX_TESTVIEWID; i++) + { + if (p_SystemView->GetSystemScrollView(i)) + { + p_SystemView->ChangeView(i, TESTVIEW); + break; + } + } + return true; + } return false; } @@ -175,13 +175,20 @@ namespace OHOS //int len=5; // 根据控件id查找是哪个控件触发了点击回调 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick"); - - if(strcmp(view.GetViewId(),"xxxx") == 0) + + if(strcmp(view.GetViewId(),"xxxx") == 0) { //testSPEAKView::GetInstance()->Changspeak(true); testView::GetInstance()->ChangeView(GSENSON,TESTVIEW); return true; } + + if(strcmp(view.GetViewId(),"oldtestexit") == 0) + { + //testSPEAKView::GetInstance()->Changspeak(true); + testView::GetInstance()->ChangeView(OLDTEST,TESTVIEW); + return true; + } if(strcmp(view.GetViewId(),"shutdown") == 0) { uapi_poweroff_device(); @@ -218,9 +225,9 @@ namespace OHOS testMOTORView::GetInstance()->Changstatr(true); } - if(strcmp(view.GetViewId(),"testmakephoneView") == 0) + if(strcmp(view.GetViewId(),"testmicrohoneView") == 0) { - testmakephoneView::GetInstance()->buttoncallback(); + testmicrohoneView::GetInstance()->buttoncallback(); } if(strcmp(view.GetViewId(),"dial_112") == 0) @@ -251,7 +258,9 @@ namespace OHOS uint8_t keystate=event.GetState(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ":xxxxxxx:%d",keyID); // 如果是power键就返回上一级 - if (keyID == 41 ) + if(testbuttonView::GetInstance()) + { + if (keyID == 41 ) { if(keystate) testbuttonView::GetInstance()-> Changbutton(0,true); @@ -272,6 +281,9 @@ namespace OHOS // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); } + + } + return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp index 55183fedd..82706d75c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp @@ -18,7 +18,7 @@ namespace OHOS testTPView::~testTPView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testTPView::~testTPView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -48,6 +48,11 @@ namespace OHOS delete labelButton_next; labelButton_next=NULL; } + if(Title) + { + delete Title; + Title=nullptr; + } } } @@ -156,6 +161,11 @@ namespace OHOS labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"MAGETICButton_next"); testTPScrollView->Add(labelButton_next); + Title= testAboutView::GetInstance()->init_title(175,45,"TP_TEST"); + testTPScrollView->Add(Title); + + + return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp index 846846fef..cfdd0a47a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp @@ -28,7 +28,7 @@ namespace OHOS {MOTOR,"motorButton","motor", &testView::ChangmotorTESTView}, {CAT1,"cat1button","CAT1", &testView::ChangeCAT1TESTView}, {BUTTON,"buttonbutton","button" ,&testView::ChangKEYTESTView}, - {MAKEPHONE,"makephonebutton","makephone" ,&testView::ChangeMPTESTView}, + {MICROPHONE,"microphonebutton","microphone" ,&testView::ChangeMPTESTView}, {HRSENSON,"hrsensonbutton","hrsensor" ,&testView::ChangeHRTESTView}, {GSENSON,"gsensonbutton","gsensor" ,&testView::ChangeGTESTView}, {OLDTEST,"oldtestbutton","aging" ,&testView::ChangeoldTESTView}, @@ -153,7 +153,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLabel new fail!"); return false; } - SystemLabel->SetPosition(180, 52); + SystemLabel->SetPosition(162, 52); SystemLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); SystemLabel->SetStyle(STYLE_TEXT_FONT, 30); SystemLabel->SetStyle(STYLE_LINE_HEIGHT, 35); @@ -426,13 +426,13 @@ namespace OHOS if (SystemScrollView[thisView] == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); - test_MP_view = new testmakephoneView(); + test_MP_view = new testmicrohoneView(); if (test_MP_view == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); return false; } - SystemScrollView[thisView] = test_MP_view->testmakephoneInitIView(); + SystemScrollView[thisView] = test_MP_view->testmicrophoneInitIView(); RootView::GetInstance()->Add(SystemScrollView[thisView]); } return true; @@ -541,60 +541,91 @@ namespace OHOS RootView::GetInstance()->Remove(SystemScrollView[hideView]); delete test_about_view; test_about_view = nullptr; + SystemScrollView[hideView]=nullptr; break; case LCD: RootView::GetInstance()->Remove(SystemScrollView[hideView]); delete test_LCD_view; test_LCD_view = nullptr; + SystemScrollView[hideView]=nullptr; break; case TP: RootView::GetInstance()->Remove(SystemScrollView[hideView]); delete test_TP_view; test_TP_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case MAGETIC: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_MG_view; + test_MG_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case LUMINANCE: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_lum_view; + test_lum_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case CHAR: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_charging_view; + test_charging_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + + case SPEAK: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_speak_view; + test_speak_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case MOTOR: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_motor_view; + test_motor_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case CAT1: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_cat1_view; + test_cat1_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case BUTTON: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_KEY_view; + test_KEY_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case MICROPHONE: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_MP_view; + test_MP_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case HRSENSON: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_hr_view; + test_hr_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + case GSENSON: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_G_view; + test_G_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + // case OLDTEST: + // RootView::GetInstance()->Remove(SystemScrollView[hideView]); + // delete test_old_view; + // test_old_view = nullptr; + // SystemScrollView[hideView]=nullptr; + // break; + default: + break; } } - // break; - // case MAGETIC: - // delete test_MG_view; - // test_MG_view = nullptr; - // break; - // case LUMINANCE: - // delete test_lum_view; - // test_lum_view = nullptr; - // break; - // case CHAR: - // delete test_charging_view; - // test_charging_view = nullptr; - // break; - - // case SPEAK: - // delete test_speak_view; - // test_speak_view = nullptr; - // break; - // case MOTOR: - // delete test_motor_view; - // test_motor_view = nullptr; - // break; - // case CAT1: - // delete test_cat1_view; - // test_cat1_view = nullptr; - // break; - // case BUTTON: - // delete test_KEY_view; - // test_KEY_view = nullptr; - // break; - // case MAKEPHONE: - // delete test_MP_view; - // test_MP_view = nullptr; - // break; - // case HRSENSON: - // delete test_hr_view; - // test_hr_view = nullptr; - // break; - // default: - // break; - // } - // } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "change>>>>>>>>>>>>>"); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp index b17c56ca5..1214d7bde 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp @@ -89,6 +89,30 @@ namespace OHOS return label_button; } + + + UILabel *testAboutView::init_title(int x,int y,char *view_text) + { + + UILabel *label = new UILabel(); + if (label == nullptr) + { + return nullptr; + } + // label->SetPosition(x, y); // widget's left position and top position + // label->Resize(135, 88); // widget's width and height + label->SetPosition(x, y); // widget's left position and top position + label->Resize(460, 62); + // Set additional property + label->SetText(view_text); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + label->SetVisible(true); + + return label; + + } + + UILabel *testAboutView::InitLabel(LabelConfig &labelConfig) { UILabel *label = new UILabel(); @@ -120,14 +144,15 @@ namespace OHOS testAboutTheWatchScrollView->SetScrollBlankSize(0); testAboutTheWatchScrollView->SetReboundSize(0); testAboutTheWatchScrollView->SetDirection(1); - //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); - // if (draglistener == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); - // return false; - // } - // testAboutTheWatchScrollView->SetOnDragListener(draglistener); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testAboutTheWatchScrollView->SetOnDragListener(draglistener); testAboutTheWatchScrollView->SetTouchable(true); + testAboutTheWatchScrollView->SetDraggable(true); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp index 2c4f55eda..7c3bb28cf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp @@ -18,9 +18,9 @@ namespace OHOS testbuttonView::~testbuttonView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testbuttonView::~testbuttonView"); ClearAll(); - g_pSystemAboutTheWatchView = nullptr; + // g_pSystemAboutTheWatchView = nullptr; } testbuttonView *testbuttonView::GetInstance() @@ -52,6 +52,12 @@ namespace OHOS labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } + delete testBUTTONScrollView; testBUTTONScrollView=nullptr; } @@ -77,6 +83,7 @@ namespace OHOS button->SetAlign(TEXT_ALIGNMENT_LEFT); button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y ); button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize); + // UIView:: OnClickListener *touchListener = static_cast(testPresenter::GetInstance()); // button->SetOnClickListener(touchListener); @@ -147,7 +154,7 @@ namespace OHOS testBUTTONScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); testBUTTONScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); testBUTTONScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); - testBUTTONScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testBUTTONScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); testBUTTONScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); @@ -191,13 +198,24 @@ namespace OHOS // } // testcat1ScrollView->SetOnDragListener(draglistener); - labelButton_next= testAboutView::GetInstance()->init_button_next(267,278,"makephonebutton_next"); + labelButton_next= testAboutView::GetInstance()->init_button_next(267,220,"microphonebutton_next"); testBUTTONScrollView->Add(labelButton_next); + Title= testAboutView::GetInstance()->init_title(165,45,"KEY_TEST"); + testBUTTONScrollView->Add(Title); + + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testBUTTONScrollView->SetOnDragListener(draglistener); + testBUTTONScrollView->SetTouchable(true); - testBUTTONScrollView->SetDraggable(false); + testBUTTONScrollView->SetDraggable(true); return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp index d9042775d..794a056da 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp @@ -20,9 +20,9 @@ namespace OHOS testcat1View::~testcat1View() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testcat1View::~testcat1View"); ClearAll(); - g_pSystemAboutTheWatchView = nullptr; + //g_pSystemAboutTheWatchView = nullptr; } testcat1View *testcat1View::GetInstance() @@ -64,6 +64,12 @@ namespace OHOS delete label_1_cat1vison_1; label_1_cat1vison_1=nullptr; } + + if(Title) + { + delete Title; + Title=nullptr; + } delete testcat1ScrollView; @@ -246,7 +252,7 @@ namespace OHOS ButtonConfig_ext_t buttonconfig; buttonconfig.x = 100; buttonconfig.y = 300; - buttonconfig.w = 200; + buttonconfig.w = 180; buttonconfig.h = 116; buttonconfig.label_x=40; buttonconfig.label_y=0; @@ -257,6 +263,14 @@ namespace OHOS button=SetTheButton_ext(buttonconfig); testcat1ScrollView->Add(button); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testcat1ScrollView->SetOnDragListener(draglistener); + // buttonconfig.x = 100; @@ -283,11 +297,12 @@ namespace OHOS labelButton_next= testAboutView::GetInstance()->init_button_next(267,278,"buttonbutton_next"); testcat1ScrollView->Add(labelButton_next); - + Title= testAboutView::GetInstance()->init_title(165,45,"CAT1_TEST"); + testcat1ScrollView->Add(Title); testcat1ScrollView->SetTouchable(true); - testcat1ScrollView->SetDraggable(false); + testcat1ScrollView->SetDraggable(true); return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp index a71364d83..76d90e955 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp @@ -18,9 +18,9 @@ namespace OHOS testCHANINGView::~testCHANINGView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testCHANINGView::~testCHANINGView"); ClearAll(); - g_pSystemAboutTheWatchView = nullptr; + //g_pSystemAboutTheWatchView = nullptr; } testCHANINGView *testCHANINGView::GetInstance() @@ -45,6 +45,11 @@ namespace OHOS delete labelButton_next; labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } delete testCHANINGScrollView; testCHANINGScrollView=nullptr; @@ -117,7 +122,7 @@ namespace OHOS testCHANINGScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); testCHANINGScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); testCHANINGScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); - testCHANINGScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testCHANINGScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); testCHANINGScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); @@ -145,11 +150,22 @@ namespace OHOS // } // testCHANINGScrollView->SetOnDragListener(draglistener); testCHANINGScrollView->SetTouchable(true); - testCHANINGScrollView->SetDraggable(false); + testCHANINGScrollView->SetDraggable(true); - labelButton_next= testAboutView::GetInstance()->init_button_next(267,378,"speakButton_next"); + labelButton_next= testAboutView::GetInstance()->init_button_next(267,278,"speakButton_next"); testCHANINGScrollView->Add(labelButton_next); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testCHANINGScrollView->SetOnDragListener(draglistener); + + Title= testAboutView::GetInstance()->init_title(120,45,"CHANING_TEST"); + testCHANINGScrollView->Add(Title); + return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp index 73eb1c0ca..04746cec0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp @@ -39,7 +39,7 @@ namespace OHOS testgsensonView::~testgsensonView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testgsensonView::~testgsensonView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -165,14 +165,22 @@ namespace OHOS // } // testGsonsonScrollView->SetOnDragListener(draglistener); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testGsonsonScrollView->SetOnDragListener(draglistener); + LabelConfig Config = { - .left = 203, + .left = 121, .top = 52, .width = 60, .height = 35, .fontSize = 30, .lineHeigh = 35, - .text = "GSENSON", + .text = "GSENSOR_TEST", .lineBreakMode = UILabel::LINE_BREAK_ADAPT, }; title = InitLabel(Config); @@ -213,7 +221,7 @@ namespace OHOS testGsonsonScrollView->SetTouchable(true); - testGsonsonScrollView->SetDraggable(false); + testGsonsonScrollView->SetDraggable(true); diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testhrsenson.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testhrsenson.cpp index f67f42874..7c559dcd4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testhrsenson.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testhrsenson.cpp @@ -22,7 +22,7 @@ namespace OHOS testhrsenson1View::~testhrsenson1View() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testhrsenson1View::~testhrsenson1View"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -37,6 +37,7 @@ namespace OHOS { if(testhrsensonScrollView) { + testhrsensonScrollView->RemoveAll(); if(label_hrsenson_value_vison) { delete label_hrsenson_value_vison; @@ -57,6 +58,11 @@ namespace OHOS delete labelButton_next; labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } delete testhrsensonScrollView; testhrsensonScrollView=nullptr; @@ -192,7 +198,7 @@ namespace OHOS LabelConfig Config = { .left = 50, - .top = 70, + .top = 80, .width = 60, .height = 35, .fontSize = 30, @@ -230,7 +236,7 @@ namespace OHOS buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; button_1=SetTheButton_ext(buttonconfig); testhrsensonScrollView->Add(button_1); - + button_1->SetVisible(false); buttonconfig.x = 300; @@ -252,22 +258,26 @@ namespace OHOS // button[1]=SetTheButton_ext(buttonconfig); // testhrsensonScrollView->Add(button[1]); - // UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); - // if (draglistener == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); - // return false; - // } - // testhrsensonScrollView->SetOnDragListener(draglistener); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testhrsensonScrollView->SetOnDragListener(draglistener); + labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"gsensonbutton_next"); testhrsensonScrollView->Add(labelButton_next); + Title= testAboutView::GetInstance()->init_title(102,45,"HRSSONSER_TEST"); + testhrsensonScrollView->Add(Title); + testhrsensonScrollView->SetTouchable(true); - testhrsensonScrollView->SetDraggable(false); + testhrsensonScrollView->SetDraggable(true); int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST; send_ppg_cmd_msg(md); diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp index 446b886d3..ef0b87d9e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp @@ -18,7 +18,7 @@ namespace OHOS testLUMView::~testLUMView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testLUMView::~testLUMView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -45,6 +45,11 @@ namespace OHOS delete labelButton_next; labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } delete testLUMScrollView; testLUMScrollView=nullptr; @@ -77,7 +82,7 @@ namespace OHOS return false; } BrightnessControlViewSlider->SetSliderColor(Color::Gray(), Color::Silver()); - BrightnessControlViewSlider->SetPosition(167, 77, 130, 310); + BrightnessControlViewSlider->SetPosition(150, 90, 130, 310); BrightnessControlViewSlider->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP); BrightnessControlViewSlider->SetViewId("BrightnessControl"); BrightnessControlViewSlider->SetRange(0xff, 51); @@ -105,9 +110,12 @@ namespace OHOS testLUMScrollView->SetTouchable(true); testLUMScrollView->SetDraggable(true); - labelButton_next= testAboutView::GetInstance()->init_button_next(267,378,"chargingButton_next"); + labelButton_next= testAboutView::GetInstance()->init_button_next(300,278,"chargingButton_next"); testLUMScrollView->Add(labelButton_next); + Title= testAboutView::GetInstance()->init_title(99,54,"BRIGHTNESS_TEST"); + testLUMScrollView->Add(Title); + return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp index c901d7e78..d5b1d9c23 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp @@ -22,7 +22,7 @@ namespace OHOS testMagicView::~testMagicView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testMagicView::~testMagicView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -158,22 +158,22 @@ namespace OHOS testmagicScrollView->SetScrollBlankSize(0); testmagicScrollView->SetReboundSize(0); testmagicScrollView->SetDirection(1); - //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); - // if (draglistener == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); - // return false; - // } - // testmagicScrollView->SetOnDragListener(draglistener); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testmagicScrollView->SetOnDragListener(draglistener); LabelConfig Config = { - .left = 203, - .top = 52, + .left = 112, + .top = 75, .width = 60, .height = 35, .fontSize = 30, .lineHeigh = 35, - .text = "磁力测试", + .text = "MAGNETIC_TEST", .lineBreakMode = UILabel::LINE_BREAK_ADAPT, }; title = InitLabel(Config); @@ -220,7 +220,7 @@ namespace OHOS testmagicScrollView->SetTouchable(true); - testmagicScrollView->SetDraggable(false); + testmagicScrollView->SetDraggable(true); diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmakephone.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp similarity index 76% rename from code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmakephone.cpp rename to code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp index cc10ea063..27616e0de 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmakephone.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp @@ -1,35 +1,35 @@ #include "wearable_log.h" #include "custom_utils.h" #include "producttest/include/testPresenter.h" -#include "producttest/include/testmakephone.h" +#include "producttest/include/testmicrophone.h" #include "AlarmClockModel.h" #include "cmsis_os2.h" #include "audio_capture_wrapper.h" namespace OHOS { - static testmakephoneView *g_pSystemAboutTheWatchView{nullptr}; + static testmicrohoneView *g_pSystemAboutTheWatchView{nullptr}; - testmakephoneView::testmakephoneView() + testmicrohoneView::testmicrohoneView() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); g_pSystemAboutTheWatchView = this; } - testmakephoneView::~testmakephoneView() + testmicrohoneView::~testmicrohoneView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testmicrohoneView::~testmicrohoneView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } - testmakephoneView *testmakephoneView::GetInstance() + testmicrohoneView *testmicrohoneView::GetInstance() { return g_pSystemAboutTheWatchView; } - void testmakephoneView::ClearAll() + void testmicrohoneView::ClearAll() { if(testmakephoneScrollView) { @@ -45,12 +45,17 @@ namespace OHOS delete labelButton_next; labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } delete testmakephoneScrollView; testmakephoneScrollView=nullptr; } } - UILabelButtonExt *testmakephoneView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig) + UILabelButtonExt *testmicrohoneView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig) { UILabelButtonExt *button = new UILabelButtonExt(); if (button == nullptr) @@ -83,8 +88,8 @@ namespace OHOS uint8_t makphone_falg=0; - static char *Path= "/user/music/test_makephone.mp3"; - void testmakephoneView::buttoncallback() + static char *Path= "/user/music/microphone.mp3"; + void testmicrohoneView::buttoncallback() { if(button!=NULL) { @@ -92,17 +97,13 @@ namespace OHOS if(makphone_falg==0) { char *args[6] = {0}; - const char *defaultArgs[6] = {"01", "mp3", "16000", "1", "16","/user/music/test_makephone.mp3"}; // 默认参数数组 + const char *defaultArgs[6] = {"01", "mp3", "16000", "1", "16","/user/music/microphone.mp3"}; // 默认参数数组 for (int i = 0; i < 6; ++i) { - args[i] = (char *)malloc(64); // 分配内存 - sprintf(args[i], "%s", defaultArgs[i]); // 设置默认参数值 + args[i] = (char *)malloc(64); + sprintf(args[i], "%s", defaultArgs[i]); } - //args[5] = (char *)malloc(100); // 分配内存 - - // 获取形如:19700101000641格式的日期时间 - /* ---------------------------------- 开始录音 ---------------------------------- */ AudioCaptureSample(6, (const char **)args); button->SetText("stop"); @@ -116,7 +117,7 @@ namespace OHOS button->SetText("play"); makphone_falg++; - FILE *file =fopen("/user/music/test_makephone.mp3","rb"); + FILE *file =fopen("/user/music/microphone.mp3","rb"); if(file==NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ffffffffffffffffsssssss"); @@ -139,7 +140,7 @@ namespace OHOS - bool testmakephoneView::testphoneScrollViewcrollViewinit(void) + bool testmicrohoneView::testphoneScrollViewcrollViewinit(void) { testmakephoneScrollView = new UIScrollView(); @@ -151,7 +152,7 @@ namespace OHOS testmakephoneScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); testmakephoneScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); testmakephoneScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); - testmakephoneScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testmakephoneScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); testmakephoneScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); @@ -165,34 +166,37 @@ namespace OHOS buttonconfig.label_x=40; buttonconfig.label_y=0; buttonconfig.Fontsize=30; - buttonconfig.ViewId="testmakephoneView"; + buttonconfig.ViewId="testmicrohoneView"; buttonconfig.str="statr"; buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; button=SetTheButton_ext(buttonconfig); testmakephoneScrollView->Add(button); makphone_falg=0; - // UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); - // if (draglistener == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); - // return false; - // } - // testcat1ScrollView->SetOnDragListener(draglistener); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testmakephoneScrollView->SetOnDragListener(draglistener); labelButton_next= testAboutView::GetInstance()->init_button_next(50,278,"hrsensonbutton_next"); testmakephoneScrollView->Add(labelButton_next); + Title= testAboutView::GetInstance()->init_title(99,45,"MICRPPHONE_TEST"); + testmakephoneScrollView->Add(Title); + testmakephoneScrollView->SetTouchable(true); - testmakephoneScrollView->SetDraggable(false); + testmakephoneScrollView->SetDraggable(true); return true; } - UIScrollView *testmakephoneView::testmakephoneInitIView() + UIScrollView *testmicrohoneView::testmicrophoneInitIView() { if (!testphoneScrollViewcrollViewinit()) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp index f8dbea956..6b557aa37 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp @@ -20,7 +20,7 @@ namespace OHOS testMOTORView::~testMOTORView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testMOTORView::~testMOTORView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -47,6 +47,11 @@ namespace OHOS delete labelButton_next; labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } delete tesMOTORScrollView; tesMOTORScrollView=nullptr; } @@ -127,7 +132,7 @@ namespace OHOS tesMOTORScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); tesMOTORScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); tesMOTORScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); - tesMOTORScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + tesMOTORScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); tesMOTORScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); @@ -172,6 +177,9 @@ namespace OHOS labelButton_next= testAboutView::GetInstance()->init_button_next(267,278,"cat1button_next"); tesMOTORScrollView->Add(labelButton_next); + + Title= testAboutView::GetInstance()->init_title(136,45,"MOTOR_TEST"); + tesMOTORScrollView->Add(Title); return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp index 256fba9b9..14e0b710f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp @@ -13,9 +13,10 @@ //#include "acc_service.h" namespace OHOS { + static uint8 AGING_task_falg=0; static void AGING_task(void *arg) { - while (1) + while (AGING_task_falg==1) { msleep(1000); // uapi_tcxo_delay_ms(3000); @@ -31,9 +32,16 @@ namespace OHOS uint16_t angle_value= (int16_t)mag_service_get_fAzimuth(); char buf[16]={0}; sprintf(buf,"angle:%d",angle_value); - testoldView::GetInstance()->x->SetText(buf); - RootView::GetInstance()->Invalidate(); - msleep(1000); + if( testoldView::GetInstance()->x) + { + testoldView::GetInstance()->x->SetText(buf); + RootView::GetInstance()->Invalidate(); + msleep(1000); + } + else{ + break; + } + } for(int i=0;i<3;i++) { @@ -44,23 +52,29 @@ namespace OHOS uint16 y_t=t.y; uint16 z_t=t.z; sprintf(buf,"gsensor:\nX:%d\nY:%d\nZ:%d",x_t,y_t,z_t); - testoldView::GetInstance()->x->SetText(buf); - RootView::GetInstance()->Invalidate(); - - msleep(1000); + if(testoldView::GetInstance()->x) + { + testoldView::GetInstance()->x->SetText(buf); + RootView::GetInstance()->Invalidate(); + msleep(1000); + } + else{ + break; + } } // uapi_tcxo_delay_ms(3000); } + testoldView::GetInstance()->ClearAll(); } errcode_t old_test_init(void) { - + AGING_task_falg=1; PRINT("uapi_ppg_service_init !\r\n"); app_task_definition_t taskcfg={0}; taskcfg.create_queue_handle = NULL; - taskcfg.attr.name="old_test_service"; + taskcfg.attr.name="AGING_test_service"; taskcfg.attr.priority = TASK_PRIORITY_APP; taskcfg.attr.stack_size = 1024*8; taskcfg.func = AGING_task; @@ -86,8 +100,12 @@ namespace OHOS char buf[124]={0}; sprintf(buf,"leaklight:\ngreen:%d\nred:%d\nir:%d",g,r,ir); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf); - x->SetText(buf); - RootView::GetInstance()->Invalidate(); + if(x) + { + x->SetText(buf); + RootView::GetInstance()->Invalidate(); + + } int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST; send_ppg_cmd_msg(md); } @@ -102,9 +120,8 @@ namespace OHOS testoldView::~testoldView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); - ClearAll(); - g_pSystemAboutTheWatchView = nullptr; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testoldView::~testoldView"); + AGING_task_falg=0; } testoldView *testoldView::GetInstance() @@ -112,19 +129,11 @@ namespace OHOS return g_pSystemAboutTheWatchView; } - static osTimerId_t Gsenson_TEST_timer=NULL; void testoldView::ClearAll() { if(testoldScrollView) { testoldScrollView->RemoveAll(); - - if (Gsenson_TEST_timer != NULL) { - osTimerDelete(Gsenson_TEST_timer); - Gsenson_TEST_timer = NULL; - return ; - } - if(title!=NULL) { delete title; @@ -143,6 +152,7 @@ namespace OHOS delete testoldScrollView; testoldScrollView=nullptr; } + g_pSystemAboutTheWatchView=nullptr; } @@ -171,20 +181,23 @@ namespace OHOS CompassModel::GetInstance()->OpenCompassSensor(); - testoldScrollView = new UIScrollView(); - if (testoldScrollView == nullptr) + if(testoldScrollView==NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testoldScrollView new fail!"); - return false; - } - testoldScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - testoldScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - testoldScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294); + testoldScrollView = new UIScrollView(); + if (testoldScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testoldScrollView new fail!"); + return false; + } + testoldScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testoldScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testoldScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294); - - testoldScrollView->SetScrollBlankSize(0); - testoldScrollView->SetReboundSize(0); - testoldScrollView->SetDirection(1); + + testoldScrollView->SetScrollBlankSize(0); + testoldScrollView->SetReboundSize(0); + testoldScrollView->SetDirection(1); + } //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); // if (draglistener == nullptr) // { @@ -200,16 +213,20 @@ namespace OHOS .height = 35, .fontSize = 30, .lineHeigh = 35, - .text = "old_test", + .text = "AGING_TEST", .lineBreakMode = UILabel::LINE_BREAK_ADAPT, }; - title = InitLabel(Config); - if (title == nullptr) + if(title==NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); - return false; + title = InitLabel(Config); + if (title == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return false; + } + testoldScrollView->Add(title); } - testoldScrollView->Add(title); + /* -------------------------------------------------------------------------- */ // uint16_t angle_value= (int16_t)mag_service_get_fAzimuth(); gsenson_t t; @@ -227,18 +244,26 @@ namespace OHOS .lineBreakMode = UILabel::LINE_BREAK_ADAPT, }; - x = InitLabel(Config); - if (x == nullptr) + if(x==NULL) { + x = InitLabel(Config); + if (x == nullptr) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchNameTitle new fail!"); return false; + } + testoldScrollView->Add(x); } - testoldScrollView->Add(x); + /* -------------------------------------------------------------------------- */ - - labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"xxxx"); - testoldScrollView->Add(labelButton_next); + if(labelButton_next==NULL) + { + labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"oldtestexit"); + testoldScrollView->Add(labelButton_next); + + } + testoldScrollView->SetTouchable(true); @@ -251,6 +276,8 @@ namespace OHOS } display_api->set_screen_set_keepon_timeout(-1); + + old_test_init(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp index d7a1571dd..508a2319e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp @@ -18,7 +18,7 @@ namespace OHOS testSPEAKView::~testSPEAKView() { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testSPEAKView::~testSPEAKView"); ClearAll(); g_pSystemAboutTheWatchView = nullptr; } @@ -50,6 +50,11 @@ namespace OHOS delete labelButton_next; labelButton_next=nullptr; } + if(Title) + { + delete Title; + Title=nullptr; + } delete testSPEAKScrollView; testSPEAKScrollView=nullptr; } @@ -108,7 +113,6 @@ namespace OHOS { //开始 AlarmClockModel::GetInstance()->AlarmPlayerStart(); - speakfalg=true; // if(speak_TEST_timer!=NULL) // osTimerDelete(speak_TEST_timer); @@ -160,7 +164,7 @@ namespace OHOS testSPEAKScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); testSPEAKScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); testSPEAKScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); - testSPEAKScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testSPEAKScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); testSPEAKScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); @@ -193,22 +197,23 @@ namespace OHOS button[1]=SetTheButton_ext(buttonconfig); testSPEAKScrollView->Add(button[1]); - // UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); - // if (draglistener == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); - // return false; - // } - // testSPEAKScrollView->SetOnDragListener(draglistener); - - labelButton_next= testAboutView::GetInstance()->init_button_next(267,278,"motorButton_next"); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testSPEAKScrollView->SetOnDragListener(draglistener); + + labelButton_next= testAboutView::GetInstance()->init_button_next(267,220,"motorButton_next"); testSPEAKScrollView->Add(labelButton_next); - + Title= testAboutView::GetInstance()->init_title(120,45,"SPEAK_TEST"); + testSPEAKScrollView->Add(Title); testSPEAKScrollView->SetTouchable(true); - testSPEAKScrollView->SetDraggable(false); + testSPEAKScrollView->SetDraggable(true); return true;