2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file CallIncomingCallForm.cpp
19 * @brief Incoming Call form implementation
21 #include <FBaseColIList.h>
22 #include "CallIncomingCallForm.h"
23 #include "CallAppUtility.h"
24 #include "CallSettingsManager.h"
25 #include "CallPresentationModel.h"
26 #include "CallSceneRegister.h"
27 #include "CallTypes.h"
30 using namespace Tizen::App;
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Ui;
35 using namespace Tizen::Ui::Animations;
36 using namespace Tizen::Ui::Controls;
37 using namespace Tizen::Ui::Scenes;
40 const int W_DIAL_BITMAP = 100;
41 const int H_DIAL_BITMAP = 100;
42 const int W_CREATE_BITMAP = 56;
43 const int H_CREATE_BITMAP = 56;
44 const int X_CREATE_BITMAP = 8;
45 const int Y_CREATE_BITMAP = 8;
46 const int W_MESSAGE_BG_BITMAP = 720;
47 const int H_MESSAGE_BG_BITMAP = 110;
48 const int W_ARROW_BITMAP = 28;
49 const int H_ARROW_BITMAP = 36;
50 const int W_MESSAGE_BITMAP = 50;
51 const int H_MESSAGE_BITMAP = 50;
52 const int X_MESSAGE_BITMAP = 185;
53 const int Y_MESSAGE_BITMAP = 50;
54 const int MESSAGE_TEXT_X_MARGIN = 20;
55 const int MESSAGE_TEXT_Y_MARGIN = 10;
56 const int SEND_TEXT_X_MARGIN = 78;
57 const int SEND_TEXT_Y_MARGIN = 20;
58 const int SEND_BUTTON_ROUND_DIMENSION = 5;
59 const int W_DIAL_LABEL = 188;
60 const int H_DIAL_LABEL = 188;
61 const int DIAL_ICON_X_OFFSET = 44;
62 const int DIAL_ICON_Y_OFFSET = 44;
63 const int REJECT_LABEL_X_OFFSET = 492;
64 const int X_CALL_PANEL = 20;
65 const int Y_CALL_PANEL = 110;
66 const int H_CALL_PANEL = 188;
67 const int Y_ARROW_LABEL = 79;
68 const int W_ARROW_LABEL = 20;
69 const int H_ARROW_LABEL = 32;
70 const int VALID_TOUCH_X_OFFSET = 158;
71 const int VALID_TOUCH_Y_OFFSET = 158;
72 const int X_ARROW_LABEL_STARTPOS = 206; // 188 circle wodth , 18 GUI spec
73 const int X_ARROW_REJECT_LABEL_STARTPOS = 454; // 700 width of panel - 20 offset - 188 circle width - 18 GUI spec - 20 width of image
74 const int ARROW_LABEL_X_MARGIN = 48; //20 width of arrow and 28 GUI spec
75 const int ACCEPT_LABEL_RELATIVE_POS = -384; //relative pos of accept labels right to reject labels left
76 const int MAX_LIST_HEIGHT = 448;//678;
77 const int H_REJECT_VIEW_FOOTER = 98;
78 const int X_LIST_TEXT_ITEM = 16;
79 const int W_LIST_TEXT_ITEM = 452;
80 const int H_LIST_TEXT_ITEM = 111;
81 const int X_SEND_TEXT_ITEM = 484;
82 const int Y_SEND_TEXT_ITEM = 20;
83 const int W_SEND_TEXT_ITEM = 220;
84 const int W_SEND_BUTTON_MARGIN = 14;
85 const int H_SEND_TEXT_ITEM = 72;
86 const int X_PHOTO_LBL = 166;
87 const int Y_PHOTO_LBL = 232;
88 const int W_PHOTO_LBL = 388;
89 const int H_PHOTO_LBL = 388;
90 const int W_PHOTO_LABEL = 720;
91 const int H_PHOTO_LABEL = 720;
92 const int COUNT_ARROW_ELEMENTS = 3;
94 const unsigned int COLOR_SEND_BUTTON_PRESSED = Color32<130, 142, 150>::Value;
95 const unsigned int COLOR_SEND_BUTTON_NORMAL = Color32<64, 156, 211>::Value;
96 const unsigned int COLOR_SWIPE_PANEL = Color32<0, 0, 0, 255>::Value;
97 const unsigned int COLOR_LIST_TEXT_NORMAL = Color32<0, 0, 0>::Value;
98 const unsigned int COLOR_LIST_TEXT_PRESSED = Color32<249, 249, 249>::Value;
100 const int FONT_SIZE_MSG_TXT = 44;
102 static const wchar_t* IDL_INCOMING_CALL_FORM = L"IDL_INCOMING_CALL_FORM";
103 static const wchar_t* IDB_REJECT_MESSAGE_BG = L"C01-1_Reject_message_bg.png";
104 static const wchar_t* IDB_REJECT_MESSAGE_UP_ARROW = L"C01-1_Reject_message_arrow_01.png";
105 static const wchar_t* IDB_REJECT_MESSAGE_DOWN_ARROW = L"C01-1_Reject_message_arrow_02.png";
106 static const wchar_t* IDB_REJECT_MESSAGE_ICON = L"C01-1_icon_Reject_with_Message.png";
107 static const wchar_t* IDB_ACCEPT_CIRCLE_ICON = L"C01-1_accept_left.png";
108 static const wchar_t* IDB_REJECT_CIRCLE_ICON = L"C01-1_reject_right.png";
109 static const wchar_t* IDB_CALL_ACCEPT_ICON = L"C01-1_accept_left_dial_answer.png";
110 static const wchar_t* IDB_CALL_REJECT_ICON = L"C01-1_reject_right_dial_decline.png";
111 static const wchar_t* IDB_ACCEPT_ARROW_ICON = L"C01-1_arrow_g.png";
112 static const wchar_t* IDB_REJECT_ARROW_ICON = L"C01-1_arrow_r.png";
113 static const wchar_t* IDB_CALL_BG = L"C01-1_calling_BG_01.png";
114 static const wchar_t* IDC_REJECT_MESSAGE_BUTTON = L"IDC_REJECT_MESSAGE_BUTTON";
115 static const wchar_t* IDC_REJECT_PANEL = L"IDC_REJECT_PANEL";
116 static const wchar_t* IDC_REJECT_MESSAGE_CANCEL_BUTTON = L"IDC_REJECT_MESSAGE_CANCEL_BUTTON";
117 static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
118 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
119 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
120 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
121 static const wchar_t* IDC_CALLHANDEL_PANEL = L"IDC_CALLHANDEL_PANEL";
122 static const wchar_t* IDC_ACCEPT_LABEL = L"IDC_ACCEPT_LABEL";
123 static const wchar_t* IDC_REJECT_LEBEL = L"IDC_REJECT_LEBEL";
124 static const wchar_t* IDC_ACCEPT_ARROW = L"IDC_ACCEPT_ARROW_";
125 static const wchar_t* IDC_REJECT_ARROW = L"IDC_REJECT_ARROW_";
126 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
127 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
128 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
130 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
131 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
132 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
133 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
134 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
135 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
136 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
137 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
139 IncomingCallForm::IncomingCallForm(void)
140 : BaseForm(FORMTYPE_INCOMINGCALL)
142 __pActiveContactNo = null;
143 __pRejectMessageList = null;
144 __incomingCallHandle = -1;
145 __isAnswerCallStarted = false;
146 __isRejectCallStarted = false;
147 __pAcceptArrowLabelsList = null;
148 __pRejectArrowLabelsList = null;
149 __pRejectCircle = null;
150 __pAcceptCircle = null;
151 __pAcceptDial = null;
152 __pRejectDial = null;
153 __pAcceptArrow = null;
154 __pRejectArrow = null;
155 __pAcceptLabel = null;
156 __pRejectLabel = null;
157 __pAcceptArrowLabel = null;
158 __pRejectArrowLabel = null;
159 __pCallHandlePanel = null;
160 __pAcceptVisElem = null;
161 __pRejectVisElem = null;
162 __pRejectFinalVisElem = null;
163 __pAcceptFinalVisElem = null;
164 __pAcceptArrowVisElem = null;
165 __pRejectArrowVisElem = null;
166 __pCallPresentor = null;
167 __pOptionPopup = null;
168 __pSmallPhotoLabel = null;
171 IncomingCallForm::~IncomingCallForm(void)
176 IncomingCallForm::Initialize(void)
178 Construct(IDL_INCOMING_CALL_FORM);
182 IncomingCallForm::OnInitializing(void)
184 result r = E_SUCCESS;
185 Canvas* pCanvas = null;
190 VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
191 r = pFormVisElem->Construct();
192 pFormVisElem->SetBounds(FloatRectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
193 pFormVisElem->SetShowState(true);
194 pFormVisElem->SetOpacity(1.0f);
195 pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
196 GetVisualElement()->AttachChild(*pFormVisElem);
197 pCanvas = pFormVisElem->GetCanvasN();
201 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
202 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
203 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
210 InitializeTableView();
212 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
213 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
214 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
215 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
216 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
217 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
220 if(__pRejectDial == null)
224 //Panel for showing accept and reject call buttons.
225 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
226 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
228 __pCallHandlePanel = static_cast<Panel*>(GetControl(IDC_CALLHANDEL_PANEL, true));
229 __pCallHandlePanel->AddTouchEventListener(*this);
230 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
231 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
232 r = pCallPanelVisElem->Construct();
233 pCallPanelVisElem->SetBounds(FloatRectangle(__pCallHandlePanel->GetBoundsF()));
234 pCallPanelVisElem->SetShowState(true);
235 pCallPanelVisElem->SetOpacity(1.0f);
236 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
237 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
238 pCanvas = pCallPanelVisElem->GetCanvasN();
241 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
243 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
244 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
245 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
249 //Lock Label for animation
250 __pAcceptLabel = static_cast<Label*>(GetControl(IDC_ACCEPT_LABEL, true));
251 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
252 __pAcceptLabel->AddTouchEventListener(*this);
254 __pAcceptVisElem = new (std::nothrow) VisualElement();
255 r = __pAcceptVisElem->Construct();
256 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, __pAcceptLabel->GetWidth(), __pAcceptLabel->GetHeight()));
257 __pAcceptVisElem->SetShowState(true);
258 __pAcceptVisElem->SetOpacity(1.0f);
259 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
260 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
261 pCanvas = __pAcceptVisElem->GetCanvasN();
264 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
266 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
267 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
268 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
269 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
270 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
274 //UnLock Label for animation
275 __pRejectLabel = static_cast<Label*>(GetControl(IDC_REJECT_LEBEL, true));
276 __pRejectLabel->AddTouchEventListener(*this);
277 __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
278 SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
281 __pRejectVisElem = new (std::nothrow) VisualElement();
282 r = __pRejectVisElem->Construct();
283 __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
284 __pRejectVisElem->SetShowState(true);
285 __pRejectVisElem->SetOpacity(1.00f);
286 __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
287 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
288 pCanvas = __pRejectVisElem->GetCanvasN();
291 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
293 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
294 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
295 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
296 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
297 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
302 //! Constructs an array list to store the unlock labels
303 __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
304 r = __pAcceptArrowLabelsList->Construct();
306 //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
307 int x = X_ARROW_LABEL_STARTPOS;
308 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
310 String LabelName(IDC_ACCEPT_ARROW);
311 LabelName.Append(index+1);
312 __pAcceptArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
313 __pAcceptArrowLabel->AddTouchEventListener(*this);
314 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
315 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
316 r = __pAcceptArrowVisElem->Construct();
317 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
318 __pAcceptArrowVisElem->SetShowState(true);
319 __pAcceptArrowVisElem->SetOpacity(0.0f);
320 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
321 VisualEleName.Append(index);
322 __pAcceptArrowVisElem->SetName(VisualEleName);
323 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
324 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
327 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
329 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
330 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
331 pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
332 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
333 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
337 x += ARROW_LABEL_X_MARGIN;
339 //! Constructs an array list to store the unlock labels
340 __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
341 r = __pRejectArrowLabelsList->Construct();
343 x = X_ARROW_REJECT_LABEL_STARTPOS;
344 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
346 String LabelName(IDC_REJECT_ARROW);
347 LabelName.Append(index+1);
348 __pRejectArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
349 __pRejectArrowLabel->AddTouchEventListener(*this);
350 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
351 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
352 r = __pRejectArrowVisElem->Construct();
353 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
354 __pRejectArrowVisElem->SetShowState(true);
355 __pRejectArrowVisElem->SetOpacity(0.0f);
356 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
357 VisualEleName.Append(index);
358 __pRejectArrowVisElem->SetName(VisualEleName);
359 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
360 pCanvas = __pRejectArrowVisElem->GetCanvasN();
363 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
365 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
366 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
367 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
368 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
372 x -= ARROW_LABEL_X_MARGIN;
380 IncomingCallForm::InitializeFooter(void)
382 Footer* pFooter = GetFooter();
383 FooterItem footerItemCreate;
385 SetFormBackEventListener(this);
388 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
389 pFooter->AddActionEventListener(*this);
391 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
392 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
393 pFooter->AddItem(footerItemCreate);
394 pFooter->SetShowState(false);
399 IncomingCallForm::ShowRejectMessageFooter(void)
401 Footer* pFooter = GetFooter();
404 AppLogDebug("SetShowState");
405 pFooter->SetShowState(true);
411 IncomingCallForm::HideRejectMessageFooter(void)
413 Footer* pFooter = GetFooter();
416 pFooter->SetShowState(false);
421 IncomingCallForm::OnTerminating(void)
423 result r = E_SUCCESS;
425 if (__pRejectMessageList != null)
427 delete __pRejectMessageList;
428 __pRejectMessageList = null;
430 if (__pActiveContactNo != null)
432 delete __pActiveContactNo;
433 __pActiveContactNo = null;
435 __incomingCallHandle = -1;
436 __pCallPresentor = null;
438 /* Deleting fails in A4RC* SDK. Remove if not necessary
439 if (__pAcceptVisElem != null)
441 __pAcceptVisElem->Destroy();
442 __pAcceptVisElem = null;
445 if (__pRejectVisElem != null)
447 __pRejectVisElem->Destroy();
448 __pRejectVisElem = null;
451 if (__pRejectFinalVisElem != null)
453 __pRejectFinalVisElem->Destroy();
454 __pRejectFinalVisElem = null;
457 if (__pAcceptFinalVisElem != null)
459 __pAcceptFinalVisElem->Destroy();
460 __pAcceptFinalVisElem = null;
463 for (int i = 0; i < 7; i++)
465 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
466 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
467 if (__pRejectArrowVisElem != null)
469 __pRejectArrowVisElem->Destroy();
470 __pRejectArrowVisElem = null;
473 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
474 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
475 if (__pAcceptArrowVisElem != null)
477 __pAcceptArrowVisElem->Destroy();
478 __pAcceptArrowVisElem = null;
482 if (__pAcceptArrowVisElem != null)
484 __pAcceptArrowVisElem = null;
487 if (__pRejectArrowVisElem != null)
489 __pRejectArrowVisElem = null;
492 if (__pAcceptArrowLabelsList != null)
494 __pAcceptArrowLabelsList->RemoveAll(false);
495 delete __pAcceptArrowLabelsList;
496 __pAcceptArrowLabelsList = null;
499 if (__pRejectArrowLabelsList != null)
501 __pRejectArrowLabelsList->RemoveAll(false);
502 delete __pRejectArrowLabelsList;
503 __pRejectArrowLabelsList = null;
506 if (__pRejectCircle != null)
508 delete __pRejectCircle;
509 __pRejectCircle = null;
512 if (__pAcceptCircle != null)
514 delete __pAcceptCircle;
515 __pAcceptCircle = null;
518 if (__pAcceptDial != null)
520 delete __pAcceptDial;
521 __pAcceptDial = null;
524 if (__pRejectDial != null)
526 delete __pRejectDial;
527 __pRejectDial = null;
530 if (__pAcceptArrow != null)
532 delete __pAcceptArrow;
533 __pAcceptArrow = null;
536 if (__pRejectArrow != null)
538 delete __pRejectArrow;
539 __pRejectArrow = null;
541 __pCallHandlePanel->RemoveTouchEventListener(*this);
542 __pAcceptLabel->RemoveTouchEventListener(*this);
543 __pRejectLabel->RemoveTouchEventListener(*this);
544 __pAcceptArrowLabel->RemoveTouchEventListener(*this);
545 __pRejectArrowLabel->RemoveTouchEventListener(*this);
546 __pAcceptLabel = null;
547 __pRejectLabel = null;
548 __pAcceptArrowLabel = null;
549 __pRejectArrowLabel = null;
550 __pCallHandlePanel = null;
555 IncomingCallForm::ShowRejectMessagePanel(void)
557 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
560 pKeysPanel->SetShowState(true);
561 SetRejectMessagePanelBounds();
563 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
564 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
565 pButtonReject->AddActionEventListener(*this);
566 pButtonReject->SetEnabled(true);
567 //pButtonReject->SetFocus();
569 ShowRejectMessageFooter();
572 //pKeysPanel->SetFocus();
575 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
576 if (pButtonRejectMessage)
578 pButtonRejectMessage->SetShowState(false);
579 pButtonRejectMessage->Invalidate(true);
580 pButtonRejectMessage->Draw();
584 IncomingCallForm::HideRejectMessagePanel(void)
587 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
588 if (pButtonRejectMessage)
590 pButtonRejectMessage->SetShowState(true);
591 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
592 if (pRelativeLayout != null)
594 pRelativeLayout->SetRelation(*pButtonRejectMessage,*this,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
595 pRelativeLayout->Update();
596 delete pRelativeLayout;
602 IncomingCallForm::SetRejectMessagePanelBounds(void)
604 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
607 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
608 Rectangle tmpRect = pMessageList->GetBounds();
609 SetControlAlwaysOnTop(*pKeysPanel,true);
610 //Set Height to Reject Message Panel
611 int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
612 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
614 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
616 if (listHeight > MAX_LIST_HEIGHT)
618 listHeight = MAX_LIST_HEIGHT;
621 pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
622 pMessageList->RefreshAllItems();
623 tmpRect = pKeysPanel->GetBounds();
624 pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight);
629 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
633 case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
635 ShowRejectMessagePanel();
639 case IDA_CREATE_REJECT_CALL_MESSAGE:
641 if(__pCallPresentor->IsAppControlRunning() == false)
643 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
644 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
645 if(pCallList != null && pCallList->GetCount() > 0)
647 __pCallPresentor->HandleCallConnected(*pCallList);
654 case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
656 HideRejectMessagePanel();
660 case IDA_SEND_REJECT_MSG1:
661 case IDA_SEND_REJECT_MSG2:
662 case IDA_SEND_REJECT_MSG3:
663 case IDA_SEND_REJECT_MSG4:
664 case IDA_SEND_REJECT_MSG5:
665 case IDA_SEND_REJECT_MSG6:
667 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
670 int msgIndex = IDA_SEND_REJECT_MSG1;
671 msgIndex = actionId - msgIndex;
672 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
673 __pCallPresentor->SendMessage(textToBeSent,*__pActiveContactNo);
683 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
685 AddOrientationEventListener(*this);
686 //Get Reject list from Settings Manager
687 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
690 if (__pRejectMessageList != null)
692 delete __pRejectMessageList;
693 __pRejectMessageList = null;
695 __pRejectMessageList = pMsgMap->GetValuesN();
702 if (__pRejectMessageList != null)
704 delete __pRejectMessageList;
705 __pRejectMessageList = null;
708 //listen to Foreground events
709 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
710 pPhoneApp->AddAppStateChangeListener(*this);
711 if(__pCallPresentor == null)
713 __pCallPresentor = CallPresentationModel::GetInstance();
715 __pCallPresentor->SetTelEventListener(this);
716 //Abort any AppControl Request running already to show incoming call screen
717 if (__pCallPresentor->IsAppControlRunning() == true)
719 __pCallPresentor->AbortAppControlRequest();
724 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
726 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
728 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
730 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
733 __pAcceptVisElem->SetOpacity(1.0f);
734 __pRejectVisElem->SetOpacity(1.00f);
735 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
737 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
738 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
739 RejectVisualEleName.Append(i);
740 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
741 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
742 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
743 AcceptVisualEleName.Append(i);
744 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
748 __pAcceptArrowVisElem->SetOpacity(0.6f);
749 __pRejectArrowVisElem->SetOpacity(0.6f);
752 __pAcceptArrowVisElem->SetOpacity(0.8f);
753 __pRejectArrowVisElem->SetOpacity(0.8f);
756 __pAcceptArrowVisElem->SetOpacity(1.0f);
757 __pRejectArrowVisElem->SetOpacity(1.0f);
767 AppCallInfo* pIncomingCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
768 if (pIncomingCall != null)
770 //start alert with contact's custom ringtone
771 __pCallPresentor->StartAlert(*pIncomingCall);
772 //show contact number
774 contactNo.Append(pIncomingCall->GetContactNumber());
775 if (__pActiveContactNo)
777 delete __pActiveContactNo;
778 __pActiveContactNo = null;
780 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
781 __pActiveContactNo = new (std::nothrow) String();
783 if(contactNo.IsEmpty())
785 AppLogDebug("Number empty");
786 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
787 AppLogDebug("%ls",contactNo.GetPointer());
789 __pActiveContactNo->Append(contactNo);
790 //Show person details
791 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
792 //Check if incoming call is hidden call, then do not show "Reject with Message" button
793 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
794 if (pButtonRejectMessage)
796 //for hidden call, contact number is not present
797 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
798 pButtonRejectMessage->SetShowState(showRejectMsgButton);
799 pButtonRejectMessage->Invalidate(true);
806 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
807 pCallApp->SetTopMostWindow(true);
808 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
809 if (pButtonRejectMessage)
811 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
812 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
813 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
814 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
815 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
816 pButtonRejectMessage->AddActionEventListener(*this);
819 //This called here to handle the case when incoming call comes when
820 // add call is in foreground.
821 //Uncommenting for N_SE-50029
822 __pCallPresentor->OnAppForeground();
827 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
829 RemoveOrientationEventListener(*this);
830 if (__pSmallPhotoLabel != null)
832 RemoveControl(*__pSmallPhotoLabel);
833 __pSmallPhotoLabel = null;
835 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
837 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
838 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
839 RejectVisualEleName.Append(i);
840 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
841 __pRejectArrowVisElem->SetOpacity(0.0f);
842 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
843 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
844 AcceptVisualEleName.Append(i);
845 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
846 __pAcceptArrowVisElem->SetOpacity(0.0f);
848 if(__pAcceptLabel != null)
850 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
852 AppLogDebug("__pAcceptLabel Detatach child");
853 __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
856 if(__pRejectLabel != null)
858 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
860 AppLogDebug("__pRejectLabel Detatach child");
861 __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
865 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
866 pCallApp->RemoveAppStateChangeListener(*this);
870 IncomingCallForm::OnDraw(void)
872 Bitmap* pBackgroundWp = null;
873 // get a Canvas instance
874 Canvas* pCanvas = GetCanvasN();
876 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
883 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
887 delete pBackgroundWp;
888 pBackgroundWp = null;
897 IncomingCallForm::HideRejectPanel(void)
899 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
902 pKeysPanel->SetShowState(false);
903 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
904 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
905 pButtonReject->AddActionEventListener(*this);
906 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
907 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
908 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
909 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
911 HideRejectMessageFooter();
912 pKeysPanel->Invalidate(true);
917 IncomingCallForm::InitializeTableView(void)
919 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
920 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
921 pMessageList->SetItemProvider(this);
922 pMessageList->AddTableViewItemEventListener(*this);
925 ///////////////////////////////////////////////////////////////////////////////
926 ///// Table View Functionality supporting functions /////
927 //////////////////////////////////////////////////////////////////////////////
929 IncomingCallForm::GetItemCount(void)
931 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
933 return (__pRejectMessageList->GetCount());
939 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
942 TableViewItem* pItem = new (std::nothrow) TableViewItem();
943 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
945 //Message text item rectangle
946 //Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
947 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, itemWidth - W_SEND_BUTTON_MARGIN - W_SEND_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
950 String itemName(L"");
951 bool isShowSendButton = true;
952 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
954 __pRejectMessageList->GetAt(itemIndex, itemName);
958 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
959 isShowSendButton = false;
962 Label* pMsgLbl = new (std::nothrow) Label();
963 pMsgLbl->Construct(itemRect, itemName);
964 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
965 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
966 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
967 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
968 pItem->AddControl(pMsgLbl);
971 if(isShowSendButton == true)
973 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
974 Button* pSendButton = new (std::nothrow) Button();
975 pSendButton->Construct(Rectangle(GetClientAreaBounds().width - W_SEND_BUTTON_MARGIN -W_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
976 //set action id and listener
977 int actionId = IDA_SEND_REJECT_MSG1;
981 actionId = IDA_SEND_REJECT_MSG1;
984 actionId = IDA_SEND_REJECT_MSG2;
987 actionId = IDA_SEND_REJECT_MSG3;
990 actionId = IDA_SEND_REJECT_MSG4;
993 actionId = IDA_SEND_REJECT_MSG5;
996 actionId = IDA_SEND_REJECT_MSG6;
999 pSendButton->SetActionId(actionId);
1000 pSendButton->AddActionEventListener(*this);
1001 pItem->AddControl(*pSendButton);
1002 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1006 pItem->SetEnabled(false);
1013 IncomingCallForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1015 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, pItem->GetWidth()- W_SEND_BUTTON_MARGIN - W_SEND_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
1016 Label* pItemLbl = static_cast<Label*>(pItem->GetControl(0));
1017 if(pItemLbl != null)
1019 pItemLbl->SetBounds(itemRect);
1021 Button* pSendButton = static_cast<Button*>(pItem->GetControl(1));
1022 if(pSendButton != null)
1024 pSendButton->SetBounds(Rectangle(GetClientAreaBounds().width - W_SEND_BUTTON_MARGIN -W_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM));
1026 pItem->Invalidate(true);
1030 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1038 IncomingCallForm::GetDefaultItemHeight(void)
1040 return H_LIST_NORMAL_MENU_ITEM;
1044 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, AppCallInfo* pCallInfo)
1046 //call individual methods to show contact number, caller name & photo
1047 SetTextToLabel(phoneNumber, contactLblName);
1049 //fetch contact details based on phone number
1050 String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
1051 Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
1052 ShowCallerPhoto(pPhotoBitmap);
1057 SetTextToLabel(*pDisplayName, nameLblName);
1058 delete pDisplayName;
1059 pDisplayName = null;
1064 delete pPhotoBitmap;
1065 pPhotoBitmap = null;
1070 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1072 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1073 //passing an empty string to SetText fails in label,
1074 //if previously valid text has been set
1075 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1077 String stringToBeSet(L"");
1078 pContactLbl->SetText(stringToBeSet);
1083 pContactLbl->SetText(textToBeSet);
1088 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1090 bool showSmallPhoto = false;
1091 //show photo - for Big Photo Id, Animated Call Image
1092 if (pPhotoId == null)
1094 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1098 //Check the size of photo
1099 // Now checking the condition with && but actually it should be ||
1100 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1101 // height 270 and width = 480 . So all images set thru gallery is show as small image
1102 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1103 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1105 showSmallPhoto = true;
1109 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1110 if(showSmallPhoto == true)
1112 ShowThumbnailImage(pPhotoId);
1116 if (pPhotoLbl != null && pPhotoId != null)
1118 Canvas* pCanvas = new (std::nothrow) Canvas;
1119 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1120 pCanvas->Construct(canvasRect);
1121 //draw the contact bitmap
1122 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1123 Bitmap* pNewPhotoId = new Bitmap();
1124 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1127 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1128 pPhotoLbl->Invalidate(true);
1135 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1137 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1139 if (pPhotoLbl != null && pPhotoId != null)
1141 Canvas* pCanvas = new (std::nothrow) Canvas;
1142 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1143 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1144 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1145 pCanvas->Construct(canvasRect);
1146 //draw the back ground
1147 pCanvas->DrawBitmap(canvasRect,*pBackground);
1148 //draw shadow (to be enabled after correct shadow image is provided )
1149 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1150 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1151 //draw the contact bitmap
1152 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1153 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1154 Bitmap* pNewPhotoId = new Bitmap();
1155 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1158 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1159 pPhotoLbl->Invalidate(true);
1168 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1170 //Draw Small Photo and show on small photo label
1171 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1172 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1173 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1174 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1175 // Add a Label to the Form
1176 AddControl(*__pSmallPhotoLabel);
1177 __pSmallPhotoLabel->Invalidate(true);
1181 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1183 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1184 if (pTimerLbl != null)
1186 pTimerLbl->SetText(textToBeDisplayed);
1191 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1192 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1195 Button* pButton = null;
1196 if (isButtonInPanel == false)
1198 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1202 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1203 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1205 Bitmap* pHoldBmp = null;
1206 Canvas* pCanvas = null;
1207 pCanvas = new (std::nothrow) Canvas();
1208 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1209 //set bitmap to button
1210 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1213 //scale bitmap to predefined size
1214 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1215 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1216 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1220 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1223 //scale bitmap to predefined size
1224 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1225 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1226 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1234 String holdBtnName = AppUtility::GetResourceString(btnName);
1235 FloatDimension textDimension;
1236 if (!holdBtnName.IsEmpty())
1239 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1240 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1241 textDimension.height = textDimension.height + font.GetDescender();
1242 TextElement* pTextElement = new (std::nothrow) TextElement();
1243 pTextElement->Construct(holdBtnName);
1244 Color textColor(249, 249, 249);
1245 if (setButtonPressBitmap)
1247 textColor.SetAlpha(255);
1251 textColor.SetAlpha(127);
1254 pTextElement->SetTextColor(textColor);
1255 pTextElement->SetFont(font);
1257 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1258 pEnrichedText->Construct(textDimension);
1259 pEnrichedText->Add(*pTextElement);
1260 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1261 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1262 pCanvas->DrawText(textPos, *pEnrichedText);
1264 pEnrichedText->RemoveAll(true);
1265 delete pEnrichedText;
1269 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1272 //scale bitmap to predefined size
1273 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1274 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1275 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1276 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1279 //set background bitmpa to button
1280 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1281 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1282 if (setButtonPressBitmap)
1284 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1288 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1290 delete pActualBgBmp;
1295 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1298 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1300 //__pCallPresentor->StopAlert();
1301 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1303 Rectangle rect = source.GetBounds();
1304 if (source.Equals(*__pAcceptLabel))
1306 __isAnswerCallStarted = true;
1307 __isRejectCallStarted = false;
1309 else if (source.Equals(*__pRejectLabel))
1311 __isAnswerCallStarted = false;
1312 __isRejectCallStarted = true;
1316 // touch event between the 2 labels. So Do nothing
1323 // On Touch released, the animation and the visual elements disappear
1325 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1327 AppLogDebug("%d",currentPosition.x);
1328 if (__isAnswerCallStarted == true)
1330 if (currentPosition.x > __pRejectLabel->GetBounds().x)
1333 if(__pRejectFinalVisElem == null)
1335 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1336 __pRejectFinalVisElem->Construct();
1337 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1339 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1340 __pRejectFinalVisElem->SetShowState(true);
1341 __pRejectFinalVisElem->SetOpacity(1.00f);
1342 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1344 AppLogDebug("AttachChild __pRejectFinalVisElem");
1345 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1347 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1350 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1351 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1352 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1353 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1357 __pAcceptVisElem->SetOpacity(0.0f);
1358 //fetch already active call list
1359 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1360 if (pCallList != null && pCallList->GetCount() > 0)
1362 //then atleast 1 active call exist.
1363 AppCallInfo phnCallInfo;
1364 pCallList->GetAt(0,phnCallInfo);
1365 //Check if only 1 call exist and it is on Hold
1366 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1368 //directly accept call
1369 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1373 //Either 1 call exist and not "on Hold".
1375 if(__pOptionPopup != null)
1377 delete __pOptionPopup;
1378 __pOptionPopup = null;
1380 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1381 __pOptionPopup->Initialize();
1382 __pOptionPopup->SetShowState(true);
1383 __pOptionPopup->Draw();
1384 __pOptionPopup->Show();
1386 pCallList->RemoveAll();
1390 //no active call - Accept the incoming call
1391 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1398 __pAcceptVisElem->SetOpacity(1.0f);
1399 __pRejectVisElem->SetOpacity(1.00f);
1403 else if (__isRejectCallStarted == true)
1405 if (currentPosition.x < ((__pAcceptLabel->GetBounds().x + __pAcceptLabel->GetWidth())- __pRejectLabel->GetBounds().x))
1408 if(__pAcceptFinalVisElem == null)
1410 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1411 __pAcceptFinalVisElem->Construct();
1412 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1414 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1415 __pAcceptFinalVisElem->SetOpacity(1.0f);
1418 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1420 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1421 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1423 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1426 AppLogDebug("__pAcceptFinalVisElem drawing");
1427 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1428 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1429 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1430 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1431 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1434 __pRejectVisElem->SetOpacity(0.0f);
1436 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1440 __pAcceptVisElem->SetOpacity(1.0f);
1441 __pRejectVisElem->SetOpacity(1.00f);
1445 __isAnswerCallStarted = false;
1446 __isRejectCallStarted = false;
1450 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1452 if (__isAnswerCallStarted == true)
1454 if (currentPosition.x > 170 && currentPosition.x < 578)
1456 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1458 __pRejectVisElem->SetOpacity(0.60f);
1459 __pAcceptVisElem->SetOpacity(0.60f);
1463 __pRejectVisElem->SetOpacity(1.0f);
1464 __pAcceptVisElem->SetOpacity(1.0f);
1469 if (__isRejectCallStarted == true)
1471 if (currentPosition.x < 0 && currentPosition.x > -522)
1473 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1475 __pRejectVisElem->SetOpacity(0.60f);
1476 __pAcceptVisElem->SetOpacity(0.60f);
1480 __pRejectVisElem->SetOpacity(1.0f);
1481 __pAcceptVisElem->SetOpacity(1.0f);
1488 IncomingCallForm::OnItemSelected(int itemIndex)
1490 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1493 //display name, mobile number
1494 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1495 pArgs->Add(argIndex);
1496 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1500 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1502 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1504 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1506 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1508 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1511 __pAcceptVisElem->SetOpacity(1.0f);
1512 __pRejectVisElem->SetOpacity(1.00f);
1514 if (__pRejectFinalVisElem != null)
1516 __pRejectFinalVisElem->Destroy();
1517 __pRejectFinalVisElem = null;
1519 if (__pAcceptFinalVisElem != null)
1521 __pAcceptFinalVisElem->Destroy();
1522 __pAcceptFinalVisElem = null;
1527 delete __pOptionPopup;
1528 __pOptionPopup = null;
1531 if(itemIndex != IDA_BUTTON_CANCEL_OPTIONS_POPUP)
1533 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1538 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1542 case REQUEST_ITEM_SELECTED:
1546 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1549 HandleMultipleCallSelection(index->ToInt());
1558 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1560 AppLogDebug("Enter");
1563 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1564 if (pButtonRejectMessage)
1566 pButtonRejectMessage->SetShowState(true);
1567 pButtonRejectMessage->Invalidate(true);
1568 pButtonRejectMessage->Draw();
1570 RequestRedraw(true);
1575 IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1577 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1578 if(pKeysPanel->GetShowState() == true)
1580 //HideRejectMessagePanel();
1581 //ShowRejectMessagePanel();
1582 SetRejectMessagePanelBounds();
1585 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1586 if (pButtonRejectMessage != null)
1588 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1589 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
1590 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1591 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
1592 pButtonRejectMessage->Invalidate(true);
1595 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1596 if (pButtonReject != null)
1598 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1599 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
1600 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1601 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
1602 pButtonReject->Invalidate(true);
1607 IncomingCallForm::OnForeground(void)
1609 AppLogDebug("Enter");
1610 //This is done so that when in IncomingCallForm and calloptionpopup is shown , now if
1611 // focus goes away from popup by pressing cancel key from the host keyboard the focus shouldnt get lost
1612 // but should focus the Reject message button immediately.
1613 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1614 pButtonRejectMessage->SetFocus();
1615 pButtonRejectMessage->Invalidate(true);
1616 __pCallPresentor->OnAppForeground();
1620 IncomingCallForm::OnScreenOff(void)
1622 __pCallPresentor->StopAlert();
1626 IncomingCallForm::CallDisconnected(void)
1628 //check if no call option popup is shown, then remain on incoming call screen.
1629 //As user has neither accepted nor rejected incoming call.
1630 if ((__pOptionPopup == null) || (__pOptionPopup->GetShowState() == false))
1635 //fetch already active call list and show updated option popup
1636 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1637 if (pCallList != null && pCallList->GetCount() > 0)
1639 //then atleast 1 active call exist.
1640 AppCallInfo phnCallInfo;
1641 pCallList->GetAt(0,phnCallInfo);
1642 //Check if only 1 call exist and it is on Hold
1643 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1645 //directly accept call
1646 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1650 //Either 1 call exist and not "on Hold".
1652 if(__pOptionPopup != null)
1654 delete __pOptionPopup;
1655 __pOptionPopup = null;
1657 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1658 __pOptionPopup->Initialize();
1659 __pOptionPopup->SetShowState(true);
1660 __pOptionPopup->Draw();
1661 __pOptionPopup->Show();
1663 pCallList->RemoveAll();
1667 //no active call - Accept the incoming call
1668 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);