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 PhnIncomingCallForm.cpp
19 * @brief Incoming Call form implementation
21 #include <FBaseColIList.h>
22 #include <FMessaging.h>
23 #include "PhnIncomingCallForm.h"
24 #include "PhnAppUtility.h"
25 #include "PhnSettingsManager.h"
26 #include "PhnCallPresentationModel.h"
27 #include "PhnSceneRegister.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::Messaging;
35 using namespace Tizen::Ui;
36 using namespace Tizen::Ui::Animations;
37 using namespace Tizen::Ui::Controls;
38 using namespace Tizen::Ui::Scenes;
41 const int W_DIAL_BITMAP = 102;
42 const int H_DIAL_BITMAP = 102;
43 const int W_CREATE_BITMAP = 56;
44 const int H_CREATE_BITMAP = 56;
45 const int X_CREATE_BITMAP = 8;
46 const int Y_CREATE_BITMAP = 8;
47 const int W_MESSAGE_BG_BITMAP = 720;
48 const int H_MESSAGE_BG_BITMAP = 92;
49 const int W_ARROW_BITMAP = 18;
50 const int H_ARROW_BITMAP = 12;
51 const int W_MESSAGE_BITMAP = 50;
52 const int H_MESSAGE_BITMAP = 50;
53 const int X_MESSAGE_BITMAP = 148;
54 const int Y_MESSAGE_BITMAP = 28;
55 const int MESSAGE_TEXT_X_MARGIN = 20;
56 const int MESSAGE_TEXT_Y_MARGIN = 7;
57 const int SEND_TEXT_X_MARGIN = 78;
58 const int SEND_TEXT_Y_MARGIN = 20;
59 const int SEND_BUTTON_ROUND_DIMENSION = 5;
60 const int W_DIAL_LABEL = 158;
61 const int H_DIAL_LABEL = 158;
62 const int DIAL_ICON_X_OFFSET = 23;
63 const int DIAL_ICON_Y_OFFSET = 23;
64 const int REJECT_LABEL_X_OFFSET = 542;
65 const int X_CALL_PANEL = 0;
66 const int Y_CALL_PANEL = 190;
67 const int H_CALL_PANEL = 158;
68 const int Y_ARROW_LABEL = 79;
69 const int W_ARROW_LABEL = 20;
70 const int H_ARROW_LABEL = 32;
71 const int VALID_TOUCH_X_OFFSET = 158;
72 const int VALID_TOUCH_Y_OFFSET = 158;
73 const int X_ARROW_LABEL_STARTPOS = 198;
74 const int ARROW_LABEL_X_MARGIN = 48;
75 const int ACCEPT_LABEL_RELATIVE_POS = -384; //relative pos of accept labels right to reject labels left
76 const int MAX_LIST_HEIGHT = 678;
77 const int H_REJECT_VIEW_FOOTER = 114;
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 H_SEND_TEXT_ITEM = 72;
85 const int X_PHOTO_LBL = 166;
86 const int Y_PHOTO_LBL = 232;
87 const int W_PHOTO_LBL = 388;
88 const int H_PHOTO_LBL = 388;
89 const int W_PHOTO_LABEL = 720;
90 const int H_PHOTO_LABEL = 720;
92 const unsigned int COLOR_SEND_BUTTON_PRESSED = Color32<130, 142, 150>::Value;
93 const unsigned int COLOR_SEND_BUTTON_NORMAL = Color32<64, 156, 211>::Value;
94 const unsigned int COLOR_SWIPE_PANEL = Color32<0, 0, 0, 255>::Value;
95 const unsigned int COLOR_LIST_TEXT_NORMAL = Color32<0, 0, 0>::Value;
96 const unsigned int COLOR_LIST_TEXT_PRESSED = Color32<249, 249, 249>::Value;
98 const int FONT_SIZE_MSG_TXT = 32;
100 static const wchar_t* IDL_INCOMING_CALL_FORM = L"IDL_INCOMING_CALL_FORM";
101 static const wchar_t* IDB_REJECT_MESSAGE_BG = L"C01-1_Reject_message_bg.png";
102 static const wchar_t* IDB_REJECT_MESSAGE_UP_ARROW = L"C01-1_Reject_message_arrow_01.png";
103 static const wchar_t* IDB_REJECT_MESSAGE_DOWN_ARROW = L"C01-1_Reject_message_arrow_02.png";
104 static const wchar_t* IDB_REJECT_MESSAGE_ICON = L"C01-1_icon_Reject_with_Message.png";
105 static const wchar_t* IDB_ACCEPT_CIRCLE_ICON = L"C01-1_accept_left.png";
106 static const wchar_t* IDB_REJECT_CIRCLE_ICON = L"C01-1_reject_right.png";
107 static const wchar_t* IDB_CALL_ACCEPT_ICON = L"C01-1_accept_left_dial_answer.png";
108 static const wchar_t* IDB_CALL_REJECT_ICON = L"C01-1_reject_right_dial_decline.png";
109 static const wchar_t* IDB_ACCEPT_ARROW_ICON = L"C01-1_arrow_g.png";
110 static const wchar_t* IDB_REJECT_ARROW_ICON = L"C01-1_arrow_r.png";
111 static const wchar_t* IDB_CALL_BG = L"C01-1_calling_BG_01.png";
112 static const wchar_t* IDB_CREATE_BUTTON_ICON = L"C01-1_btn_create.png";
113 static const wchar_t* IDB_BACK_BUTTON_ICON = L"C01-1_btn_back.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_BACK_BUTTON = L"IDC_BACK_BUTTON";
117 static const wchar_t* IDC_CREATE_BUTTON = L"IDC_CREATE_BUTTON";
118 static const wchar_t* IDC_REJECT_MESSAGE_CANCEL_BUTTON = L"IDC_REJECT_MESSAGE_CANCEL_BUTTON";
119 static const wchar_t* IDC_LIST_SCROLLPANEL = L"IDC_LIST_SCROLLPANEL";
120 static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
121 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
122 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
123 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
124 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
125 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
126 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
128 const int ID_MULTI_PARTY_CALL = 505;
129 const int ID_SECOND_INCOMING_CALL = 503;
131 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
132 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
133 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
134 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
135 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
136 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
137 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
138 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
142 , public ISmsListener
145 void OnSmsMessageSent(result r)
150 IncomingCallForm::IncomingCallForm(void)
151 : BaseForm(FORMTYPE_INCOMINGCALL)
153 __pActiveContactNo = null;
154 __pRejectMessageList = null;
155 __incomingCallHandle = -1;
156 __isAnswerCallStarted = false;
157 __isRejectCallStarted = false;
158 __pAcceptArrowLabelsList = null;
159 __pRejectArrowLabelsList = null;
160 __pRejectCircle = null;
161 __pAcceptCircle = null;
162 __pAcceptDial = null;
163 __pRejectDial = null;
164 __pAcceptArrow = null;
165 __pRejectArrow = null;
166 __pAcceptLabel = null;
167 __pRejectLabel = null;
168 __pAcceptArrowLabel = null;
169 __pRejectArrowLabel = null;
170 __pCallHandlePanel = null;
171 __pAcceptVisElem = null;
172 __pRejectVisElem = null;
173 __pRejectFinalVisElem = null;
174 __pAcceptFinalVisElem = null;
175 __pAcceptArrowVisElem = null;
176 __pRejectArrowVisElem = null;
177 __pCallPresentor = null;
178 __pOptionPopup = null;
179 __pSmallPhotoLabel = null;
182 IncomingCallForm::~IncomingCallForm(void)
187 IncomingCallForm::Initialize(void)
189 Construct(IDL_INCOMING_CALL_FORM);
193 IncomingCallForm::OnInitializing(void)
195 result r = E_SUCCESS;
196 Canvas* pCanvas = null;
198 VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
199 r = pFormVisElem->Construct();
200 pFormVisElem->SetBounds(FloatRectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
201 pFormVisElem->SetShowState(true);
202 pFormVisElem->SetOpacity(1.0f);
203 pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
204 GetVisualElement()->AttachChild(*pFormVisElem);
205 pCanvas = pFormVisElem->GetCanvasN();
209 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
210 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
211 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
217 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
218 if (pButtonRejectMessage)
220 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
221 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
222 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
223 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
224 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
225 pButtonRejectMessage->AddActionEventListener(*this);
228 //Get Reject list from Settings Manager
229 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
232 __pRejectMessageList = pMsgMap->GetValuesN();
236 InitializeTableView();
238 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
239 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
240 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
241 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
242 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
243 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
246 //Panel for showing accept and reject call buttons.
247 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
248 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
250 __pCallHandlePanel = new (std::nothrow) Panel();
251 r = __pCallHandlePanel->Construct(Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL), GROUP_STYLE_NONE);
252 __pCallHandlePanel->AddTouchEventListener(*this);
253 AddControl(*__pCallHandlePanel);
254 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
255 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
256 r = pCallPanelVisElem->Construct();
257 pCallPanelVisElem->SetBounds(FloatRectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
258 pCallPanelVisElem->SetShowState(true);
259 pCallPanelVisElem->SetOpacity(1.0f);
260 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
261 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
262 pCanvas = pCallPanelVisElem->GetCanvasN();
266 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
267 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
268 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
272 //Lock Label for animation
273 __pAcceptLabel = new (std::nothrow) Label();
274 r = __pAcceptLabel->Construct(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
275 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
276 __pAcceptLabel->AddTouchEventListener(*this);
277 __pCallHandlePanel->AddControl(*__pAcceptLabel);
279 __pAcceptVisElem = new (std::nothrow) VisualElement();
280 r = __pAcceptVisElem->Construct();
281 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
282 __pAcceptVisElem->SetShowState(true);
283 __pAcceptVisElem->SetOpacity(1.0f);
284 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
285 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
286 pCanvas = __pAcceptVisElem->GetCanvasN();
290 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
291 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
292 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
293 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
294 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
298 //UnLock Label for animation
299 __pRejectLabel = new (std::nothrow) Label();
300 r = __pRejectLabel->Construct(Rectangle(REJECT_LABEL_X_OFFSET, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
301 __pRejectLabel->AddTouchEventListener(*this);
302 __pCallHandlePanel->AddControl(*__pRejectLabel);
303 __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
304 SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
307 __pRejectVisElem = new (std::nothrow) VisualElement();
308 r = __pRejectVisElem->Construct();
309 __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
310 __pRejectVisElem->SetShowState(true);
311 __pRejectVisElem->SetOpacity(1.00f);
312 __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
313 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
314 pCanvas = __pRejectVisElem->GetCanvasN();
318 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
319 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
320 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
321 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
322 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
327 //! Constructs an array list to store the unlock labels
328 __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
329 r = __pAcceptArrowLabelsList->Construct();
331 //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
332 int x = X_ARROW_LABEL_STARTPOS;
333 for (int index = 0; index < 7; index++)
335 __pAcceptArrowLabel = new (std::nothrow) Label();
336 r = __pAcceptArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
337 __pAcceptArrowLabel->AddTouchEventListener(*this);
338 __pCallHandlePanel->AddControl(*__pAcceptArrowLabel);
339 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
340 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
341 r = __pAcceptArrowVisElem->Construct();
342 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
343 __pAcceptArrowVisElem->SetShowState(true);
344 __pAcceptArrowVisElem->SetOpacity(0.0f);
345 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
346 VisualEleName.Append(index);
347 __pAcceptArrowVisElem->SetName(VisualEleName);
348 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
349 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
353 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
354 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
355 pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
356 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
357 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
361 x += ARROW_LABEL_X_MARGIN;
363 //! Constructs an array list to store the unlock labels
364 __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
365 r = __pRejectArrowLabelsList->Construct();
367 x = X_ARROW_LABEL_STARTPOS;
368 for (int index = 0; index < 7; index++)
370 __pRejectArrowLabel = new (std::nothrow) Label();
371 r = __pRejectArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
372 __pRejectArrowLabel->AddTouchEventListener(*this);
373 __pCallHandlePanel->AddControl(*__pRejectArrowLabel);
374 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
375 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
376 r = __pRejectArrowVisElem->Construct();
377 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
378 __pRejectArrowVisElem->SetShowState(true);
379 __pRejectArrowVisElem->SetOpacity(0.0f);
380 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
381 VisualEleName.Append(index);
382 __pRejectArrowVisElem->SetName(VisualEleName);
383 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
384 pCanvas = __pRejectArrowVisElem->GetCanvasN();
388 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
389 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
390 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
391 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
395 x += ARROW_LABEL_X_MARGIN;
402 IncomingCallForm::OnTerminating(void)
404 result r = E_SUCCESS;
406 if (__pRejectMessageList != null)
408 delete __pRejectMessageList;
409 __pRejectMessageList = null;
411 if (__pActiveContactNo != null)
413 delete __pActiveContactNo;
414 __pActiveContactNo = null;
416 __incomingCallHandle = -1;
417 __pCallPresentor = null;
419 /* Deleting fails in A4RC* SDK. Remove if not necessary
420 if (__pAcceptVisElem != null)
422 __pAcceptVisElem->Destroy();
423 __pAcceptVisElem = null;
426 if (__pRejectVisElem != null)
428 __pRejectVisElem->Destroy();
429 __pRejectVisElem = null;
432 if (__pRejectFinalVisElem != null)
434 __pRejectFinalVisElem->Destroy();
435 __pRejectFinalVisElem = null;
438 if (__pAcceptFinalVisElem != null)
440 __pAcceptFinalVisElem->Destroy();
441 __pAcceptFinalVisElem = null;
444 for (int i = 0; i < 7; i++)
446 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
447 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
448 if (__pRejectArrowVisElem != null)
450 __pRejectArrowVisElem->Destroy();
451 __pRejectArrowVisElem = null;
454 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
455 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
456 if (__pAcceptArrowVisElem != null)
458 __pAcceptArrowVisElem->Destroy();
459 __pAcceptArrowVisElem = null;
463 if (__pAcceptArrowVisElem != null)
465 __pAcceptArrowVisElem = null;
468 if (__pRejectArrowVisElem != null)
470 __pRejectArrowVisElem = null;
473 if (__pAcceptArrowLabelsList != null)
475 __pAcceptArrowLabelsList->RemoveAll(false);
476 delete __pAcceptArrowLabelsList;
477 __pAcceptArrowLabelsList = null;
480 if (__pRejectArrowLabelsList != null)
482 __pRejectArrowLabelsList->RemoveAll(false);
483 delete __pRejectArrowLabelsList;
484 __pRejectArrowLabelsList = null;
487 if (__pRejectCircle != null)
489 delete __pRejectCircle;
490 __pRejectCircle = null;
493 if (__pAcceptCircle != null)
495 delete __pAcceptCircle;
496 __pAcceptCircle = null;
499 if (__pAcceptDial != null)
501 delete __pAcceptDial;
502 __pAcceptDial = null;
505 if (__pRejectDial != null)
507 delete __pRejectDial;
508 __pRejectDial = null;
511 if (__pAcceptArrow != null)
513 delete __pAcceptArrow;
514 __pAcceptArrow = null;
517 if (__pRejectArrow != null)
519 delete __pRejectArrow;
520 __pRejectArrow = null;
522 __pCallHandlePanel->RemoveTouchEventListener(*this);
523 __pAcceptLabel->RemoveTouchEventListener(*this);
524 __pRejectLabel->RemoveTouchEventListener(*this);
525 __pAcceptArrowLabel->RemoveTouchEventListener(*this);
526 __pRejectArrowLabel->RemoveTouchEventListener(*this);
527 __pAcceptLabel = null;
528 __pRejectLabel = null;
529 __pAcceptArrowLabel = null;
530 __pRejectArrowLabel = null;
531 __pCallHandlePanel = null;
536 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
540 case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
542 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
545 pKeysPanel->SetShowState(true);
546 ScrollPanel* pScrollPanel = static_cast<ScrollPanel*>(pKeysPanel->GetControl(IDC_LIST_SCROLLPANEL));
547 TableView* pMessageList = static_cast<TableView*>(pScrollPanel->GetControl(IDC_MSG_TABLEVIEW));
548 Rectangle tmpRect = pMessageList->GetBounds();
549 SetControlAlwaysOnTop(*pKeysPanel,true);
551 //Set Height to Reject Message Panel
552 int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
553 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
555 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
557 if (listHeight > MAX_LIST_HEIGHT)
559 listHeight = MAX_LIST_HEIGHT;
562 pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
563 tmpRect = pScrollPanel->GetBounds();
564 pScrollPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
565 tmpRect = pKeysPanel->GetBounds();
566 pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP + H_REJECT_VIEW_FOOTER + listHeight);
568 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
569 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
570 pButtonReject->AddActionEventListener(*this);
571 pButtonReject->SetEnabled(true);
572 pButtonReject->SetFocus();
574 pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_BACK_BUTTON));
575 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
576 pButtonReject->AddActionEventListener(*this);
577 pButtonReject->SetEnabled(true);
578 pButtonReject->SetFocus();
580 Button* pButtonCreate = static_cast<Button*>(pKeysPanel->GetControl(IDC_CREATE_BUTTON));
581 pButtonCreate->SetActionId(IDA_CREATE_REJECT_CALL_MESSAGE);
582 pButtonCreate->AddActionEventListener(*this);
583 pButtonCreate->SetEnabled(true);
584 pButtonCreate->SetFocus();
586 pKeysPanel->SetFocus();
589 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
590 if (pButtonRejectMessage)
592 pButtonRejectMessage->SetShowState(false);
593 pButtonRejectMessage->Invalidate(true);
594 pButtonRejectMessage->Draw();
599 case IDA_CREATE_REJECT_CALL_MESSAGE:
601 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
602 ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
603 if(pCallList != null && pCallList->GetCount() > 0)
605 __pCallPresentor->HandleCallConnected(*pCallList);
611 case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
615 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
616 if (pButtonRejectMessage)
618 pButtonRejectMessage->SetShowState(true);
619 pButtonRejectMessage->Invalidate(true);
620 pButtonRejectMessage->Draw();
626 case IDA_SEND_REJECT_MSG1:
627 case IDA_SEND_REJECT_MSG2:
628 case IDA_SEND_REJECT_MSG3:
629 case IDA_SEND_REJECT_MSG4:
630 case IDA_SEND_REJECT_MSG5:
631 case IDA_SEND_REJECT_MSG6:
633 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
634 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
635 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
636 result r = pSmsManager->Construct(*pSmsListener);
637 if (IsFailed(r) == false)
639 RecipientList recipient;
640 recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
641 SmsMessage smsMessage;
644 int msgIndex = IDA_SEND_REJECT_MSG1;
645 msgIndex = actionId - msgIndex;
646 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
647 r = smsMessage.SetText(textToBeSent);
648 if (IsFailed(r) == false)
650 r = pSmsManager->Send(smsMessage,recipient,true);
651 if (IsFailed(r) == true)
653 //todo: error message
658 //todo: error message
663 //todo: error message
667 /*ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
668 __pCallPresentor->HandleCallConnected(*pCallList);
679 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
681 if(__pCallPresentor == null)
683 __pCallPresentor = CallPresentationModel::GetInstance();
685 __pCallPresentor->SetTelEventListener(this);
688 if (__pRejectFinalVisElem != null)
690 __pRejectFinalVisElem->Destroy();
691 __pRejectFinalVisElem = null;
694 if (__pAcceptFinalVisElem != null)
696 __pAcceptFinalVisElem->Destroy();
697 __pAcceptFinalVisElem = null;
699 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
701 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
703 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
705 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
708 __pAcceptVisElem->SetOpacity(1.0f);
709 __pRejectVisElem->SetOpacity(1.00f);
710 for (int i = 0; i < 7; i++)
712 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
713 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
714 RejectVisualEleName.Append(i);
715 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
716 __pRejectArrowVisElem->SetOpacity(0.0f);
717 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
718 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
719 AcceptVisualEleName.Append(i);
720 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
721 __pAcceptArrowVisElem->SetOpacity(0.0f);
728 CallInfo* pIncomingCall = static_cast<CallInfo*>(pArgs->GetAt(0));
729 if (pIncomingCall != null)
731 //start alert with contact's custom ringtone
732 __pCallPresentor->StartAlert(*pIncomingCall);
733 //show contact number
735 contactNo.Append(pIncomingCall->GetContactNumber());
736 if (__pActiveContactNo)
738 delete __pActiveContactNo;
739 __pActiveContactNo = null;
741 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
742 __pActiveContactNo = new (std::nothrow) String();
743 __pActiveContactNo->Append(contactNo);
744 //Show person details
745 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
746 //Check if incoming call is hidden call, then do not show "Reject with Message" button
747 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
748 if (pButtonRejectMessage)
750 //for hidden call, contact number is not present
751 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
752 pButtonRejectMessage->SetShowState(showRejectMsgButton);
753 pButtonRejectMessage->Invalidate(true);
763 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
765 if (__pSmallPhotoLabel != null)
767 RemoveControl(*__pSmallPhotoLabel);
768 __pSmallPhotoLabel = null;
770 for (int i = 0; i < 7; i++)
772 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
773 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
774 RejectVisualEleName.Append(i);
775 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
776 __pRejectArrowVisElem->SetOpacity(0.0f);
777 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
778 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
779 AcceptVisualEleName.Append(i);
780 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
781 __pAcceptArrowVisElem->SetOpacity(0.0f);
786 IncomingCallForm::OnDraw(void)
788 Bitmap* pBackgroundWp = null;
789 // get a Canvas instance
790 Canvas* pCanvas = GetCanvasN();
792 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
799 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
803 delete pBackgroundWp;
804 pBackgroundWp = null;
813 IncomingCallForm::HideRejectPanel(void)
815 Bitmap* pRejectMessageBitmap = null;
816 AppResource* pAppResource = AppResource::GetInstance();
817 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
820 pKeysPanel->SetShowState(false);
821 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
822 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
823 pButtonReject->AddActionEventListener(*this);
824 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
825 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
826 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
827 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
829 pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_CREATE_BUTTON));
830 pRejectMessageBitmap = pAppResource->GetBitmapN(IDB_CREATE_BUTTON_ICON);
831 pRejectMessageBitmap->Scale(Dimension(W_CREATE_BITMAP, H_CREATE_BITMAP));
832 pButtonReject->SetNormalBitmap(Point(X_CREATE_BITMAP, Y_CREATE_BITMAP), *pRejectMessageBitmap);
833 delete pRejectMessageBitmap;
834 pRejectMessageBitmap = null;
836 pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_BACK_BUTTON));
837 pRejectMessageBitmap = pAppResource->GetBitmapN(IDB_BACK_BUTTON_ICON);
838 pRejectMessageBitmap->Scale(Dimension(W_CREATE_BITMAP, H_CREATE_BITMAP));
839 pButtonReject->SetNormalBitmap(Point(X_CREATE_BITMAP, Y_CREATE_BITMAP), *pRejectMessageBitmap);
840 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
841 pButtonReject->AddActionEventListener(*this);
842 delete pRejectMessageBitmap;
843 pRejectMessageBitmap = null;
845 Button* pButtonCreate = static_cast<Button*>(pKeysPanel->GetControl(IDC_CREATE_BUTTON));
846 pButtonCreate->SetActionId(IDA_CREATE_REJECT_CALL_MESSAGE);
847 pButtonCreate->AddActionEventListener(*this);
849 pKeysPanel->Invalidate(true);
854 IncomingCallForm::InitializeTableView(void)
856 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
857 ScrollPanel* pScrollPanel = static_cast<ScrollPanel*>(pKeysPanel->GetControl(IDC_LIST_SCROLLPANEL));
859 TableView* pMessageList = static_cast<TableView*>(pScrollPanel->GetControl(IDC_MSG_TABLEVIEW));
860 pMessageList->SetItemProvider(this);
861 pMessageList->AddTableViewItemEventListener(*this);
862 pScrollPanel->AddControl(*pMessageList);
865 ///////////////////////////////////////////////////////////////////////////////
866 ///// Table View Functionality supporting functions /////
867 //////////////////////////////////////////////////////////////////////////////
869 IncomingCallForm::GetItemCount(void)
871 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
873 return (__pRejectMessageList->GetCount());
879 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
882 TableViewItem* pItem = new (std::nothrow) TableViewItem();
883 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
884 pItem->SetBackgroundColor(COLOR_SECONDDEPTH_ITEM_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
886 //Message text item rectangle
887 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
890 String itemName(L"");
891 bool isShowSendButton = true;
892 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
894 __pRejectMessageList->GetAt(itemIndex, itemName);
898 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
899 isShowSendButton = false;
902 Label* pMsgLbl = new (std::nothrow) Label();
903 pMsgLbl->Construct(itemRect, itemName);
904 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
905 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
906 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
907 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);//COLOR_LIST_TEXT_PRESSED
908 pItem->AddControl(*pMsgLbl);
911 if(isShowSendButton == true)
913 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
914 Button* pSendButton = new (std::nothrow) Button();
915 pSendButton->Construct(Rectangle(X_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
916 pSendButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_SEND_BUTTON_PRESSED);
917 pSendButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_SEND_BUTTON_NORMAL);
918 //set action id and listener
919 int actionId = IDA_SEND_REJECT_MSG1;
923 actionId = IDA_SEND_REJECT_MSG1;
926 actionId = IDA_SEND_REJECT_MSG2;
929 actionId = IDA_SEND_REJECT_MSG3;
932 actionId = IDA_SEND_REJECT_MSG4;
935 actionId = IDA_SEND_REJECT_MSG5;
938 actionId = IDA_SEND_REJECT_MSG6;
941 pSendButton->SetActionId(actionId);
942 pSendButton->AddActionEventListener(*this);
943 pItem->AddControl(*pSendButton);
944 pItem->SetIndividualSelectionEnabled(pSendButton, true);
951 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
959 IncomingCallForm::GetDefaultItemHeight(void)
961 return H_LIST_NORMAL_MENU_ITEM;
965 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, CallInfo* pCallInfo)
967 //call individual methods to show contact number, caller name & photo
968 SetTextToLabel(phoneNumber, contactLblName);
970 //fetch contact details based on phone number
971 String* pDisplayName = pCallInfo->FetchCallerNameN();
972 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
973 ShowCallerPhoto(pPhotoBitmap);
978 SetTextToLabel(*pDisplayName, nameLblName);
991 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
993 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
994 //passing an empty string to SetText fails in label,
995 //if previously valid text has been set
996 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
998 String stringToBeSet(L" ");
999 pContactLbl->SetText(stringToBeSet);
1004 pContactLbl->SetText(textToBeSet);
1009 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1011 //show photo - for Big Photo Id, Animated Call Image
1012 if (pPhotoId == null)
1014 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1017 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1018 if (pPhotoLbl != null && pPhotoId != null)
1020 pPhotoLbl->SetBackgroundBitmap(*pPhotoId);
1021 pPhotoLbl->Invalidate(true);
1026 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1028 //Draw Small Photo and show on small photo label
1029 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1030 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1031 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1032 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1033 // Add a Label to the Form
1034 AddControl(*__pSmallPhotoLabel);
1035 __pSmallPhotoLabel->Invalidate(true);
1039 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1041 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1042 if (pTimerLbl != null)
1044 pTimerLbl->SetText(textToBeDisplayed);
1049 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1050 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1053 Button* pButton = null;
1054 if (isButtonInPanel == false)
1056 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1060 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1061 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1063 Bitmap* pHoldBmp = null;
1064 Canvas* pCanvas = null;
1065 pCanvas = new (std::nothrow) Canvas();
1066 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1067 //set bitmap to button
1068 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1071 //scale bitmap to predefined size
1072 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1073 pHoldBmp->Scale(Dimension(W_MESSAGE_BG_BITMAP, H_MESSAGE_BG_BITMAP));
1074 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1078 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1081 //scale bitmap to predefined size
1082 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1083 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1084 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 6), 12), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1088 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1091 //scale bitmap to predefined size
1092 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1093 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1094 pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1098 String holdBtnName = AppUtility::GetResourceString(btnName);
1099 if (!holdBtnName.IsEmpty())
1102 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1103 Dimension textDimension;
1104 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1105 textDimension.height = textDimension.height + font.GetDescender();
1106 TextElement* pTextElement = new (std::nothrow) TextElement();
1107 pTextElement->Construct(holdBtnName);
1108 Color textColor(249, 249, 249);
1109 if (setButtonPressBitmap)
1111 textColor.SetAlpha(255);
1115 textColor.SetAlpha(127);
1118 pTextElement->SetTextColor(textColor);
1119 pTextElement->SetFont(font);
1121 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1122 pEnrichedText->Construct(textDimension);
1123 pEnrichedText->Add(*pTextElement);
1127 Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1128 pCanvas->DrawText(textPos, *pEnrichedText);
1132 pEnrichedText->RemoveAll(true);
1133 delete pEnrichedText;
1136 //set background bitmpa to button
1137 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1138 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1139 if (setButtonPressBitmap)
1141 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1145 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1147 delete pActualBgBmp;
1152 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1155 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1157 __pCallPresentor->StopAlert();
1158 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1160 Rectangle rect = source.GetBounds();
1161 if (source.Equals(*__pAcceptLabel))
1163 __isAnswerCallStarted = true;
1164 __isRejectCallStarted = false;
1166 else if (source.Equals(*__pRejectLabel))
1168 __isAnswerCallStarted = false;
1169 __isRejectCallStarted = true;
1173 // touch event between the 2 labels. So Do nothing
1177 if (__isAnswerCallStarted)
1179 for (int index = 0; index < 7; index++)
1181 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(index));
1182 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1183 VisualEleName.Append(index);
1184 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(VisualEleName,true);
1190 __pAcceptArrowVisElem->SetOpacity(1.0f);
1197 __pAcceptArrowVisElem->SetOpacity(0.8f);
1205 __pAcceptArrowVisElem->SetOpacity(0.6f);
1214 for (int index = 0; index < 7; index++)
1216 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(index));
1217 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1218 VisualEleName.Append(index);
1219 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(VisualEleName,true);
1225 __pRejectArrowVisElem->SetOpacity(0.6f);
1232 __pRejectArrowVisElem->SetOpacity(0.8f);
1240 __pRejectArrowVisElem->SetOpacity(1.0f);
1250 // On Touch released, the animation and the visual elements disappear
1252 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1254 if (__isAnswerCallStarted == true)
1256 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1259 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1260 __pRejectFinalVisElem->Construct();
1261 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1262 __pRejectFinalVisElem->SetShowState(true);
1263 __pRejectFinalVisElem->SetOpacity(1.00f);
1264 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1265 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1266 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1269 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1270 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1271 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1272 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1276 __pAcceptVisElem->SetOpacity(0.0f);
1277 //fetch already active call list
1278 ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
1279 if (pCallList != null && pCallList->GetCount() > 0)
1281 //then atleast 1 active call exist.
1282 CallInfo phnCallInfo;
1283 pCallList->GetAt(0,phnCallInfo);
1284 //Check if only 1 call exist and it is on Hold
1285 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1287 //directly accept call
1288 __pCallPresentor->AcceptIncomingCall(CALL_ANSWER_CALL,__incomingCallHandle);
1292 //Either 1 call exist and not "on Hold".
1294 if(__pOptionPopup != null)
1296 delete __pOptionPopup;
1297 __pOptionPopup = null;
1299 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1300 __pOptionPopup->Initialize();
1301 __pOptionPopup->SetShowState(true);
1302 __pOptionPopup->Draw();
1303 __pOptionPopup->Show();
1305 pCallList->RemoveAll();
1309 //no active call - Accept the incoming call
1310 __pCallPresentor->AcceptIncomingCall(CALL_ANSWER_CALL,__incomingCallHandle);
1317 __pAcceptVisElem->SetOpacity(1.0f);
1318 __pRejectVisElem->SetOpacity(1.00f);
1319 for (int i = 0; i < 7; i++)
1321 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
1322 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1323 VisualEleName.Append(i);
1324 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(VisualEleName,true);
1325 __pAcceptArrowVisElem->SetOpacity(0.0f);
1330 else if (__isRejectCallStarted == true)
1332 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1335 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1336 __pAcceptFinalVisElem->Construct();
1337 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1338 __pAcceptFinalVisElem->SetShowState(true);
1339 __pAcceptFinalVisElem->SetOpacity(1.0f);
1340 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1341 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1342 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1345 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1346 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1347 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1348 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1351 __pRejectVisElem->SetOpacity(0.0f);
1353 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1357 __pAcceptVisElem->SetOpacity(1.0f);
1358 __pRejectVisElem->SetOpacity(1.00f);
1359 for (int i = 0; i < 7; i++)
1361 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
1362 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1363 VisualEleName.Append(i);
1364 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(VisualEleName,true);
1365 __pRejectArrowVisElem->SetOpacity(0.0f);
1370 __isAnswerCallStarted = false;
1371 __isRejectCallStarted = false;
1375 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1377 if (__isAnswerCallStarted == true)
1379 if (currentPosition.x > 170 && currentPosition.x < 578)
1381 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1383 __pRejectVisElem->SetOpacity(0.60f);
1384 __pAcceptVisElem->SetOpacity(0.60f);
1388 __pRejectVisElem->SetOpacity(1.0f);
1389 __pAcceptVisElem->SetOpacity(1.0f);
1391 for (int index = 0; index < 7; index++)
1393 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(index));
1394 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1395 VisualEleName.Append(index);
1396 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(VisualEleName,true);
1402 if (currentPosition.x > 360)
1404 __pAcceptArrowVisElem->SetOpacity(0.6f);
1408 __pAcceptArrowVisElem->SetOpacity(1.0f);
1416 __pAcceptArrowVisElem->SetOpacity(0.8f);
1424 if (currentPosition.x < 360)
1426 __pAcceptArrowVisElem->SetOpacity(0.6f);
1430 __pAcceptArrowVisElem->SetOpacity(1.0f);
1438 if (__isRejectCallStarted == true)
1440 if (currentPosition.x < 0 && currentPosition.x > -522)
1442 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1444 __pRejectVisElem->SetOpacity(0.60f);
1445 __pAcceptVisElem->SetOpacity(0.60f);
1449 __pRejectVisElem->SetOpacity(1.0f);
1450 __pAcceptVisElem->SetOpacity(1.0f);
1452 for (int index = 0; index < 7; index++)
1454 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(index));
1455 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1456 VisualEleName.Append(index);
1457 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(VisualEleName,true);
1463 if (currentPosition.x > -180)
1465 __pRejectArrowVisElem->SetOpacity(0.6f);
1469 __pRejectArrowVisElem->SetOpacity(1.0f);
1477 __pRejectArrowVisElem->SetOpacity(0.8f);
1485 if (currentPosition.x < -180)
1487 __pRejectArrowVisElem->SetOpacity(0.6f);
1491 __pRejectArrowVisElem->SetOpacity(1.0f);
1502 IncomingCallForm::OnItemSelected(int itemIndex)
1504 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1507 //display name, mobile number
1508 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1509 pArgs->Add(argIndex);
1510 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1514 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1517 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1519 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1521 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1523 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1526 __pAcceptVisElem->SetOpacity(1.0f);
1527 __pRejectVisElem->SetOpacity(1.00f);
1529 for (int i = 0; i < 7; i++)
1531 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
1532 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1533 RejectVisualEleName.Append(i);
1534 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
1535 __pRejectArrowVisElem->SetOpacity(0.0f);
1536 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
1537 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1538 AcceptVisualEleName.Append(i);
1539 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
1540 __pAcceptArrowVisElem->SetOpacity(0.0f);
1542 if (__pRejectFinalVisElem != null)
1544 __pRejectFinalVisElem->Destroy();
1545 __pRejectFinalVisElem = null;
1548 if (__pAcceptFinalVisElem != null)
1550 __pAcceptFinalVisElem->Destroy();
1551 __pAcceptFinalVisElem = null;
1555 delete __pOptionPopup;
1556 __pOptionPopup = null;
1560 case ID_SECOND_INCOMING_CALL:
1562 //Accept call After putting on hold
1563 __pCallPresentor->AcceptIncomingCall(CALL_ANSWER_HOLD_ACCEPT,__incomingCallHandle);
1566 case ID_SECOND_INCOMING_CALL + 1:
1568 //Accept call After ending active call
1569 __pCallPresentor->AcceptIncomingCall(CALL_ANSWER_END_ACTIVE_ACCEPT,__incomingCallHandle);
1572 case ID_MULTI_PARTY_CALL:
1574 //Accept call After ending active call
1575 __pCallPresentor->AcceptIncomingCall(CALL_ANSWER_END_ACTIVE_ACCEPT,__incomingCallHandle);
1578 case ID_MULTI_PARTY_CALL + 1:
1580 //Accept call After ending held call
1581 __pCallPresentor->AcceptIncomingCall(CALL_ANSWER_END_HELD_ACCEPT,__incomingCallHandle);
1584 case ID_MULTI_PARTY_CALL + 2:
1586 //Accept call After ending all calls
1587 __pCallPresentor->AcceptIncomingCall(CALL_ANSWER_END_ALL_ACCEPT,__incomingCallHandle);
1596 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1600 case REQUEST_ITEM_SELECTED:
1604 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1607 HandleMultipleCallSelection(index->ToInt());