button->SetPosition(leftPos, topPos);\r
button->Resize(width, height);\r
button->SetViewId(buttonNumber);\r
- button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
\r
+ button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+ button->SetStyle(STYLE_BORDER_COLOR, 0xff191919);\r
// Set additional properties\r
button->SetImageSrc(defaultImgSrc, triggeredImgSrc);\r
- button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
+ button->SetStyleForState(STYLE_BORDER_COLOR, 0xff191919, UIButton::PRESSED);\r
+ button->SetStyleForState(STYLE_BORDER_WIDTH, 0, UIButton::PRESSED);\r
+ button->SetStyleForState(STYLE_BORDER_COLOR, 0xff191919, UIButton::PRESSED);\r
// Add the callback for events\r
UIView::OnClickListener *buttonClick = static_cast<UIView::OnClickListener *>(PhoneCallPresenter::GetInstance());\r
button->SetOnClickListener(buttonClick);\r
+ UIView::OnLongPressListener*buttonlongpress=static_cast<UIView::OnLongPressListener *>(PhoneCallPresenter::GetInstance());\r
+ button->SetOnLongPressListener(buttonlongpress);\r
\r
// Add to rootView\r
container_->Add(button);\r
\r
}\r
\r
- void PhoneCallView ::container_child_init()\r
- {\r
- if (container_child == nullptr)\r
- {\r
- container_child = new UIViewGroup();\r
- container_child->SetPosition(0, 0, 466, 466);\r
- //container_child->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
- }\r
- container_child->SetViewId("button_4G_and_BT");\r
- //button_4G = params.button;\r
- if (button_4G == nullptr)\r
- {\r
- button_4G = new UIButton();\r
- }\r
- button_4G->SetPosition(73, 144);\r
- button_4G->Resize(140, 188);\r
- button_4G->SetViewId("button_4G");\r
- button_4G->SetStyle(STYLE_BACKGROUND_COLOR, 0xff14ff00);\r
- button_4G->SetStyle(STYLE_BORDER_RADIUS, 50);\r
- // Set additional properties\r
- //button->SetImageSrc(defaultImgSrc, triggeredImgSrc);\r
- button_4G->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- button_4G->SetStyleForState(STYLE_BORDER_RADIUS,50,UIButton::PRESSED);\r
- // Add the callback for events\r
- UIView::OnClickListener *buttonClick = static_cast<UIView::OnClickListener *>(PhoneCallPresenter::GetInstance());\r
- button_4G->SetOnClickListener(buttonClick);\r
-\r
- // Add to rootView\r
- container_child->Add(button_4G);\r
-\r
- if (button_BT == nullptr)\r
- {\r
- button_BT = new UIButton();\r
- }\r
\r
- button_BT->SetPosition(263, 144);\r
- button_BT->Resize(140, 188);\r
- button_BT->SetViewId("button_BT");\r
- button_BT->SetStyle(STYLE_BACKGROUND_COLOR, 0xff0092ff);\r
- button_BT->SetStyle(STYLE_BORDER_RADIUS, 50);\r
- // Set additional properties\r
- //button->SetImageSrc(defaultImgSrc, triggeredImgSrc);\r
- button_BT->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- button_BT->SetStyleForState(STYLE_BORDER_RADIUS,50,UIButton::PRESSED);\r
- // Add the callback for events\r
- //UIView::OnClickListener *buttonClick = static_cast<UIView::OnClickListener *>(PhoneCallPresenter::GetInstance());\r
- button_BT->SetOnClickListener(buttonClick);\r
-\r
- // Add to rootView\r
- container_child->Add(button_BT);\r
-\r
- if (label_4G == nullptr)\r
- {\r
- label_4G = new UILabel();\r
- }\r
- label_4G->SetPosition(112, 211); // widget's left position and top position\r
- label_4G->Resize(236, 47); // widget's width and height\r
- label_4G->SetViewId("label1"); // Set style\r
- label_4G->SetStyle(STYLE_TEXT_FONT, 40);\r
-\r
- // Set additional property\r
-\r
- label_4G->SetText("4G");\r
- //printf("view phoneNumber: %s\n", PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
- label_4G->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label_4G->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label_4G->SetRollSpeed(0);\r
- label_4G->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
- container_child->Add(label_4G);\r
-\r
- if (label_BT == nullptr)\r
- {\r
- label_BT = new UILabel();\r
- }\r
- label_BT->SetPosition(302, 211); // widget's left position and top position\r
- label_BT->Resize(236, 47); // widget's width and height\r
- label_BT->SetViewId("label2"); // Set style\r
- label_BT->SetStyle(STYLE_TEXT_FONT, 40);\r
-\r
- // Set additional property\r
-\r
- label_BT->SetText("BT");\r
- //printf("view phoneNumber: %s\n", PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
- label_BT->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label_BT->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label_BT->SetRollSpeed(0);\r
- label_BT->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
- container_child->Add(label_BT);\r
-\r
-\r
- container_child->SetVisible(false);\r
-\r
-\r
- }\r
\r
void PhoneCallView::container_child_SetVisible(bool falg)\r
{\r
container_->Add(label_);\r
label_->SetVisible(true);\r
ButtonInitParams buttonParams[] = {\r
- {button1_, BUTTON1, 68, 104, 104, 70, button1Path, nullptr},\r
- {button2_, BUTTON2, 181, 104, 104, 70, button2Path, nullptr},\r
- {button3_, BUTTON3, 293, 104, 104, 70, button3Path, nullptr},\r
- {button4_, BUTTON4, 69, 182, 104, 70, button4Path, nullptr},\r
- {button5_, BUTTON5, 182, 182, 104, 70, button5Path, nullptr},\r
- {button6_, BUTTON6, 293, 182, 104, 70, button6Path, nullptr},\r
- {button7_, BUTTON7, 69, 260, 104, 70, button7Path, nullptr},\r
- {button8_, BUTTON8, 181, 260, 104, 70, button8Path, nullptr},\r
- {button9_, BUTTON9, 293, 260, 104, 70, button9Path, nullptr},\r
- {button0_, BUTTON0, 181, 338, 104, 70, button0Path, nullptr},\r
- {buttoncall_, BUTTONCALL, 69, 338, 104, 70, buttonCallPath, nullptr},\r
- {buttondel_, BUTTONDEL, 293, 338, 104, 70, buttonDelPath, nullptr},\r
+ {button1_, BUTTON1, 68, 104, 104, 70, button1Path, button1Path},\r
+ {button2_, BUTTON2, 181, 104, 104, 70, button2Path, button2Path},\r
+ {button3_, BUTTON3, 293, 104, 104, 70, button3Path, button3Path},\r
+ {button4_, BUTTON4, 69, 182, 104, 70, button4Path, button4Path},\r
+ {button5_, BUTTON5, 182, 182, 104, 70, button5Path, button5Path},\r
+ {button6_, BUTTON6, 293, 182, 104, 70, button6Path, button6Path},\r
+ {button7_, BUTTON7, 69, 260, 104, 70, button7Path, button7Path},\r
+ {button8_, BUTTON8, 181, 260, 104, 70, button8Path, button8Path},\r
+ {button9_, BUTTON9, 293, 260, 104, 70, button9Path, button9Path},\r
+ {button0_, BUTTON0, 181, 338, 104, 70, button0Path, button0Path},\r
+ {buttoncall_, BUTTONCALL, 69, 338, 104, 70, buttonCallPath, buttonCallPath},\r
+ {buttondel_, BUTTONDEL, 293, 338, 104, 70, buttonDelPath, buttonDelPath},\r
};\r
\r
for (const auto ¶ms : buttonParams)\r
{\r
initButton(params);\r
}\r
- container_child_init();\r
- container_->Add(container_child);\r
}\r
void PhoneCallView::ReLabel()\r
{\r
+++ /dev/null
-\r
-\r
-#include "phone/include/PhoneView.h"\r
-\r
-#include "common/image_cache_manager.h"\r
-#include "UiConfig.h"\r
-#include "ui_resource_image.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_button.h"\r
-namespace OHOS\r
-{\r
-\r
- static PhoneView *g_pPhoneView{nullptr};\r
-\r
- PhoneView::PhoneView()\r
- {\r
-\r
- g_pPhoneView = this;\r
- }\r
-\r
- PhoneView::~PhoneView()\r
- {\r
- DeInit();\r
- g_pPhoneView = nullptr;\r
- }\r
-\r
- PhoneView *PhoneView::GetInstance()\r
- {\r
-\r
- return g_pPhoneView;\r
- }\r
-\r
- void PhoneView::Init()\r
- {\r
- // if (container_ == nullptr)\r
- // {\r
- // container_ = new UIViewGroup();\r
- // container_->SetPosition(0, 0, 466, 466);\r
- // container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
- // }\r
-\r
- // Add ScrollView to App\r
- if (container_ == nullptr)\r
- {\r
- container_ = new UIScrollView();\r
- }\r
- container_->SetPosition(0, 0); // widget's left position and top position\r
- container_->Resize(466, 466); // widget's width and height\r
- container_->SetViewId("scrollView1"); // Set style\r
- container_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-\r
- // Set additional property\r
-\r
- // // Add the CallBack about events\r
- // UIView::OnDragListener *scrollView1Drag = static_cast<UIView::OnDragListener *>(PhonePresenter::GetInstance());\r
- // container_->SetOnDragListener(scrollView1Drag);\r
- // Add to rootView\r
- //container_->Add(scrollView1_);\r
- container_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label1_ == nullptr)\r
- {\r
- label1_ = new UILabel();\r
- }\r
- label1_->SetPosition(203, 52); // widget's left position and top position\r
- label1_->Resize(200, 60); // widget's width and height\r
- label1_->SetViewId("label1"); // Set style\r
- label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
-\r
- // Set additional property\r
- label1_->SetText("电话");\r
- label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label1_->SetRollSpeed(0);\r
- label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
- // Add to scrollView1\r
- container_->Add(label1_);\r
- label1_->SetVisible(true);\r
-\r
- // Add ImageView to App\r
- if (image1_ == nullptr)\r
- {\r
- image1_ = new UIImageView();\r
- }\r
- image1_->SetPosition(183, -73); // widget's left position and top position\r
- image1_->Resize(100, 100); // widget's width and height\r
- image1_->SetViewId("image1"); // Set style\r
-\r
- // Set additional property\r
-\r
- // Add to scrollView1\r
- container_->Add(image1_);\r
- image1_->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (button2_ == nullptr)\r
- {\r
- button2_ = new UIButton();\r
- }\r
- button2_->SetPosition(263, 116); // widget's left position and top position\r
- button2_->Resize(140, 140); // widget's width and height\r
- button2_->SetViewId("Call"); // Set style\r
- button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
- // Set additional property\r
-#ifdef _WIN32\r
- char *button2defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/Phone_Call.bin";\r
-#else\r
- char *button2defaultImgSrc = "/user/res/Phone/Phone_Call.bin";\r
-#endif\r
- char *button2triggeredImgSrc = nullptr;\r
- button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);\r
- button2_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *button2Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
- button2_->SetOnClickListener(button2Click);\r
- // Add to scrollView1\r
- container_->Add(button2_);\r
- button2_->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (button1_ == nullptr)\r
- {\r
- button1_ = new UIButton();\r
- }\r
- button1_->SetPosition(63, 116); // widget's left position and top position\r
- button1_->Resize(140, 140); // widget's width and height\r
- button1_->SetViewId("Ring"); // Set style\r
- button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
- button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
- // Set additional property\r
-#ifdef _WIN32\r
- char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Phone/ring.bin";\r
-#else\r
- char *button1defaultImgSrc = "/user/res/Phone/Phone_Ring.bin";\r
-#endif\r
- char *button1triggeredImgSrc = nullptr;\r
- button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
- button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
- button1_->SetOnClickListener(button1Click);\r
- // Add to scrollView1\r
- container_->Add(button1_);\r
- button1_->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (button5_ == nullptr)\r
- {\r
- button5_ = new UIButton();\r
- }\r
- button5_->SetPosition(54, 358); // widget's left position and top position\r
- button5_->Resize(390, 104); // widget's width and height\r
- button5_->SetViewId("test1"); // Set style\r
- button5_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-\r
- // Set additional property\r
- button5_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *button5Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
- button5_->SetOnClickListener(button5Click);\r
- // Add to scrollView1\r
- container_->Add(button5_);\r
- button5_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label2_ == nullptr)\r
- {\r
- label2_ = new UILabel();\r
- }\r
- label2_->SetPosition(173, 290); // widget's left position and top position\r
- label2_->Resize(200, 60); // widget's width and height\r
- label2_->SetViewId("label2"); // Set style\r
- label2_->SetStyle(STYLE_TEXT_FONT, 30);\r
-\r
- // Set additional property\r
- label2_->SetText("最近通话");\r
- label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label2_->SetRollSpeed(0);\r
- label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
- // Add to scrollView1\r
- container_->Add(label2_);\r
- label2_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label3_ == nullptr)\r
- {\r
- label3_ = new UILabel();\r
- }\r
- label3_->SetPosition(83, 379); // widget's left position and top position\r
- label3_->Resize(200, 60); // widget's width and height\r
- label3_->SetViewId("label3"); // Set style\r
- label3_->SetStyle(STYLE_TEXT_FONT, 35);\r
-\r
- // Set additional property\r
- label3_->SetText("138 8888 4270");\r
- label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label3_->SetRollSpeed(0);\r
- label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
-\r
- // Add to scrollView1\r
- container_->Add(label3_);\r
- label3_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label4_ == nullptr)\r
- {\r
- label4_ = new UILabel();\r
- }\r
- label4_->SetPosition(87, 420); // widget's left position and top position\r
- label4_->Resize(200, 60); // widget's width and height\r
- label4_->SetViewId("label4"); // Set style\r
- label4_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
- // Set additional property\r
- label4_->SetText("2023-11-11 14:56");\r
- label4_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label4_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label4_->SetRollSpeed(0);\r
- label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
- // Add to scrollView1\r
- container_->Add(label4_);\r
- label4_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label9_ == nullptr)\r
- {\r
- label9_ = new UILabel();\r
- }\r
- label9_->SetPosition(262, 419); // widget's left position and top position\r
- label9_->Resize(200, 60); // widget's width and height\r
- label9_->SetViewId("label5"); // Set style\r
- label9_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
- // Set additional property\r
- label9_->SetText("拨入来电");\r
- label9_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label9_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label9_->SetRollSpeed(0);\r
- label9_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
- // Add to scrollView1\r
- container_->Add(label9_);\r
- label9_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label14_ == nullptr)\r
- {\r
- label14_ = new UILabel();\r
- }\r
- label14_->SetPosition(62, 850); // widget's left position and top position\r
- label14_->Resize(200, 60); // widget's width and height\r
- label14_->SetViewId("label14"); // Set style\r
- label14_->SetStyle(STYLE_TEXT_FONT, 26);\r
-\r
- // Set additional property\r
- label14_->SetText("注:只保留最近20条通话记录");\r
- label14_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label14_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
- label14_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label14_->SetRollSpeed(0);\r
- label14_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-\r
- // Add to scrollView1\r
- container_->Add(label14_);\r
- label14_->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (button3_ == nullptr)\r
- {\r
- button3_ = new UIButton();\r
- }\r
- button3_->SetPosition(54, 482); // widget's left position and top position\r
- button3_->Resize(390, 104); // widget's width and height\r
- button3_->SetViewId("test2"); // Set style\r
- button3_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-\r
- // Set additional property\r
- button3_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff4266c3, UIButton::PRESSED);\r
- button3_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *button3Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
- button3_->SetOnClickListener(button3Click);\r
- // Add to scrollView1\r
- container_->Add(button3_);\r
- button3_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label13_ == nullptr)\r
- {\r
- label13_ = new UILabel();\r
- }\r
- label13_->SetPosition(90, 537); // widget's left position and top position\r
- label13_->Resize(200, 60); // widget's width and height\r
- label13_->SetViewId("label4"); // Set style\r
- label13_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
- // Set additional property\r
- label13_->SetText("2023-11-10 17:00");\r
- label13_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label13_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label13_->SetRollSpeed(0);\r
- label13_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
- // Add to scrollView1\r
- container_->Add(label13_);\r
- label13_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label12_ == nullptr)\r
- {\r
- label12_ = new UILabel();\r
- }\r
- label12_->SetPosition(86, 491); // widget's left position and top position\r
- label12_->Resize(200, 60); // widget's width and height\r
- label12_->SetViewId("label3"); // Set style\r
- label12_->SetStyle(STYLE_TEXT_FONT, 35);\r
-\r
- // Set additional property\r
- label12_->SetText("0734 5411 6565");\r
- label12_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label12_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label12_->SetRollSpeed(0);\r
- label12_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
-\r
- // Add to scrollView1\r
- container_->Add(label12_);\r
- label12_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label10_ == nullptr)\r
- {\r
- label10_ = new UILabel();\r
- }\r
- label10_->SetPosition(269, 536); // widget's left position and top position\r
- label10_->Resize(200, 60); // widget's width and height\r
- label10_->SetViewId("lable10"); // Set style\r
- label10_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
- // Set additional property\r
- label10_->SetText("未接来电");\r
- label10_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label10_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));\r
- label10_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label10_->SetRollSpeed(0);\r
- label10_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
- // Add to scrollView1\r
- container_->Add(label10_);\r
- label10_->SetVisible(true);\r
-\r
- // Add Button to App\r
- if (button7_ == nullptr)\r
- {\r
- button7_ = new UIButton();\r
- }\r
- button7_->SetPosition(54, 603); // widget's left position and top position\r
- button7_->Resize(390, 104); // widget's width and height\r
- button7_->SetViewId("test3"); // Set style\r
- button7_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
- button7_->SetStyle(STYLE_BORDER_RADIUS, 52);\r
-\r
- // Set additional property\r
- button7_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
- button7_->SetStyleForState(STYLE_BORDER_RADIUS, 52, UIButton::PRESSED);\r
-\r
- // Add the CallBack about events\r
- UIView::OnClickListener *button7Click = static_cast<UIView::OnClickListener *>(PhonePresenter::GetInstance());\r
- button7_->SetOnClickListener(button7Click);\r
- // Add to scrollView1\r
- container_->Add(button7_);\r
- button7_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label11_ == nullptr)\r
- {\r
- label11_ = new UILabel();\r
- }\r
- label11_->SetPosition(89, 650); // widget's left position and top position\r
- label11_->Resize(200, 60); // widget's width and height\r
- label11_->SetViewId("label11"); // Set style\r
- label11_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
- // Set additional property\r
- label11_->SetText("2023-11-9 12:00");\r
- label11_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label11_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label11_->SetRollSpeed(0);\r
- label11_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
- // Add to scrollView1\r
- container_->Add(label11_);\r
- label11_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label16_ == nullptr)\r
- {\r
- label16_ = new UILabel();\r
- }\r
- label16_->SetPosition(86, 613); // widget's left position and top position\r
- label16_->Resize(200, 60); // widget's width and height\r
- label16_->SetViewId("label11"); // Set style\r
- label16_->SetStyle(STYLE_TEXT_FONT, 26);\r
-\r
- // Set additional property\r
- label16_->SetText("小梦同学");\r
- label16_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label16_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label16_->SetRollSpeed(0);\r
- label16_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-\r
- // Add to scrollView1\r
- container_->Add(label16_);\r
- label16_->SetVisible(true);\r
-\r
- // Add Label to App\r
- if (label15_ == nullptr)\r
- {\r
- label15_ = new UILabel();\r
- }\r
- label15_->SetPosition(257, 650); // widget's left position and top position\r
- label15_->Resize(200, 60); // widget's width and height\r
- label15_->SetViewId("label11"); // Set style\r
- label15_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
- // Set additional property\r
- label15_->SetText("拨出电话");\r
- label15_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- label15_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label15_->SetRollSpeed(0);\r
- label15_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
- // Add to scrollView1\r
- container_->Add(label15_);\r
- label15_->SetVisible(true);\r
-\r
- // Add ImageView to App\r
- if (image3_ == nullptr)\r
- {\r
- image3_ = new UIImageView();\r
- }\r
- image3_->SetPosition(183, 927); // widget's left position and top position\r
- image3_->Resize(100, 100); // widget's width and height\r
- image3_->SetViewId("image3"); // Set style\r
-\r
- // Set additional property\r
-\r
- // Add to scrollView1\r
- container_->Add(image3_);\r
- image3_->SetVisible(true);\r
- }\r
-\r
- void PhoneView::DeInit()\r
- {\r
- // if (container_ != nullptr)\r
- // {\r
- // container_->RemoveAll();\r
- // delete container_;\r
- // container_ = nullptr;\r
- // }\r
- if (container_ != nullptr)\r
- {\r
- container_->RemoveAll();\r
- delete container_;\r
- container_ = nullptr;\r
- }\r
- if (label1_ != nullptr)\r
- {\r
- delete label1_;\r
- label1_ = nullptr;\r
- }\r
- if (image1_ != nullptr)\r
- {\r
- delete image1_;\r
- image1_ = nullptr;\r
- }\r
- if (button2_ != nullptr)\r
- {\r
- delete button2_;\r
- button2_ = nullptr;\r
- }\r
- if (button1_ != nullptr)\r
- {\r
- delete button1_;\r
- button1_ = nullptr;\r
- }\r
- if (button5_ != nullptr)\r
- {\r
- delete button5_;\r
- button5_ = nullptr;\r
- }\r
- if (label2_ != nullptr)\r
- {\r
- delete label2_;\r
- label2_ = nullptr;\r
- }\r
- if (label3_ != nullptr)\r
- {\r
- delete label3_;\r
- label3_ = nullptr;\r
- }\r
- if (label4_ != nullptr)\r
- {\r
- delete label4_;\r
- label4_ = nullptr;\r
- }\r
- if (label9_ != nullptr)\r
- {\r
- delete label9_;\r
- label9_ = nullptr;\r
- }\r
- if (label14_ != nullptr)\r
- {\r
- delete label14_;\r
- label14_ = nullptr;\r
- }\r
- if (button3_ != nullptr)\r
- {\r
- delete button3_;\r
- button3_ = nullptr;\r
- }\r
- if (label13_ != nullptr)\r
- {\r
- delete label13_;\r
- label13_ = nullptr;\r
- }\r
- if (label12_ != nullptr)\r
- {\r
- delete label12_;\r
- label12_ = nullptr;\r
- }\r
- if (label10_ != nullptr)\r
- {\r
- delete label10_;\r
- label10_ = nullptr;\r
- }\r
- if (button7_ != nullptr)\r
- {\r
- delete button7_;\r
- button7_ = nullptr;\r
- }\r
- if (label11_ != nullptr)\r
- {\r
- delete label11_;\r
- label11_ = nullptr;\r
- }\r
- if (label16_ != nullptr)\r
- {\r
- delete label16_;\r
- label16_ = nullptr;\r
- }\r
- if (label15_ != nullptr)\r
- {\r
- delete label15_;\r
- label15_ = nullptr;\r
- }\r
- if (image3_ != nullptr)\r
- {\r
- delete image3_;\r
- image3_ = nullptr;\r
- }\r
- }\r
-\r
- UIView *PhoneView::GetView()\r
- {\r
- Init();\r
- return container_;\r
- }\r
- void PhoneView::OnStart()\r
- {\r
- container_ = new UIScrollView();\r
- if (container_ == nullptr)\r
- {\r
- return;\r
- }\r
- container_->SetPosition(0, 0);\r
- container_->SetWidth(Screen::GetInstance().GetWidth());\r
- container_->SetHeight(Screen::GetInstance().GetHeight());\r
-\r
- // 创建 draglistener 实例并设置为拖动监听器\r
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(PhonePresenter::GetInstance());\r
- if (draglistener == nullptr)\r
- {\r
- return;\r
- }\r
- container_->SetOnDragListener(draglistener);\r
-\r
- container_->SetTouchable(true);\r
- container_->SetDraggable(true);\r
-\r
- GetView();\r
- RootView::GetInstance()->Add(container_);\r
- }\r
-\r
- void PhoneView::OnSetUpView()\r
- {\r
-\r
- View<PhonePresenter>::OnSetUpView();\r
- Draw();\r
- }\r
-\r
- void PhoneView::OnTearDownView()\r
- {\r
-\r
- View<PhonePresenter>::OnTearDownView();\r
- return;\r
- }\r
-\r
- void PhoneView::OnStop()\r
- {\r
- View<PhonePresenter>::OnStop();\r
- RootView::GetInstance()->RemoveAll();\r
- return;\r
- }\r
-}\r