#include "ui_resource_image.h"\r
#include <ui_scroll_view.h>\r
#include "components/ui_button.h"\r
+#include "osal_timer.h"\r
+#include "cmsis_os2.h"\r
namespace OHOS\r
{\r
\r
{\r
label_ = new UILabel();\r
}\r
- label_->SetPosition(115, 40); // widget's left position and top position\r
- label_->Resize(236, 47); // widget's width and height\r
+ label_->SetPosition(115-3, 40); // widget's left position and top position\r
+ label_->Resize(236+6, 47); // widget's width and height\r
label_->SetViewId("label1"); // Set style\r
label_->SetStyle(STYLE_TEXT_FONT, 40);\r
\r
initButton(params);\r
}\r
}\r
+ static int8_t roll_falg=0;//0.1s一次变换\r
+\r
+ static void label_Timer_CallBack(int data)\r
+ {\r
+ roll_falg--;\r
+ if(roll_falg<=0)\r
+ {\r
+ if(PhoneCallView::GetInstance())\r
+ PhoneCallView::GetInstance()->ReLabel(0);\r
+\r
+ if(g_pPhoneCallView->call_roll_timer)\r
+ {\r
+ osTimerStop(g_pPhoneCallView->call_roll_timer);\r
+ osTimerDelete(g_pPhoneCallView->call_roll_timer);\r
+ g_pPhoneCallView->call_roll_timer = NULL;\r
+ }\r
+ }\r
+ }\r
+\r
+ void PhoneCallView::start_call_roll_timer()\r
+ {\r
+ uint32_t tick;\r
+ osStatus_t retTimer;\r
+ if(call_roll_timer)\r
+ {\r
+ roll_falg=10;\r
+ // osTimerStop(call_roll_timer);\r
+ // osTimerDelete(call_roll_timer);\r
+\r
+ // call_roll_timer = osTimerNew((osTimerFunc_t)label_Timer_CallBack, osTimerPeriodic, NULL, NULL);\r
+ // tick =100;// osMs2Tick(1000);\r
+ // retTimer = osTimerStart(call_roll_timer, tick);\r
+ // if (retTimer != osOK && call_roll_timer != NULL) {\r
+ // osTimerDelete(call_roll_timer);\r
+ // call_roll_timer = NULL;\r
+ // return ;\r
+ // }\r
+\r
+ }\r
+ else\r
+ {\r
+ roll_falg=10;\r
+\r
+ call_roll_timer = osTimerNew((osTimerFunc_t)label_Timer_CallBack, osTimerPeriodic, NULL, NULL);\r
+ tick =100;// osMs2Tick(1000);\r
+ retTimer = osTimerStart(call_roll_timer, tick);\r
+ if (retTimer != osOK && call_roll_timer != NULL) {\r
+ osTimerDelete(call_roll_timer);\r
+ call_roll_timer = NULL;\r
+ return ;\r
+ }\r
+ }\r
+ \r
+ }\r
void PhoneCallView::ReLabel()\r
{\r
+ if(PhoneCallPresenter::GetInstance()->phoneNumber.length()>11)\r
+ {\r
+ label_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);\r
+ label_->SetText(PhoneCallPresenter::GetInstance()->phoneNumber.c_str()+\r
+ (PhoneCallPresenter::GetInstance()->phoneNumber.length()-11));\r
+ start_call_roll_timer();\r
+ \r
+ }\r
+ else\r
+ {\r
+ label_->SetText(PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
+ }\r
+ }\r
+\r
+ void PhoneCallView::ReLabel(uint8_t data)\r
+ {\r
+ if(label_)\r
label_->SetText(PhoneCallPresenter::GetInstance()->phoneNumber.c_str());\r
}\r
+\r
void PhoneCallView::DeInit()\r
{\r
printf("DeInit is ok !\n");\r
delete buttondel_;\r
buttondel_ = nullptr;\r
}\r
+ if(call_roll_timer)\r
+ {\r
+ osTimerStop(call_roll_timer);\r
+ osTimerDelete(call_roll_timer);\r
+ call_roll_timer = NULL;\r
+ \r
+ }\r
+ roll_falg=0;\r
+\r
delete container_child;\r
container_child = nullptr;\r
\r
\r
#include "phone/include/PhoneDirView.h"\r
#include "ui_resource_string.h"\r
+#include "common/image_cache_manager.h"\r
\r
#include "phone/include/phoneaddressmodel.h"\r
#define PHONE_DIR_GIRL "/user/res/Phone/little-girl.bin"\r
button->SetViewId(buttonconfig.ViewId);\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "----------%s ---",buttonconfig.ViewId);\r
button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+\r
+ if(buttonconfig.ImageSrc)\r
button->SetImageSrc(buttonconfig.ImageSrc, buttonconfig.ImageSrc);\r
+\r
button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
if(clickListener!=NULL)\r
button->SetOnClickListener(clickListener);\r
button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize);\r
button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
\r
- button->SetImagePosition(30, 25);\r
+ button->SetImagePosition(25, 25);\r
return button;\r
}\r
\r
buttonconfig.ViewId =number_str[i];\r
\r
buttonconfig.ImageSrc = addressbook_t.Contact_t[i].sex ? PHONE_DIR_BOY:PHONE_DIR_GIRL;\r
- buttonconfig.label_x=120;\r
+ buttonconfig.label_x=107;\r
buttonconfig.label_y=0;\r
buttonconfig.Fontsize=30;\r
buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;\r
if (container_one_page == nullptr) {\r
container_one_page = new UIScrollView();\r
container_one_page->SetPosition(0, 0,Screen::GetInstance().GetWidth(),Screen::GetInstance().GetHeight());\r
- container_one_page->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+ //container_one_page->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
container_one_page->SetViewId("container_one_page");\r
+ container_one_page->SetScrollBlankSize(35);\r
+ container_one_page->SetReboundSize(35);\r
+ container_one_page->SetDirection(1);\r
}\r
\r
// Add Label to App\r
if (label1_phone_name == nullptr) {\r
label1_phone_name = new UILabelExt();\r
}\r
- label1_phone_name->SetPosition(0, 53); // widget's left position and top position\r
- label1_phone_name->Resize(466, 55); // widget's width and height\r
+ label1_phone_name->SetPosition(0, 52); // widget's left position and top position\r
+ label1_phone_name->Resize(466, 30); // widget's width and height\r
label1_phone_name->SetViewId("label1");// Set style\r
- label1_phone_name->SetStyle(STYLE_TEXT_FONT, 50);\r
+ label1_phone_name->SetStyle(STYLE_TEXT_FONT, 30);\r
\r
// Set additional property\r
label1_phone_name->SetText(addressbook_t.Contact_t[0].name);\r
label1_phone_name->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);\r
label1_phone_name->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- label1_phone_name->SetRollSpeed(1);\r
- label1_phone_name->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 50);\r
+ label1_phone_name->SetRollSpeed(70);\r
+ label1_phone_name->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
\r
// Add to rootView\r
container_one_page->Add(label1_phone_name);\r
if (phone_name == nullptr) {\r
phone_name = new UIImageView();\r
}\r
- phone_name->SetPosition(170, 140); // widget's left position and top position\r
- phone_name->Resize(109, 111); // widget's width and height\r
+ phone_name->SetPosition(158, 107); // widget's left position and top position\r
+ // phone_name->Resize(150, 150); // widget's width and height\r
phone_name->SetViewId("phone_sex");// Set style\r
- const char *Imagesrc=addressbook_t.Contact_t[0].sex ? PHONE_DIR_BOY_1:PHONE_DIR_GIRL_1;\r
- phone_name->SetSrc(Imagesrc);\r
+\r
+ image_boy = ImageCacheManager::GetInstance().LoadSingleRes(PHONE_DIR_BOY_1);\r
+\r
+ image_girl = ImageCacheManager::GetInstance().LoadSingleRes(PHONE_DIR_GIRL_1);\r
+\r
+ phone_name->SetSrc(addressbook_t.Contact_t[0].sex ? image_boy:image_girl);\r
\r
\r
\r
container_one_page->SetVisible(false);\r
container_one_page->SetDraggable(true);\r
container_one_page->SetTouchable(true);\r
- RootView::GetInstance()->Add(container_one_page);\r
+ \r
\r
\r
\r
UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(PhoneDirPresenter::GetInstance());\r
/* -------------------------------------------------------------------------- */\r
ButtonConfig_ext_t buttonconfig;\r
- buttonconfig.x = 80;\r
- buttonconfig.y = 300;\r
- buttonconfig.w = 319;\r
- buttonconfig.h = 106;\r
+ buttonconfig.x = 43;\r
+ buttonconfig.y = 277;\r
+ buttonconfig.w = 380;\r
+ buttonconfig.h = 100;\r
\r
int len =addressbook_t.Contact_t[0].phone_num;\r
\r
char buf[32]={0};\r
sprintf(buf,"%s",i);\r
buttonconfig.ViewId =buf;\r
- \r
+ buttonconfig.ImageSrc=nullptr;\r
buttonconfig.label_x=50;\r
buttonconfig.label_y=0;\r
buttonconfig.Fontsize=30;\r
container_one_page->SetOnDragListener(draglistener);\r
\r
\r
+ \r
return;\r
\r
}\r
\r
}\r
\r
- container_->SetVisible(false);\r
+ //container_->SetVisible(false);\r
container_one_page->SetVisible(true);\r
uint8_t id= atoi(idstr);//idstr[16];\r
if(addressbook_t.Contact_t[id].name) \r
label1_phone_name->SetText(addressbook_t.Contact_t[id].name);\r
- const char *Imagesrc=addressbook_t.Contact_t[id].sex ? PHONE_DIR_BOY_1:PHONE_DIR_GIRL_1;\r
- phone_name->SetSrc(Imagesrc);\r
+\r
+ phone_name->SetSrc(addressbook_t.Contact_t[0].sex ? image_boy:image_girl);\r
\r
int len =addressbook_t.Contact_t[id].phone_num;\r
\r
delete phone_name;\r
phone_name = nullptr;\r
}\r
+ ImageCacheManager::GetInstance().UnloadSingleRes(PHONE_DIR_BOY_1);\r
+\r
+ ImageCacheManager::GetInstance().UnloadSingleRes(PHONE_DIR_GIRL_1);\r
\r
if(label1_phone_name)\r
{\r
container_->SetHeight(Screen::GetInstance().GetHeight());\r
\r
container_->SetScrollBlankSize(35);\r
- container_->SetReboundSize(50);\r
+ container_->SetReboundSize(35);\r
container_->SetDirection(1);\r
\r
+\r
// 创建 draglistener 实例并设置为拖动监听器\r
UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(PhoneDirPresenter::GetInstance());\r
if (draglistener == nullptr)\r
\r
if (label1_ == nullptr) {\r
label1_ = new UILabelExt();\r
- }\r
+ }\r
label1_->SetPosition(0, 18); // widget's left position and top position\r
label1_->Resize(466, 88); // widget's width and height\r
label1_->SetViewId("label1");// Set style\r
}\r
else\r
{\r
- initView_ext(73,95,319,106,120,NULL);\r
+ initView_ext(43,123,380,100,120,NULL);\r
}\r
\r
\r
\r
\r
RootView::GetInstance()->Add(container_);\r
+ if(container_one_page)\r
+ RootView::GetInstance()->Add(container_one_page);\r
\r
// 增加按键监听\r
RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::PhoneDirPresenter::GetInstance();\r