#include "cat1_server_hal.h"
#include "custom_utils.h"
#include "phoneaddressmodel.h"
+#include "components/ui_label_button.h"
+#include "bletest.h"
// #define NOTIFY_THREE_SECONDS 3000
// #define NOTIFY_ONE_SECOND 1000
// #define NOTIFY_THIRTY_SECONDS 30000
UIViewGroup* g_multiPhoneView = nullptr;
UIViewGroup* g_callingView = nullptr;
UIViewGroup* g_waitingHintsView = nullptr;
+UIViewGroup* dial_group = nullptr;
+
VolumeSettingView *g_volumeSetting = nullptr;
UIImageView* g_imageAgree = nullptr;
UIImageView* g_imageDissgree = nullptr;
UIImageView* g_imageMicrophone = nullptr;
UIImageView* g_imageHandUp = nullptr;
UIImageView* g_imageHorns = nullptr;
+UIImageView* g_imagedial = nullptr;
+UIImageView* g_imageheadset = nullptr;
+UIImageView* g_imageperson = nullptr;
+
+
UIImageView* g_imageDissgreeNew = nullptr;
UILabel* g_callerNum = nullptr;
UILabel* g_callerDisplay = nullptr;
UILabel* g_newCallHints = nullptr;
UILabel* g_newCallNum = nullptr;
+UILabelButton* labelButton[12]={nullptr};
+UILabel* label_number = nullptr;
+UIImageView *image_line= nullptr;
UILabel* callername = nullptr;
UIViewGroup* calldialView = nullptr;
UILabel *diallabel1 = nullptr;
}
break;
case CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY:
- g_calldialTime = osTimerNew((osTimerFunc_t)CallCurTimerCallBack, osTimerPeriodic, NULL, NULL);
+ g_calldialTime = osTimerNew((osTimerFunc_t)CalldialTimerCallBackProc, osTimerPeriodic, NULL, NULL);
tick = osMs2Tick(interval);
retTimer = osTimerStart(g_calldialTime, tick);
if (retTimer != osOK && g_calldialTime != NULL) {
delete g_imageHorns;
g_imageHorns = nullptr;
}
+ if(g_imagedial)
+ {
+ delete g_imagedial;
+ g_imagedial = nullptr;
+ }
+ if(g_imageheadset)
+ {
+ delete g_imageheadset;
+ g_imageheadset = nullptr;
+ }
+ if(g_imageperson)
+ {
+ delete g_imageperson;
+ g_imageperson = nullptr;
+ }
}
static bool DrawCallingViewImage(void)
if (g_imageMicrophone == nullptr) {
return false;
}
- g_imageMicrophone->SetPosition(IMAGE_MIC_POSITION_X, IMAGE_ALL_POSITION_Y);
- g_imageMicrophone->SetSrc(PNG_MICROPHONE_OPEN_IMAGE_PATH);
+ g_imageMicrophone->SetPosition(46, 207);
+ g_imageMicrophone->SetSrc(PNG_230_MICROPHONE_OPEN_IMAGE_PATH);
g_imageMicrophone->SetTouchable(true);
g_imageMicrophone->SetViewId("microphoneChange");
FreeCallingViewImage();
return false;
}
- g_imageHandUp->SetPosition(IMAGE_HANDUP_POSITION_X, IMAGE_ALL_POSITION_Y);
- g_imageHandUp->SetSrc(PNG_DISSGREE_IMAGE_PATH);
+ g_imageHandUp->SetPosition(188, 340);
+ g_imageHandUp->SetSrc(PNG_230_VECTOR_IMAGE_PATH);
g_imageHandUp->SetTouchable(true);
g_imageHandUp->SetViewId("callingHandUp");
FreeCallingViewImage();
return false;
}
- g_imageHorns->SetPosition(IMAGE_HONRS_POSITION_X, IMAGE_HONRS_POSITION_Y);
- g_imageHorns->SetSrc(PNG_SOUNDBUTTON2);
+ g_imageHorns->SetPosition(369, 207);
+ g_imageHorns->SetSrc(PNG_230_VOICE_OPEN_IMAGE_PATH);
g_imageHorns->SetTouchable(true);
g_imageHorns->SetViewId("volumeSwitch");
+
+ g_imagedial = new UIImageView();
+ if (g_imagedial == nullptr) {
+ return false;
+ }
+ g_imagedial->SetPosition(80, 296); // 30 : offset
+ g_imagedial->SetSrc(PNG_230_DIAL_IMAGE_PATH);
+ g_imagedial->SetTouchable(true);
+ g_imagedial->SetViewId("dial");
+
+
+ g_imageheadset = new UIImageView();
+ if (g_imageheadset == nullptr) {
+ return false;
+ }
+ g_imageheadset->SetPosition(296, 296); // 30 : offset
+ g_imageheadset->SetSrc(PNG_230_HEADSET_1_IIMAGE_PATH);
+ g_imageheadset->SetTouchable(true);
+ g_imageheadset->SetViewId("headset");
+
+ g_imageperson = new UIImageView();
+ if (g_imageperson == nullptr) {
+ return false;
+ }
+ g_imageperson->SetPosition(158, 158); // 30 : offset
+ g_imageperson->SetSrc(PNG_230_PERSON_IMAGE_PATH);
+ g_imageperson->SetTouchable(true);
+ g_imageperson->SetViewId("headset");
+
+
return true;
}
if (g_callerDisplay == nullptr) {
return false;
}
- g_callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y,
- Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT);
+ g_callerDisplay->SetPosition(88, 81,
+ 289, 40);
g_callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
g_callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
g_callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER);
g_callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE);
g_callerDisplay->SetTextColor(Color::White());
+ g_callerDisplay->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
g_callDuration = new UILabel();
if (g_callDuration == nullptr) {
FreeCallingViewUILabel();
return false;
}
- g_callDuration->SetPosition(LABEL_CALLERD_POSITION_X, LABEL_CALLERD_POSITION_Y,
- Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT);
+
+ g_callDuration->SetPosition(194, 38,
+ 79, 35);
g_callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
g_callDuration->SetAlign(TEXT_ALIGNMENT_CENTER);
g_callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str());
- g_callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE);
- g_callDuration->SetTextColor(Color::White());
+ g_callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ g_callDuration->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff));
+
+ // g_currentTimes = new UILabel();
+ // if (g_currentTimes == nullptr) {
+ // FreeCallingViewUILabel();
+ // return false;
+ // }
+ // g_currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y,
+ // Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT);
+ // g_currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+ // g_currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);
+ // g_currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());
+ // g_currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE);
+ // g_currentTimes->SetTextColor(Color::White());
+
+
- g_currentTimes = new UILabel();
- if (g_currentTimes == nullptr) {
- FreeCallingViewUILabel();
- return false;
- }
- g_currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y,
- Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT);
- g_currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
- g_currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER);
- g_currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str());
- g_currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE);
- g_currentTimes->SetTextColor(Color::White());
return true;
}
{
if (calldialView != nullptr) {
DisableCallTimer(CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY);
+ DisableCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY);
+
calldialView->RemoveAll();
if(diallabel1!=NULL)
{
delete button1dial;
button1dial =nullptr;
}
- DisableCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY);
+
RootView::GetInstance()->Remove(calldialView);
delete calldialView;
calldialView = nullptr;
diallabl2 = new UILabel();
}
- diallabl2->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y,
- Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT);
- diallabl2->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
- diallabl2->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
- diallabl2->SetAlign(TEXT_ALIGNMENT_CENTER);
- diallabl2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE);
- diallabl2->SetTextColor(Color::White());
+ diallabl2->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y,
+ Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT);
+ diallabl2->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT);
+
+ char name_buf[30]={0};
+
+ if(get_phone_addrss_name(name_buf,CallerLogModel::GetInstance()->GetPhoneNumber().c_str()))
+ {
+ diallabl2->SetText(name_buf);
+ }
+ else
+ diallabl2->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str());
+
+
+ diallabl2->SetAlign(TEXT_ALIGNMENT_CENTER);
+ diallabl2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE);
+ diallabl2->SetTextColor(Color::White());
// Add to rootView
g_multiPhoneView->Add(g_imageMicrophone);
g_multiPhoneView->Add(g_imageHandUp);
g_multiPhoneView->Add(g_imageHorns);
+
g_multiPhoneView->Add(g_callerDisplay);
- g_multiPhoneView->Add(g_callDuration);
+ //g_multiPhoneView->Add(g_callDuration);
g_multiPhoneView->Add(g_currentTimes);
g_multiPhoneView->SetDraggable(true);
g_multiPhoneView->SetTouchable(true);
g_volumeSetting = nullptr;
}
}
+static char *dial_id_str[]={"1","2","3","4","5","6","7","8","9","*","0","#"};
+
+
+
+bool Initshowdial()
+{
+ dial_group = new UIViewGroup();
+ if (dial_group == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::UIViewGroup::new group error");
+ return false;
+ }
+ dial_group->SetPosition(MATH_ZERO, MATH_ZERO);
+ dial_group->Resize(466, 466); // 454 : value
+ dial_group->SetViewId("dialing");
+ dial_group->SetTouchable(true);
+ dial_group->SetDraggable(true);
+
+ uint8_t showdial_i=0;
+ for(int i=0;i<4;i++)
+ {
+ for(int j=0;j<3;j++)
+ {
+ if (labelButton[showdial_i] == nullptr) {
+ labelButton[showdial_i] = new UILabelButton();
+ }
+ if(labelButton[showdial_i]==nullptr)
+ {
+ return false;
+ }
+ labelButton[showdial_i]->SetPosition(69+(j*111), 107+(i*78)); // widget's left position and top position
+
+ labelButton[showdial_i]->Resize(107, 70); // widget's width and height
+ labelButton[showdial_i]->SetViewId(dial_id_str[showdial_i]);// Set style
+ labelButton[showdial_i]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+
+ labelButton[showdial_i]->SetText(dial_id_str[showdial_i]);
+ labelButton[showdial_i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+ labelButton[showdial_i]->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+ dial_group->Add(labelButton[showdial_i]);
+ labelButton[showdial_i]->SetVisible(true);
+ showdial_i++;
+ }
+ }
+
+ if (image_line == nullptr) {
+ image_line = new UIImageView();
+ }
+ if(image_line == nullptr)
+ {
+ return false;
+ }
+ image_line->SetPosition(193, 25); // widget's left position and top position
+ image_line->Resize(80, 8); // widget's width and height
+ image_line->SetViewId("image1");// Set style
+ image_line->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ image_line->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ image_line->SetStyle(STYLE_BORDER_RADIUS, 100);
+
+ dial_group->Add(image_line);
+ image_line->SetVisible(true);
+
+ // Add Label to App
+ if (label_number == nullptr) {
+ label_number = new UILabel();
+ }
+ if(label_number == nullptr)
+ {
+ return false;
+ }
+ label_number->SetPosition(100, 43); // widget's left position and top position
+ label_number->Resize(265, 60); // widget's width and height
+ label_number->SetViewId("label3");// Set style
+ label_number->SetStyle(STYLE_TEXT_FONT, 40);
+
+ // Set additional property
+ label_number->SetText("");
+ label_number->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
+ label_number->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label_number->SetRollSpeed(0);
+ label_number->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
+ dial_group->Add(label_number);
+ dial_group->SetVisible(false);
+
+ return true;
+}
+
+void showdial(bool flag)
+{
+ if(flag)
+ {
+ label_number->SetText("");
+ dial_group->SetVisible(true);
+ }
+ else
+ {
+ dial_group->SetVisible(false);
+ }
+ return;
+}
+
+void text_updata_buf(const char *buf)
+{
+ char new_buf[16]={0};
+ SendDtfmStrNumberToCat1(buf[0]);
+ const char*text_buf=label_number->GetText();
+ sprintf_s(new_buf,16,"%s%s",text_buf,buf);
+ label_number->SetText(new_buf);
+ RootView::GetInstance()->Invalidate();
+ return;
+}
+
+
UIViewGroup* CreateCallingView(void)
{
g_callingView = new UIViewGroup();
g_callingView = nullptr;
return nullptr;
}
+ Initshowdial();
+
g_callingView->Add(g_imageMicrophone);
g_callingView->Add(g_imageHandUp);
g_callingView->Add(g_imageHorns);
+
+ g_callingView->Add(g_imagedial);
+ g_callingView->Add(g_imageheadset);
+ g_callingView->Add(g_imageperson);
+
g_callingView->Add(g_callerDisplay);
- g_callingView->Add(g_callDuration);
+ //g_callingView->Add(g_callDuration);
g_callingView->Add(g_currentTimes);
g_callingView->SetDraggable(true);
g_callingView->SetTouchable(true);
+ g_callingView->Add(dial_group);
UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>\
- (OHOS::CallViewEventListener::GetInstance());
+ (OHOS::CallViewEventListener::GetInstance());
+
+
+ UIView::OnDragListener * dragListener = (UIView::OnDragListener*)OHOS::CallViewEventListener::GetInstance();
+ dial_group->SetOnDragListener(dragListener);
+
g_imageMicrophone->SetOnClickListener(clickListener);
g_imageHandUp->SetOnClickListener(clickListener);
g_imageHorns->SetOnClickListener(clickListener);
+ g_imagedial->SetOnClickListener(clickListener);
+
+
+ for( int i=0;i<12;i++)
+ {
+ labelButton[i]->SetOnClickListener(clickListener);
+ }
+
StartCallTimer(CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY, NOTIFY_ONE_SECOND);
StartCallTimer(CallTimerType::NOTIFY_PHONE_CURTIME_DISPLAY, NOTIFY_THIRTY_SECONDS);
NotificationManager::GetInstance()->SetVolumeScreenStatus(false);
RootView::GetInstance()->Remove(g_callingView);
delete g_callingView;
g_callingView = nullptr;
+
+ if(dial_group)
+ {
+ dial_group->RemoveAll();
+ for( int i=0;i<12;i++)
+ {
+ delete labelButton[i];
+ labelButton[i]=nullptr;
+ }
+ delete image_line;
+ image_line= nullptr;
+
+
+ delete label_number;
+ label_number= nullptr;
+
+ delete dial_group;
+ dial_group = nullptr;
+ }
}
if (g_volumeSetting != nullptr) {
delete g_volumeSetting;
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxxxx");
- g_volumeSetting->SetVisible(false);
- unsigned char volumeValue;
- volumeValue = (unsigned char) ((double) (g_volumeSetting->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换
- SetSpeakerVolume(volumeValue);
+ if((strcmp(view.GetViewId(), "dialing") == 0))
+ showdial(false);
+ else
+ {
+ g_volumeSetting->SetVisible(false);
+ unsigned char volumeValue;
+ volumeValue = (unsigned char) ((double) (g_volumeSetting->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换
+ SetSpeakerVolume(volumeValue);
+ }
return true;
}
else if (strcmp(view.GetViewId(), "microphoneChange") == 0) {
if (g_changeImage == 0) {
g_changeImage = 1;
- RefreshMicrophoneImageSrc(PNG_MICROPHONE_CLOSE_IMAGE_PATH);
+ RefreshMicrophoneImageSrc(PNG_230_MICROPHONE_CLOSE_IMAGE_PATH);
SetMicMute(true);
} else {
g_changeImage = 0;
- RefreshMicrophoneImageSrc(PNG_MICROPHONE_OPEN_IMAGE_PATH);
+ RefreshMicrophoneImageSrc(PNG_230_MICROPHONE_OPEN_IMAGE_PATH);
SetMicMute(false);
}
return true;
return false;
}
}
+ else if ((strcmp(view.GetViewId(), "dial") == 0))
+ {
+ showdial(true);
+ }
+ if (strcmp(view.GetViewId(), "0") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "1") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "2") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "3") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "4") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "5") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "6") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "7") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "8") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+ else if (strcmp(view.GetViewId(), "9") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }else if (strcmp(view.GetViewId(), "*") == 0)
+ {
+ text_updata_buf(view.GetViewId()); /* code */
+ }
+ else if (strcmp(view.GetViewId(), "#") == 0)
+ {
+ text_updata_buf(view.GetViewId());
+ }
+
+
+
return true;
}
} // namespace OHOS
\ No newline at end of file