2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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 <FMessaging.h>
23 #include "CallIncomingCallForm.h"
24 #include "CallAppUtility.h"
25 #include "CallSettingsManager.h"
26 #include "CallPresentationModel.h"
27 #include "CallSceneRegister.h"
28 #include "CallTypes.h"
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Messaging;
36 using namespace Tizen::Ui;
37 using namespace Tizen::Ui::Animations;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
42 const int W_DIAL_BITMAP = 100;
43 const int H_DIAL_BITMAP = 100;
44 const int W_CREATE_BITMAP = 56;
45 const int H_CREATE_BITMAP = 56;
46 const int X_CREATE_BITMAP = 8;
47 const int Y_CREATE_BITMAP = 8;
48 const int W_MESSAGE_BG_BITMAP = 720;
49 const int H_MESSAGE_BG_BITMAP = 110;
50 const int W_ARROW_BITMAP = 28;
51 const int H_ARROW_BITMAP = 36;
52 const int W_MESSAGE_BITMAP = 50;
53 const int H_MESSAGE_BITMAP = 50;
54 const int X_MESSAGE_BITMAP = 185;
55 const int Y_MESSAGE_BITMAP = 50;
56 const int MESSAGE_TEXT_X_MARGIN = 20;
57 const int MESSAGE_TEXT_Y_MARGIN = 10;
58 const int SEND_TEXT_X_MARGIN = 78;
59 const int SEND_TEXT_Y_MARGIN = 20;
60 const int SEND_BUTTON_ROUND_DIMENSION = 5;
61 const int W_DIAL_LABEL = 188;
62 const int H_DIAL_LABEL = 188;
63 const int DIAL_ICON_X_OFFSET = 44;
64 const int DIAL_ICON_Y_OFFSET = 44;
65 const int REJECT_LABEL_X_OFFSET = 492;
66 const int X_CALL_PANEL = 20;
67 const int Y_CALL_PANEL = 110;
68 const int H_CALL_PANEL = 188;
69 const int Y_ARROW_LABEL = 79;
70 const int W_ARROW_LABEL = 20;
71 const int H_ARROW_LABEL = 32;
72 const int VALID_TOUCH_X_OFFSET = 158;
73 const int VALID_TOUCH_Y_OFFSET = 158;
74 const int X_ARROW_LABEL_STARTPOS = 206; // 188 circle wodth , 18 GUI spec
75 const int X_ARROW_REJECT_LABEL_STARTPOS = 454; // 700 width of panel - 20 offset - 188 circle width - 18 GUI spec - 20 width of image
76 const int ARROW_LABEL_X_MARGIN = 48; //20 width of arrow and 28 GUI spec
77 const int ACCEPT_LABEL_RELATIVE_POS = -384; //relative pos of accept labels right to reject labels left
78 const int MAX_LIST_HEIGHT = 448;//678;
79 const int H_REJECT_VIEW_FOOTER = 98;
80 const int X_LIST_TEXT_ITEM = 16;
81 const int W_LIST_TEXT_ITEM = 452;
82 const int H_LIST_TEXT_ITEM = 111;
83 const int X_SEND_TEXT_ITEM = 484;
84 const int Y_SEND_TEXT_ITEM = 20;
85 const int W_SEND_TEXT_ITEM = 220;
86 const int W_SEND_BUTTON_MARGIN = 14;
87 const int H_SEND_TEXT_ITEM = 72;
88 const int X_PHOTO_LBL = 166;
89 const int Y_PHOTO_LBL = 232;
90 const int W_PHOTO_LBL = 388;
91 const int H_PHOTO_LBL = 388;
92 const int W_PHOTO_LABEL = 720;
93 const int H_PHOTO_LABEL = 720;
94 const int COUNT_ARROW_ELEMENTS = 3;
96 const unsigned int COLOR_SEND_BUTTON_PRESSED = Color32<130, 142, 150>::Value;
97 const unsigned int COLOR_SEND_BUTTON_NORMAL = Color32<64, 156, 211>::Value;
98 const unsigned int COLOR_SWIPE_PANEL = Color32<0, 0, 0, 255>::Value;
99 const unsigned int COLOR_LIST_TEXT_NORMAL = Color32<0, 0, 0>::Value;
100 const unsigned int COLOR_LIST_TEXT_PRESSED = Color32<249, 249, 249>::Value;
102 const int FONT_SIZE_MSG_TXT = 44;
104 static const wchar_t* IDL_INCOMING_CALL_FORM = L"IDL_INCOMING_CALL_FORM";
105 static const wchar_t* IDB_REJECT_MESSAGE_BG = L"C01-1_Reject_message_bg.png";
106 static const wchar_t* IDB_REJECT_MESSAGE_UP_ARROW = L"C01-1_Reject_message_arrow_01.png";
107 static const wchar_t* IDB_REJECT_MESSAGE_DOWN_ARROW = L"C01-1_Reject_message_arrow_02.png";
108 static const wchar_t* IDB_REJECT_MESSAGE_ICON = L"C01-1_icon_Reject_with_Message.png";
109 static const wchar_t* IDB_ACCEPT_CIRCLE_ICON = L"C01-1_accept_left.png";
110 static const wchar_t* IDB_REJECT_CIRCLE_ICON = L"C01-1_reject_right.png";
111 static const wchar_t* IDB_CALL_ACCEPT_ICON = L"C01-1_accept_left_dial_answer.png";
112 static const wchar_t* IDB_CALL_REJECT_ICON = L"C01-1_reject_right_dial_decline.png";
113 static const wchar_t* IDB_ACCEPT_ARROW_ICON = L"C01-1_arrow_g.png";
114 static const wchar_t* IDB_REJECT_ARROW_ICON = L"C01-1_arrow_r.png";
115 static const wchar_t* IDB_CALL_BG = L"C01-1_calling_BG_01.png";
116 static const wchar_t* IDC_REJECT_MESSAGE_BUTTON = L"IDC_REJECT_MESSAGE_BUTTON";
117 static const wchar_t* IDC_REJECT_PANEL = L"IDC_REJECT_PANEL";
118 static const wchar_t* IDC_REJECT_MESSAGE_CANCEL_BUTTON = L"IDC_REJECT_MESSAGE_CANCEL_BUTTON";
119 static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
120 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
121 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
122 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
123 static const wchar_t* IDC_CALLHANDEL_PANEL = L"IDC_CALLHANDEL_PANEL";
124 static const wchar_t* IDC_ACCEPT_LABEL = L"IDC_ACCEPT_LABEL";
125 static const wchar_t* IDC_REJECT_LEBEL = L"IDC_REJECT_LEBEL";
126 static const wchar_t* IDC_ACCEPT_ARROW = L"IDC_ACCEPT_ARROW_";
127 static const wchar_t* IDC_REJECT_ARROW = L"IDC_REJECT_ARROW_";
128 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
129 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
130 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
132 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
133 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
134 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
135 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
136 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
137 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
138 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
139 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
143 , public ISmsListener
146 void OnSmsMessageSent(result r)
151 IncomingCallForm::IncomingCallForm(void)
152 : BaseForm(FORMTYPE_INCOMINGCALL)
154 __pActiveContactNo = null;
155 __pRejectMessageList = null;
156 __incomingCallHandle = -1;
157 __isAnswerCallStarted = false;
158 __isRejectCallStarted = false;
159 __pAcceptArrowLabelsList = null;
160 __pRejectArrowLabelsList = null;
161 __pRejectCircle = null;
162 __pAcceptCircle = null;
163 __pAcceptDial = null;
164 __pRejectDial = null;
165 __pAcceptArrow = null;
166 __pRejectArrow = null;
167 __pAcceptLabel = null;
168 __pRejectLabel = null;
169 __pAcceptArrowLabel = null;
170 __pRejectArrowLabel = null;
171 __pCallHandlePanel = null;
172 __pAcceptVisElem = null;
173 __pRejectVisElem = null;
174 __pRejectFinalVisElem = null;
175 __pAcceptFinalVisElem = null;
176 __pAcceptArrowVisElem = null;
177 __pRejectArrowVisElem = null;
178 __pCallPresentor = null;
179 __pOptionPopup = null;
180 __pSmallPhotoLabel = null;
183 IncomingCallForm::~IncomingCallForm(void)
188 IncomingCallForm::Initialize(void)
190 Construct(IDL_INCOMING_CALL_FORM);
194 IncomingCallForm::OnInitializing(void)
196 result r = E_SUCCESS;
197 Canvas* pCanvas = null;
202 VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
203 r = pFormVisElem->Construct();
204 pFormVisElem->SetBounds(FloatRectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
205 pFormVisElem->SetShowState(true);
206 pFormVisElem->SetOpacity(1.0f);
207 pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
208 GetVisualElement()->AttachChild(*pFormVisElem);
209 pCanvas = pFormVisElem->GetCanvasN();
213 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
214 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
215 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
221 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
222 if (pButtonRejectMessage)
224 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
225 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
226 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
227 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
228 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
229 pButtonRejectMessage->AddActionEventListener(*this);
232 //Get Reject list from Settings Manager
233 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
236 __pRejectMessageList = pMsgMap->GetValuesN();
240 InitializeTableView();
242 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
243 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
244 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
245 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
246 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
247 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
250 if(__pRejectDial == null)
254 //Panel for showing accept and reject call buttons.
255 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
256 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
258 __pCallHandlePanel = static_cast<Panel*>(GetControl(IDC_CALLHANDEL_PANEL, true));
259 __pCallHandlePanel->AddTouchEventListener(*this);
260 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
261 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
262 r = pCallPanelVisElem->Construct();
263 pCallPanelVisElem->SetBounds(FloatRectangle(__pCallHandlePanel->GetBoundsF()));
264 pCallPanelVisElem->SetShowState(true);
265 pCallPanelVisElem->SetOpacity(1.0f);
266 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
267 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
268 pCanvas = pCallPanelVisElem->GetCanvasN();
271 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
273 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
274 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
275 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
279 //Lock Label for animation
280 __pAcceptLabel = static_cast<Label*>(GetControl(IDC_ACCEPT_LABEL, true));
281 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
282 __pAcceptLabel->AddTouchEventListener(*this);
284 __pAcceptVisElem = new (std::nothrow) VisualElement();
285 r = __pAcceptVisElem->Construct();
286 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, __pAcceptLabel->GetWidth(), __pAcceptLabel->GetHeight()));
287 __pAcceptVisElem->SetShowState(true);
288 __pAcceptVisElem->SetOpacity(1.0f);
289 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
290 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
291 pCanvas = __pAcceptVisElem->GetCanvasN();
294 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
296 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
297 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
298 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
299 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
300 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
304 //UnLock Label for animation
305 __pRejectLabel = static_cast<Label*>(GetControl(IDC_REJECT_LEBEL, true));
306 __pRejectLabel->AddTouchEventListener(*this);
307 __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
308 SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
311 __pRejectVisElem = new (std::nothrow) VisualElement();
312 r = __pRejectVisElem->Construct();
313 __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
314 __pRejectVisElem->SetShowState(true);
315 __pRejectVisElem->SetOpacity(1.00f);
316 __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
317 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
318 pCanvas = __pRejectVisElem->GetCanvasN();
321 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
323 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
324 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
325 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
326 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
327 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
332 //! Constructs an array list to store the unlock labels
333 __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
334 r = __pAcceptArrowLabelsList->Construct();
336 //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
337 int x = X_ARROW_LABEL_STARTPOS;
338 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
340 String LabelName(IDC_ACCEPT_ARROW);
341 LabelName.Append(index+1);
342 __pAcceptArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
343 __pAcceptArrowLabel->AddTouchEventListener(*this);
344 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
345 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
346 r = __pAcceptArrowVisElem->Construct();
347 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
348 __pAcceptArrowVisElem->SetShowState(true);
349 __pAcceptArrowVisElem->SetOpacity(0.0f);
350 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
351 VisualEleName.Append(index);
352 __pAcceptArrowVisElem->SetName(VisualEleName);
353 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
354 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
357 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
359 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
360 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
361 pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
362 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
363 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
367 x += ARROW_LABEL_X_MARGIN;
369 //! Constructs an array list to store the unlock labels
370 __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
371 r = __pRejectArrowLabelsList->Construct();
373 x = X_ARROW_REJECT_LABEL_STARTPOS;
374 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
376 String LabelName(IDC_REJECT_ARROW);
377 LabelName.Append(index+1);
378 __pRejectArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
379 __pRejectArrowLabel->AddTouchEventListener(*this);
380 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
381 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
382 r = __pRejectArrowVisElem->Construct();
383 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
384 __pRejectArrowVisElem->SetShowState(true);
385 __pRejectArrowVisElem->SetOpacity(0.0f);
386 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
387 VisualEleName.Append(index);
388 __pRejectArrowVisElem->SetName(VisualEleName);
389 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
390 pCanvas = __pRejectArrowVisElem->GetCanvasN();
393 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
395 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
396 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
397 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
398 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
402 x -= ARROW_LABEL_X_MARGIN;
410 IncomingCallForm::InitializeFooter(void)
412 Footer* pFooter = GetFooter();
413 FooterItem footerItemCreate;
415 SetFormBackEventListener(this);
418 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
419 pFooter->AddActionEventListener(*this);
421 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
422 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
423 pFooter->AddItem(footerItemCreate);
424 pFooter->SetBackButton();
425 pFooter->SetShowState(false);
430 IncomingCallForm::ShowRejectMessageFooter(void)
432 Footer* pFooter = GetFooter();
435 AppLogDebug("SetShowState");
436 pFooter->SetShowState(true);
442 IncomingCallForm::HideRejectMessageFooter(void)
444 Footer* pFooter = GetFooter();
447 pFooter->SetShowState(false);
452 IncomingCallForm::OnTerminating(void)
454 result r = E_SUCCESS;
456 if (__pRejectMessageList != null)
458 delete __pRejectMessageList;
459 __pRejectMessageList = null;
461 if (__pActiveContactNo != null)
463 delete __pActiveContactNo;
464 __pActiveContactNo = null;
466 __incomingCallHandle = -1;
467 __pCallPresentor = null;
469 /* Deleting fails in A4RC* SDK. Remove if not necessary
470 if (__pAcceptVisElem != null)
472 __pAcceptVisElem->Destroy();
473 __pAcceptVisElem = null;
476 if (__pRejectVisElem != null)
478 __pRejectVisElem->Destroy();
479 __pRejectVisElem = null;
482 if (__pRejectFinalVisElem != null)
484 __pRejectFinalVisElem->Destroy();
485 __pRejectFinalVisElem = null;
488 if (__pAcceptFinalVisElem != null)
490 __pAcceptFinalVisElem->Destroy();
491 __pAcceptFinalVisElem = null;
494 for (int i = 0; i < 7; i++)
496 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
497 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
498 if (__pRejectArrowVisElem != null)
500 __pRejectArrowVisElem->Destroy();
501 __pRejectArrowVisElem = null;
504 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
505 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
506 if (__pAcceptArrowVisElem != null)
508 __pAcceptArrowVisElem->Destroy();
509 __pAcceptArrowVisElem = null;
513 if (__pAcceptArrowVisElem != null)
515 __pAcceptArrowVisElem = null;
518 if (__pRejectArrowVisElem != null)
520 __pRejectArrowVisElem = null;
523 if (__pAcceptArrowLabelsList != null)
525 __pAcceptArrowLabelsList->RemoveAll(false);
526 delete __pAcceptArrowLabelsList;
527 __pAcceptArrowLabelsList = null;
530 if (__pRejectArrowLabelsList != null)
532 __pRejectArrowLabelsList->RemoveAll(false);
533 delete __pRejectArrowLabelsList;
534 __pRejectArrowLabelsList = null;
537 if (__pRejectCircle != null)
539 delete __pRejectCircle;
540 __pRejectCircle = null;
543 if (__pAcceptCircle != null)
545 delete __pAcceptCircle;
546 __pAcceptCircle = null;
549 if (__pAcceptDial != null)
551 delete __pAcceptDial;
552 __pAcceptDial = null;
555 if (__pRejectDial != null)
557 delete __pRejectDial;
558 __pRejectDial = null;
561 if (__pAcceptArrow != null)
563 delete __pAcceptArrow;
564 __pAcceptArrow = null;
567 if (__pRejectArrow != null)
569 delete __pRejectArrow;
570 __pRejectArrow = null;
572 __pCallHandlePanel->RemoveTouchEventListener(*this);
573 __pAcceptLabel->RemoveTouchEventListener(*this);
574 __pRejectLabel->RemoveTouchEventListener(*this);
575 __pAcceptArrowLabel->RemoveTouchEventListener(*this);
576 __pRejectArrowLabel->RemoveTouchEventListener(*this);
577 __pAcceptLabel = null;
578 __pRejectLabel = null;
579 __pAcceptArrowLabel = null;
580 __pRejectArrowLabel = null;
581 __pCallHandlePanel = null;
586 IncomingCallForm::ShowRejectMessagePanel(void)
588 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
591 pKeysPanel->SetShowState(true);
592 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
593 Rectangle tmpRect = pMessageList->GetBounds();
594 SetControlAlwaysOnTop(*pKeysPanel,true);
596 //Set Height to Reject Message Panel
597 int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
598 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
600 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
602 if (listHeight > MAX_LIST_HEIGHT)
604 listHeight = MAX_LIST_HEIGHT;
607 pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
608 pMessageList->UpdateTableView();
609 tmpRect = pKeysPanel->GetBounds();
610 pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight);
612 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
613 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
614 pButtonReject->AddActionEventListener(*this);
615 pButtonReject->SetEnabled(true);
616 pButtonReject->SetFocus();
618 ShowRejectMessageFooter();
621 pKeysPanel->SetFocus();
624 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
625 if (pButtonRejectMessage)
627 pButtonRejectMessage->SetShowState(false);
628 pButtonRejectMessage->Invalidate(true);
629 pButtonRejectMessage->Draw();
633 IncomingCallForm::HideRejectMessagePanel(void)
636 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
637 if (pButtonRejectMessage)
639 pButtonRejectMessage->SetShowState(true);
640 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
641 if (pRelativeLayout != null)
643 pRelativeLayout->SetRelation(*pButtonRejectMessage,*this,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
644 pRelativeLayout->Update();
645 delete pRelativeLayout;
651 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
655 case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
657 ShowRejectMessagePanel();
661 case IDA_CREATE_REJECT_CALL_MESSAGE:
663 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
664 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
665 if(pCallList != null && pCallList->GetCount() > 0)
667 __pCallPresentor->HandleCallConnected(*pCallList);
673 case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
675 HideRejectMessagePanel();
679 case IDA_SEND_REJECT_MSG1:
680 case IDA_SEND_REJECT_MSG2:
681 case IDA_SEND_REJECT_MSG3:
682 case IDA_SEND_REJECT_MSG4:
683 case IDA_SEND_REJECT_MSG5:
684 case IDA_SEND_REJECT_MSG6:
686 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
687 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
688 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
689 result r = pSmsManager->Construct(*pSmsListener);
690 if (IsFailed(r) == false)
692 RecipientList recipient;
693 recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
694 SmsMessage smsMessage;
697 int msgIndex = IDA_SEND_REJECT_MSG1;
698 msgIndex = actionId - msgIndex;
699 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
700 r = smsMessage.SetText(textToBeSent);
701 if (IsFailed(r) == false)
703 r = pSmsManager->Send(smsMessage,recipient,true);
704 if (IsFailed(r) == true)
706 //todo: error message
711 //todo: error message
716 //todo: error message
720 /*ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
721 __pCallPresentor->HandleCallConnected(*pCallList);
732 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
734 AddOrientationEventListener(*this);
735 //listen to Foreground events
736 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
737 pPhoneApp->AddAppStateChangeListener(*this);
738 if(__pCallPresentor == null)
740 __pCallPresentor = CallPresentationModel::GetInstance();
742 __pCallPresentor->SetTelEventListener(this);
745 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
747 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
749 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
751 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
754 __pAcceptVisElem->SetOpacity(1.0f);
755 __pRejectVisElem->SetOpacity(1.00f);
756 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
758 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
759 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
760 RejectVisualEleName.Append(i);
761 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
762 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
763 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
764 AcceptVisualEleName.Append(i);
765 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
769 __pAcceptArrowVisElem->SetOpacity(0.6f);
770 __pRejectArrowVisElem->SetOpacity(0.6f);
773 __pAcceptArrowVisElem->SetOpacity(0.8f);
774 __pRejectArrowVisElem->SetOpacity(0.8f);
777 __pAcceptArrowVisElem->SetOpacity(1.0f);
778 __pRejectArrowVisElem->SetOpacity(1.0f);
788 AppCallInfo* pIncomingCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
789 if (pIncomingCall != null)
791 //start alert with contact's custom ringtone
792 __pCallPresentor->StartAlert(*pIncomingCall);
793 //show contact number
795 contactNo.Append(pIncomingCall->GetContactNumber());
796 if (__pActiveContactNo)
798 delete __pActiveContactNo;
799 __pActiveContactNo = null;
801 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
802 __pActiveContactNo = new (std::nothrow) String();
804 if(contactNo.IsEmpty())
806 AppLogDebug("Number empty");
807 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
808 AppLogDebug("%ls",contactNo.GetPointer());
810 __pActiveContactNo->Append(contactNo);
811 //Show person details
812 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
813 //Check if incoming call is hidden call, then do not show "Reject with Message" button
814 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
815 if (pButtonRejectMessage)
817 //for hidden call, contact number is not present
818 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
819 pButtonRejectMessage->SetShowState(showRejectMsgButton);
820 pButtonRejectMessage->Invalidate(true);
827 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
828 pCallApp->SetTopMostWindow(true);
834 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
836 RemoveOrientationEventListener(*this);
837 if (__pSmallPhotoLabel != null)
839 RemoveControl(*__pSmallPhotoLabel);
840 __pSmallPhotoLabel = null;
842 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
844 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
845 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
846 RejectVisualEleName.Append(i);
847 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
848 __pRejectArrowVisElem->SetOpacity(0.0f);
849 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
850 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
851 AcceptVisualEleName.Append(i);
852 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
853 __pAcceptArrowVisElem->SetOpacity(0.0f);
855 if(__pAcceptLabel != null)
857 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
859 AppLogDebug("__pAcceptLabel Detatach child");
860 __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
863 if(__pRejectLabel != null)
865 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
867 AppLogDebug("__pRejectLabel Detatach child");
868 __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
872 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
873 pCallApp->SetTopMostWindow(false);
874 pCallApp->RemoveAppStateChangeListener(*this);
878 IncomingCallForm::OnDraw(void)
880 Bitmap* pBackgroundWp = null;
881 // get a Canvas instance
882 Canvas* pCanvas = GetCanvasN();
884 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
891 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
895 delete pBackgroundWp;
896 pBackgroundWp = null;
905 IncomingCallForm::HideRejectPanel(void)
907 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
910 pKeysPanel->SetShowState(false);
911 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
912 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
913 pButtonReject->AddActionEventListener(*this);
914 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
915 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
916 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
917 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
919 HideRejectMessageFooter();
920 pKeysPanel->Invalidate(true);
925 IncomingCallForm::InitializeTableView(void)
927 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
929 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
930 pMessageList->SetItemProvider(this);
931 pMessageList->AddTableViewItemEventListener(*this);
934 ///////////////////////////////////////////////////////////////////////////////
935 ///// Table View Functionality supporting functions /////
936 //////////////////////////////////////////////////////////////////////////////
938 IncomingCallForm::GetItemCount(void)
940 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
942 return (__pRejectMessageList->GetCount());
948 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
951 TableViewItem* pItem = new (std::nothrow) TableViewItem();
952 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
954 //Message text item rectangle
955 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
958 String itemName(L"");
959 bool isShowSendButton = true;
960 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
962 __pRejectMessageList->GetAt(itemIndex, itemName);
966 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
967 isShowSendButton = false;
970 Label* pMsgLbl = new (std::nothrow) Label();
971 pMsgLbl->Construct(itemRect, itemName);
972 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
973 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
974 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
975 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
976 pItem->AddControl(*pMsgLbl);
979 if(isShowSendButton == true)
981 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
982 Button* pSendButton = new (std::nothrow) Button();
983 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);
984 //set action id and listener
985 int actionId = IDA_SEND_REJECT_MSG1;
989 actionId = IDA_SEND_REJECT_MSG1;
992 actionId = IDA_SEND_REJECT_MSG2;
995 actionId = IDA_SEND_REJECT_MSG3;
998 actionId = IDA_SEND_REJECT_MSG4;
1001 actionId = IDA_SEND_REJECT_MSG5;
1004 actionId = IDA_SEND_REJECT_MSG6;
1007 pSendButton->SetActionId(actionId);
1008 pSendButton->AddActionEventListener(*this);
1009 pItem->AddControl(*pSendButton);
1010 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1014 pItem->SetEnabled(false);
1021 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1029 IncomingCallForm::GetDefaultItemHeight(void)
1031 return H_LIST_NORMAL_MENU_ITEM;
1035 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, AppCallInfo* pCallInfo)
1037 //call individual methods to show contact number, caller name & photo
1038 SetTextToLabel(phoneNumber, contactLblName);
1040 //fetch contact details based on phone number
1041 String* pDisplayName = pCallInfo->FetchCallerNameN();
1042 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1043 ShowCallerPhoto(pPhotoBitmap);
1048 SetTextToLabel(*pDisplayName, nameLblName);
1049 delete pDisplayName;
1050 pDisplayName = null;
1055 delete pPhotoBitmap;
1056 pPhotoBitmap = null;
1061 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1063 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1064 //passing an empty string to SetText fails in label,
1065 //if previously valid text has been set
1066 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1068 String stringToBeSet(L"");
1069 pContactLbl->SetText(stringToBeSet);
1074 pContactLbl->SetText(textToBeSet);
1079 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1081 bool showSmallPhoto = false;
1082 //show photo - for Big Photo Id, Animated Call Image
1083 if (pPhotoId == null)
1085 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1089 //Check the size of photo
1090 // Now checking the condition with && but actually it should be ||
1091 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1092 // height 270 and width = 480 . So all images set thru gallery is show as small image
1093 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1094 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1096 showSmallPhoto = true;
1100 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1101 if(showSmallPhoto == true)
1103 ShowThumbnailImage(pPhotoId);
1107 if (pPhotoLbl != null && pPhotoId != null)
1109 Canvas* pCanvas = new (std::nothrow) Canvas;
1110 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1111 pCanvas->Construct(canvasRect);
1112 //draw the contact bitmap
1113 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1114 Bitmap* pNewPhotoId = new Bitmap();
1115 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1118 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1119 pPhotoLbl->Invalidate(true);
1126 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1128 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1130 if (pPhotoLbl != null && pPhotoId != null)
1132 Canvas* pCanvas = new (std::nothrow) Canvas;
1133 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1134 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1135 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1136 pCanvas->Construct(canvasRect);
1137 //draw the back ground
1138 pCanvas->DrawBitmap(canvasRect,*pBackground);
1139 //draw shadow (to be enabled after correct shadow image is provided )
1140 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1141 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1142 //draw the contact bitmap
1143 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1144 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1145 Bitmap* pNewPhotoId = new Bitmap();
1146 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1149 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1150 pPhotoLbl->Invalidate(true);
1159 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1161 //Draw Small Photo and show on small photo label
1162 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1163 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1164 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1165 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1166 // Add a Label to the Form
1167 AddControl(*__pSmallPhotoLabel);
1168 __pSmallPhotoLabel->Invalidate(true);
1172 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1174 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1175 if (pTimerLbl != null)
1177 pTimerLbl->SetText(textToBeDisplayed);
1182 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1183 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1186 Button* pButton = null;
1187 if (isButtonInPanel == false)
1189 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1193 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1194 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1196 Bitmap* pHoldBmp = null;
1197 Canvas* pCanvas = null;
1198 pCanvas = new (std::nothrow) Canvas();
1199 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1200 //set bitmap to button
1201 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1204 //scale bitmap to predefined size
1205 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1206 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1207 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1211 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1214 //scale bitmap to predefined size
1215 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1216 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1217 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1225 String holdBtnName = AppUtility::GetResourceString(btnName);
1226 FloatDimension textDimension;
1227 if (!holdBtnName.IsEmpty())
1230 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1231 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1232 textDimension.height = textDimension.height + font.GetDescender();
1233 TextElement* pTextElement = new (std::nothrow) TextElement();
1234 pTextElement->Construct(holdBtnName);
1235 Color textColor(249, 249, 249);
1236 if (setButtonPressBitmap)
1238 textColor.SetAlpha(255);
1242 textColor.SetAlpha(127);
1245 pTextElement->SetTextColor(textColor);
1246 pTextElement->SetFont(font);
1248 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1249 pEnrichedText->Construct(textDimension);
1250 pEnrichedText->Add(*pTextElement);
1251 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1252 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1253 pCanvas->DrawText(textPos, *pEnrichedText);
1255 pEnrichedText->RemoveAll(true);
1256 delete pEnrichedText;
1260 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1263 //scale bitmap to predefined size
1264 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1265 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1266 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1267 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1270 //set background bitmpa to button
1271 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1272 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1273 if (setButtonPressBitmap)
1275 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1279 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1281 delete pActualBgBmp;
1286 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1289 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1291 __pCallPresentor->StopAlert();
1292 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1294 Rectangle rect = source.GetBounds();
1295 if (source.Equals(*__pAcceptLabel))
1297 __isAnswerCallStarted = true;
1298 __isRejectCallStarted = false;
1300 else if (source.Equals(*__pRejectLabel))
1302 __isAnswerCallStarted = false;
1303 __isRejectCallStarted = true;
1307 // touch event between the 2 labels. So Do nothing
1314 // On Touch released, the animation and the visual elements disappear
1316 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1318 AppLogDebug("%d",currentPosition.x);
1319 if (__isAnswerCallStarted == true)
1321 if (currentPosition.x > __pRejectLabel->GetBounds().x)
1324 if(__pRejectFinalVisElem == null)
1326 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1328 __pRejectFinalVisElem->Construct();
1329 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1330 __pRejectFinalVisElem->SetShowState(true);
1331 __pRejectFinalVisElem->SetOpacity(1.00f);
1332 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1333 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1335 AppLogDebug("AttachChild __pRejectFinalVisElem");
1336 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1338 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1341 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1342 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1343 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1344 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1348 __pAcceptVisElem->SetOpacity(0.0f);
1349 //fetch already active call list
1350 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1351 if (pCallList != null && pCallList->GetCount() > 0)
1353 //then atleast 1 active call exist.
1354 AppCallInfo phnCallInfo;
1355 pCallList->GetAt(0,phnCallInfo);
1356 //Check if only 1 call exist and it is on Hold
1357 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1359 //directly accept call
1360 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1364 //Either 1 call exist and not "on Hold".
1366 if(__pOptionPopup != null)
1368 delete __pOptionPopup;
1369 __pOptionPopup = null;
1371 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1372 __pOptionPopup->Initialize();
1373 __pOptionPopup->SetShowState(true);
1374 __pOptionPopup->Draw();
1375 __pOptionPopup->Show();
1377 pCallList->RemoveAll();
1381 //no active call - Accept the incoming call
1382 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1389 __pAcceptVisElem->SetOpacity(1.0f);
1390 __pRejectVisElem->SetOpacity(1.00f);
1394 else if (__isRejectCallStarted == true)
1396 if (currentPosition.x < ((__pAcceptLabel->GetBounds().x + __pAcceptLabel->GetWidth())- __pRejectLabel->GetBounds().x))
1399 if(__pAcceptFinalVisElem == null)
1401 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1403 __pAcceptFinalVisElem->Construct();
1404 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1405 __pAcceptFinalVisElem->SetShowState(true);
1406 __pAcceptFinalVisElem->SetOpacity(1.0f);
1407 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1408 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1410 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1411 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1413 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1416 AppLogDebug("__pAcceptFinalVisElem drawing");
1417 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1418 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1419 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1420 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1421 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1424 __pRejectVisElem->SetOpacity(0.0f);
1426 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1430 __pAcceptVisElem->SetOpacity(1.0f);
1431 __pRejectVisElem->SetOpacity(1.00f);
1435 __isAnswerCallStarted = false;
1436 __isRejectCallStarted = false;
1440 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1442 if (__isAnswerCallStarted == true)
1444 if (currentPosition.x > 170 && currentPosition.x < 578)
1446 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1448 __pRejectVisElem->SetOpacity(0.60f);
1449 __pAcceptVisElem->SetOpacity(0.60f);
1453 __pRejectVisElem->SetOpacity(1.0f);
1454 __pAcceptVisElem->SetOpacity(1.0f);
1459 if (__isRejectCallStarted == true)
1461 if (currentPosition.x < 0 && currentPosition.x > -522)
1463 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1465 __pRejectVisElem->SetOpacity(0.60f);
1466 __pAcceptVisElem->SetOpacity(0.60f);
1470 __pRejectVisElem->SetOpacity(1.0f);
1471 __pAcceptVisElem->SetOpacity(1.0f);
1478 IncomingCallForm::OnItemSelected(int itemIndex)
1480 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1483 //display name, mobile number
1484 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1485 pArgs->Add(argIndex);
1486 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1490 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1492 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1494 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1496 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1498 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1501 __pAcceptVisElem->SetOpacity(1.0f);
1502 __pRejectVisElem->SetOpacity(1.00f);
1504 if (__pRejectFinalVisElem != null)
1506 __pRejectFinalVisElem->Destroy();
1507 __pRejectFinalVisElem = null;
1509 if (__pAcceptFinalVisElem != null)
1511 __pAcceptFinalVisElem->Destroy();
1512 __pAcceptFinalVisElem = null;
1517 delete __pOptionPopup;
1518 __pOptionPopup = null;
1521 if(itemIndex != IDA_BUTTON_CANCEL_OPTIONS_POPUP)
1523 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1528 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1532 case REQUEST_ITEM_SELECTED:
1536 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1539 HandleMultipleCallSelection(index->ToInt());
1548 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1550 AppLogDebug("Enter");
1553 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1554 if (pButtonRejectMessage)
1556 pButtonRejectMessage->SetShowState(true);
1557 pButtonRejectMessage->Invalidate(true);
1558 pButtonRejectMessage->Draw();
1560 RequestRedraw(true);
1565 IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1567 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1568 if(pKeysPanel->GetShowState() == true)
1570 HideRejectMessagePanel();
1571 ShowRejectMessagePanel();
1574 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1575 if (pButtonRejectMessage != null)
1577 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1578 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
1579 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1580 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
1581 pButtonRejectMessage->Invalidate(true);
1584 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1585 if (pButtonReject != null)
1587 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1588 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
1589 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1590 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
1591 pButtonReject->Invalidate(true);
1596 IncomingCallForm::OnForeground(void)
1598 __pCallPresentor->OnAppForeground();
1602 IncomingCallForm::CallDisconnected(void)
1604 //check if no call option popup is shown, then remain on incoming call screen.
1605 //As user has neither accepted nor rejected incoming call.
1606 if (__pOptionPopup == null)
1611 //fetch already active call list and show updated option popup
1612 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1613 if (pCallList != null && pCallList->GetCount() > 0)
1615 //then atleast 1 active call exist.
1616 AppCallInfo phnCallInfo;
1617 pCallList->GetAt(0,phnCallInfo);
1618 //Check if only 1 call exist and it is on Hold
1619 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1621 //directly accept call
1622 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1626 //Either 1 call exist and not "on Hold".
1628 if(__pOptionPopup != null)
1630 delete __pOptionPopup;
1631 __pOptionPopup = null;
1633 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1634 __pOptionPopup->Initialize();
1635 __pOptionPopup->SetShowState(true);
1636 __pOptionPopup->Draw();
1637 __pOptionPopup->Show();
1639 pCallList->RemoveAll();
1643 //no active call - Accept the incoming call
1644 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);