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));
222 InitializeTableView();
224 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
225 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
226 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
227 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
228 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
229 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
232 if(__pRejectDial == null)
236 //Panel for showing accept and reject call buttons.
237 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
238 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
240 __pCallHandlePanel = static_cast<Panel*>(GetControl(IDC_CALLHANDEL_PANEL, true));
241 __pCallHandlePanel->AddTouchEventListener(*this);
242 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
243 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
244 r = pCallPanelVisElem->Construct();
245 pCallPanelVisElem->SetBounds(FloatRectangle(__pCallHandlePanel->GetBoundsF()));
246 pCallPanelVisElem->SetShowState(true);
247 pCallPanelVisElem->SetOpacity(1.0f);
248 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
249 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
250 pCanvas = pCallPanelVisElem->GetCanvasN();
253 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
255 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
256 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
257 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
261 //Lock Label for animation
262 __pAcceptLabel = static_cast<Label*>(GetControl(IDC_ACCEPT_LABEL, true));
263 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
264 __pAcceptLabel->AddTouchEventListener(*this);
266 __pAcceptVisElem = new (std::nothrow) VisualElement();
267 r = __pAcceptVisElem->Construct();
268 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, __pAcceptLabel->GetWidth(), __pAcceptLabel->GetHeight()));
269 __pAcceptVisElem->SetShowState(true);
270 __pAcceptVisElem->SetOpacity(1.0f);
271 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
272 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
273 pCanvas = __pAcceptVisElem->GetCanvasN();
276 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
278 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
279 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
280 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
281 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
282 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
286 //UnLock Label for animation
287 __pRejectLabel = static_cast<Label*>(GetControl(IDC_REJECT_LEBEL, true));
288 __pRejectLabel->AddTouchEventListener(*this);
289 __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
290 SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
293 __pRejectVisElem = new (std::nothrow) VisualElement();
294 r = __pRejectVisElem->Construct();
295 __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
296 __pRejectVisElem->SetShowState(true);
297 __pRejectVisElem->SetOpacity(1.00f);
298 __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
299 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
300 pCanvas = __pRejectVisElem->GetCanvasN();
303 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
305 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
306 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
307 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
308 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
309 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
314 //! Constructs an array list to store the unlock labels
315 __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
316 r = __pAcceptArrowLabelsList->Construct();
318 //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
319 int x = X_ARROW_LABEL_STARTPOS;
320 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
322 String LabelName(IDC_ACCEPT_ARROW);
323 LabelName.Append(index+1);
324 __pAcceptArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
325 __pAcceptArrowLabel->AddTouchEventListener(*this);
326 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
327 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
328 r = __pAcceptArrowVisElem->Construct();
329 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
330 __pAcceptArrowVisElem->SetShowState(true);
331 __pAcceptArrowVisElem->SetOpacity(0.0f);
332 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
333 VisualEleName.Append(index);
334 __pAcceptArrowVisElem->SetName(VisualEleName);
335 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
336 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
339 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
341 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
342 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
343 pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
344 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
345 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
349 x += ARROW_LABEL_X_MARGIN;
351 //! Constructs an array list to store the unlock labels
352 __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
353 r = __pRejectArrowLabelsList->Construct();
355 x = X_ARROW_REJECT_LABEL_STARTPOS;
356 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
358 String LabelName(IDC_REJECT_ARROW);
359 LabelName.Append(index+1);
360 __pRejectArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
361 __pRejectArrowLabel->AddTouchEventListener(*this);
362 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
363 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
364 r = __pRejectArrowVisElem->Construct();
365 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
366 __pRejectArrowVisElem->SetShowState(true);
367 __pRejectArrowVisElem->SetOpacity(0.0f);
368 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
369 VisualEleName.Append(index);
370 __pRejectArrowVisElem->SetName(VisualEleName);
371 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
372 pCanvas = __pRejectArrowVisElem->GetCanvasN();
375 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
377 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
378 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
379 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
380 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
384 x -= ARROW_LABEL_X_MARGIN;
392 IncomingCallForm::InitializeFooter(void)
394 Footer* pFooter = GetFooter();
395 FooterItem footerItemCreate;
397 SetFormBackEventListener(this);
400 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
401 pFooter->AddActionEventListener(*this);
403 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
404 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
405 pFooter->AddItem(footerItemCreate);
406 pFooter->SetBackButton();
407 pFooter->SetShowState(false);
412 IncomingCallForm::ShowRejectMessageFooter(void)
414 Footer* pFooter = GetFooter();
417 AppLogDebug("SetShowState");
418 pFooter->SetShowState(true);
424 IncomingCallForm::HideRejectMessageFooter(void)
426 Footer* pFooter = GetFooter();
429 pFooter->SetShowState(false);
434 IncomingCallForm::OnTerminating(void)
436 result r = E_SUCCESS;
438 if (__pRejectMessageList != null)
440 delete __pRejectMessageList;
441 __pRejectMessageList = null;
443 if (__pActiveContactNo != null)
445 delete __pActiveContactNo;
446 __pActiveContactNo = null;
448 __incomingCallHandle = -1;
449 __pCallPresentor = null;
451 /* Deleting fails in A4RC* SDK. Remove if not necessary
452 if (__pAcceptVisElem != null)
454 __pAcceptVisElem->Destroy();
455 __pAcceptVisElem = null;
458 if (__pRejectVisElem != null)
460 __pRejectVisElem->Destroy();
461 __pRejectVisElem = null;
464 if (__pRejectFinalVisElem != null)
466 __pRejectFinalVisElem->Destroy();
467 __pRejectFinalVisElem = null;
470 if (__pAcceptFinalVisElem != null)
472 __pAcceptFinalVisElem->Destroy();
473 __pAcceptFinalVisElem = null;
476 for (int i = 0; i < 7; i++)
478 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
479 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
480 if (__pRejectArrowVisElem != null)
482 __pRejectArrowVisElem->Destroy();
483 __pRejectArrowVisElem = null;
486 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
487 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
488 if (__pAcceptArrowVisElem != null)
490 __pAcceptArrowVisElem->Destroy();
491 __pAcceptArrowVisElem = null;
495 if (__pAcceptArrowVisElem != null)
497 __pAcceptArrowVisElem = null;
500 if (__pRejectArrowVisElem != null)
502 __pRejectArrowVisElem = null;
505 if (__pAcceptArrowLabelsList != null)
507 __pAcceptArrowLabelsList->RemoveAll(false);
508 delete __pAcceptArrowLabelsList;
509 __pAcceptArrowLabelsList = null;
512 if (__pRejectArrowLabelsList != null)
514 __pRejectArrowLabelsList->RemoveAll(false);
515 delete __pRejectArrowLabelsList;
516 __pRejectArrowLabelsList = null;
519 if (__pRejectCircle != null)
521 delete __pRejectCircle;
522 __pRejectCircle = null;
525 if (__pAcceptCircle != null)
527 delete __pAcceptCircle;
528 __pAcceptCircle = null;
531 if (__pAcceptDial != null)
533 delete __pAcceptDial;
534 __pAcceptDial = null;
537 if (__pRejectDial != null)
539 delete __pRejectDial;
540 __pRejectDial = null;
543 if (__pAcceptArrow != null)
545 delete __pAcceptArrow;
546 __pAcceptArrow = null;
549 if (__pRejectArrow != null)
551 delete __pRejectArrow;
552 __pRejectArrow = null;
554 __pCallHandlePanel->RemoveTouchEventListener(*this);
555 __pAcceptLabel->RemoveTouchEventListener(*this);
556 __pRejectLabel->RemoveTouchEventListener(*this);
557 __pAcceptArrowLabel->RemoveTouchEventListener(*this);
558 __pRejectArrowLabel->RemoveTouchEventListener(*this);
559 __pAcceptLabel = null;
560 __pRejectLabel = null;
561 __pAcceptArrowLabel = null;
562 __pRejectArrowLabel = null;
563 __pCallHandlePanel = null;
568 IncomingCallForm::ShowRejectMessagePanel(void)
570 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
573 pKeysPanel->SetShowState(true);
574 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
575 Rectangle tmpRect = pMessageList->GetBounds();
576 SetControlAlwaysOnTop(*pKeysPanel,true);
578 //Set Height to Reject Message Panel
579 int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
580 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
582 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
584 if (listHeight > MAX_LIST_HEIGHT)
586 listHeight = MAX_LIST_HEIGHT;
589 pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
590 pMessageList->UpdateTableView();
591 tmpRect = pKeysPanel->GetBounds();
592 pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight);
594 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
595 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
596 pButtonReject->AddActionEventListener(*this);
597 pButtonReject->SetEnabled(true);
598 pButtonReject->SetFocus();
600 ShowRejectMessageFooter();
603 pKeysPanel->SetFocus();
606 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
607 if (pButtonRejectMessage)
609 pButtonRejectMessage->SetShowState(false);
610 pButtonRejectMessage->Invalidate(true);
611 pButtonRejectMessage->Draw();
615 IncomingCallForm::HideRejectMessagePanel(void)
618 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
619 if (pButtonRejectMessage)
621 pButtonRejectMessage->SetShowState(true);
622 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
623 if (pRelativeLayout != null)
625 pRelativeLayout->SetRelation(*pButtonRejectMessage,*this,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
626 pRelativeLayout->Update();
627 delete pRelativeLayout;
633 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
637 case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
639 ShowRejectMessagePanel();
643 case IDA_CREATE_REJECT_CALL_MESSAGE:
645 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
646 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
647 if(pCallList != null && pCallList->GetCount() > 0)
649 __pCallPresentor->HandleCallConnected(*pCallList);
655 case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
657 HideRejectMessagePanel();
661 case IDA_SEND_REJECT_MSG1:
662 case IDA_SEND_REJECT_MSG2:
663 case IDA_SEND_REJECT_MSG3:
664 case IDA_SEND_REJECT_MSG4:
665 case IDA_SEND_REJECT_MSG5:
666 case IDA_SEND_REJECT_MSG6:
668 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
669 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
670 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
671 result r = pSmsManager->Construct(*pSmsListener);
672 if (IsFailed(r) == false)
674 RecipientList recipient;
675 recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
676 SmsMessage smsMessage;
679 int msgIndex = IDA_SEND_REJECT_MSG1;
680 msgIndex = actionId - msgIndex;
681 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
682 r = smsMessage.SetText(textToBeSent);
683 if (IsFailed(r) == false)
685 r = pSmsManager->Send(smsMessage,recipient,true);
686 if (IsFailed(r) == true)
688 //todo: error message
693 //todo: error message
698 //todo: error message
702 /*ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
703 __pCallPresentor->HandleCallConnected(*pCallList);
714 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
716 AddOrientationEventListener(*this);
717 //Get Reject list from Settings Manager
718 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
721 if (__pRejectMessageList != null)
723 delete __pRejectMessageList;
724 __pRejectMessageList = null;
726 __pRejectMessageList = pMsgMap->GetValuesN();
733 if (__pRejectMessageList != null)
735 delete __pRejectMessageList;
736 __pRejectMessageList = null;
739 //listen to Foreground events
740 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
741 pPhoneApp->AddAppStateChangeListener(*this);
742 if(__pCallPresentor == null)
744 __pCallPresentor = CallPresentationModel::GetInstance();
746 __pCallPresentor->SetTelEventListener(this);
749 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
751 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
753 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
755 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
758 __pAcceptVisElem->SetOpacity(1.0f);
759 __pRejectVisElem->SetOpacity(1.00f);
760 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
762 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
763 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
764 RejectVisualEleName.Append(i);
765 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
766 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
767 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
768 AcceptVisualEleName.Append(i);
769 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
773 __pAcceptArrowVisElem->SetOpacity(0.6f);
774 __pRejectArrowVisElem->SetOpacity(0.6f);
777 __pAcceptArrowVisElem->SetOpacity(0.8f);
778 __pRejectArrowVisElem->SetOpacity(0.8f);
781 __pAcceptArrowVisElem->SetOpacity(1.0f);
782 __pRejectArrowVisElem->SetOpacity(1.0f);
792 AppCallInfo* pIncomingCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
793 if (pIncomingCall != null)
795 //start alert with contact's custom ringtone
796 __pCallPresentor->StartAlert(*pIncomingCall);
797 //show contact number
799 contactNo.Append(pIncomingCall->GetContactNumber());
800 if (__pActiveContactNo)
802 delete __pActiveContactNo;
803 __pActiveContactNo = null;
805 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
806 __pActiveContactNo = new (std::nothrow) String();
808 if(contactNo.IsEmpty())
810 AppLogDebug("Number empty");
811 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
812 AppLogDebug("%ls",contactNo.GetPointer());
814 __pActiveContactNo->Append(contactNo);
815 //Show person details
816 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
817 //Check if incoming call is hidden call, then do not show "Reject with Message" button
818 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
819 if (pButtonRejectMessage)
821 //for hidden call, contact number is not present
822 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
823 pButtonRejectMessage->SetShowState(showRejectMsgButton);
824 pButtonRejectMessage->Invalidate(true);
831 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
832 pCallApp->SetTopMostWindow(true);
833 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
834 if (pButtonRejectMessage)
836 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
837 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
838 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
839 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
840 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
841 pButtonRejectMessage->AddActionEventListener(*this);
847 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
849 RemoveOrientationEventListener(*this);
850 if (__pSmallPhotoLabel != null)
852 RemoveControl(*__pSmallPhotoLabel);
853 __pSmallPhotoLabel = null;
855 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
857 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
858 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
859 RejectVisualEleName.Append(i);
860 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
861 __pRejectArrowVisElem->SetOpacity(0.0f);
862 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
863 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
864 AcceptVisualEleName.Append(i);
865 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
866 __pAcceptArrowVisElem->SetOpacity(0.0f);
868 if(__pAcceptLabel != null)
870 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
872 AppLogDebug("__pAcceptLabel Detatach child");
873 __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
876 if(__pRejectLabel != null)
878 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
880 AppLogDebug("__pRejectLabel Detatach child");
881 __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
885 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
886 pCallApp->RemoveAppStateChangeListener(*this);
890 IncomingCallForm::OnDraw(void)
892 Bitmap* pBackgroundWp = null;
893 // get a Canvas instance
894 Canvas* pCanvas = GetCanvasN();
896 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
903 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
907 delete pBackgroundWp;
908 pBackgroundWp = null;
917 IncomingCallForm::HideRejectPanel(void)
919 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
922 pKeysPanel->SetShowState(false);
923 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
924 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
925 pButtonReject->AddActionEventListener(*this);
926 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
927 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
928 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
929 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
931 HideRejectMessageFooter();
932 pKeysPanel->Invalidate(true);
937 IncomingCallForm::InitializeTableView(void)
939 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
941 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
942 pMessageList->SetItemProvider(this);
943 pMessageList->AddTableViewItemEventListener(*this);
946 ///////////////////////////////////////////////////////////////////////////////
947 ///// Table View Functionality supporting functions /////
948 //////////////////////////////////////////////////////////////////////////////
950 IncomingCallForm::GetItemCount(void)
952 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
954 return (__pRejectMessageList->GetCount());
960 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
963 TableViewItem* pItem = new (std::nothrow) TableViewItem();
964 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
966 //Message text item rectangle
967 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
970 String itemName(L"");
971 bool isShowSendButton = true;
972 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
974 __pRejectMessageList->GetAt(itemIndex, itemName);
978 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
979 isShowSendButton = false;
982 Label* pMsgLbl = new (std::nothrow) Label();
983 pMsgLbl->Construct(itemRect, itemName);
984 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
985 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
986 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
987 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
988 pItem->AddControl(*pMsgLbl);
991 if(isShowSendButton == true)
993 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
994 Button* pSendButton = new (std::nothrow) Button();
995 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);
996 //set action id and listener
997 int actionId = IDA_SEND_REJECT_MSG1;
1001 actionId = IDA_SEND_REJECT_MSG1;
1004 actionId = IDA_SEND_REJECT_MSG2;
1007 actionId = IDA_SEND_REJECT_MSG3;
1010 actionId = IDA_SEND_REJECT_MSG4;
1013 actionId = IDA_SEND_REJECT_MSG5;
1016 actionId = IDA_SEND_REJECT_MSG6;
1019 pSendButton->SetActionId(actionId);
1020 pSendButton->AddActionEventListener(*this);
1021 pItem->AddControl(*pSendButton);
1022 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1026 pItem->SetEnabled(false);
1033 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1041 IncomingCallForm::GetDefaultItemHeight(void)
1043 return H_LIST_NORMAL_MENU_ITEM;
1047 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, AppCallInfo* pCallInfo)
1049 //call individual methods to show contact number, caller name & photo
1050 SetTextToLabel(phoneNumber, contactLblName);
1052 //fetch contact details based on phone number
1053 String* pDisplayName = pCallInfo->FetchCallerNameN();
1054 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1055 ShowCallerPhoto(pPhotoBitmap);
1060 SetTextToLabel(*pDisplayName, nameLblName);
1061 delete pDisplayName;
1062 pDisplayName = null;
1067 delete pPhotoBitmap;
1068 pPhotoBitmap = null;
1073 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1075 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1076 //passing an empty string to SetText fails in label,
1077 //if previously valid text has been set
1078 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1080 String stringToBeSet(L"");
1081 pContactLbl->SetText(stringToBeSet);
1086 pContactLbl->SetText(textToBeSet);
1091 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1093 bool showSmallPhoto = false;
1094 //show photo - for Big Photo Id, Animated Call Image
1095 if (pPhotoId == null)
1097 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1101 //Check the size of photo
1102 // Now checking the condition with && but actually it should be ||
1103 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1104 // height 270 and width = 480 . So all images set thru gallery is show as small image
1105 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1106 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1108 showSmallPhoto = true;
1112 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1113 if(showSmallPhoto == true)
1115 ShowThumbnailImage(pPhotoId);
1119 if (pPhotoLbl != null && pPhotoId != null)
1121 Canvas* pCanvas = new (std::nothrow) Canvas;
1122 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1123 pCanvas->Construct(canvasRect);
1124 //draw the contact bitmap
1125 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1126 Bitmap* pNewPhotoId = new Bitmap();
1127 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1130 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1131 pPhotoLbl->Invalidate(true);
1138 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1140 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1142 if (pPhotoLbl != null && pPhotoId != null)
1144 Canvas* pCanvas = new (std::nothrow) Canvas;
1145 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1146 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1147 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1148 pCanvas->Construct(canvasRect);
1149 //draw the back ground
1150 pCanvas->DrawBitmap(canvasRect,*pBackground);
1151 //draw shadow (to be enabled after correct shadow image is provided )
1152 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1153 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1154 //draw the contact bitmap
1155 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1156 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1157 Bitmap* pNewPhotoId = new Bitmap();
1158 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1161 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1162 pPhotoLbl->Invalidate(true);
1171 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1173 //Draw Small Photo and show on small photo label
1174 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1175 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1176 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1177 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1178 // Add a Label to the Form
1179 AddControl(*__pSmallPhotoLabel);
1180 __pSmallPhotoLabel->Invalidate(true);
1184 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1186 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1187 if (pTimerLbl != null)
1189 pTimerLbl->SetText(textToBeDisplayed);
1194 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1195 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1198 Button* pButton = null;
1199 if (isButtonInPanel == false)
1201 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1205 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1206 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1208 Bitmap* pHoldBmp = null;
1209 Canvas* pCanvas = null;
1210 pCanvas = new (std::nothrow) Canvas();
1211 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1212 //set bitmap to button
1213 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1216 //scale bitmap to predefined size
1217 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1218 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1219 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1223 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1226 //scale bitmap to predefined size
1227 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1228 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1229 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1237 String holdBtnName = AppUtility::GetResourceString(btnName);
1238 FloatDimension textDimension;
1239 if (!holdBtnName.IsEmpty())
1242 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1243 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1244 textDimension.height = textDimension.height + font.GetDescender();
1245 TextElement* pTextElement = new (std::nothrow) TextElement();
1246 pTextElement->Construct(holdBtnName);
1247 Color textColor(249, 249, 249);
1248 if (setButtonPressBitmap)
1250 textColor.SetAlpha(255);
1254 textColor.SetAlpha(127);
1257 pTextElement->SetTextColor(textColor);
1258 pTextElement->SetFont(font);
1260 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1261 pEnrichedText->Construct(textDimension);
1262 pEnrichedText->Add(*pTextElement);
1263 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1264 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1265 pCanvas->DrawText(textPos, *pEnrichedText);
1267 pEnrichedText->RemoveAll(true);
1268 delete pEnrichedText;
1272 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1275 //scale bitmap to predefined size
1276 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1277 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1278 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1279 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1282 //set background bitmpa to button
1283 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1284 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1285 if (setButtonPressBitmap)
1287 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1291 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1293 delete pActualBgBmp;
1298 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1301 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1303 //__pCallPresentor->StopAlert();
1304 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1306 Rectangle rect = source.GetBounds();
1307 if (source.Equals(*__pAcceptLabel))
1309 __isAnswerCallStarted = true;
1310 __isRejectCallStarted = false;
1312 else if (source.Equals(*__pRejectLabel))
1314 __isAnswerCallStarted = false;
1315 __isRejectCallStarted = true;
1319 // touch event between the 2 labels. So Do nothing
1326 // On Touch released, the animation and the visual elements disappear
1328 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1330 AppLogDebug("%d",currentPosition.x);
1331 if (__isAnswerCallStarted == true)
1333 if (currentPosition.x > __pRejectLabel->GetBounds().x)
1336 if(__pRejectFinalVisElem == null)
1338 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1339 __pRejectFinalVisElem->Construct();
1340 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1342 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1343 __pRejectFinalVisElem->SetShowState(true);
1344 __pRejectFinalVisElem->SetOpacity(1.00f);
1345 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1347 AppLogDebug("AttachChild __pRejectFinalVisElem");
1348 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1350 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1353 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1354 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1355 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1356 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1360 __pAcceptVisElem->SetOpacity(0.0f);
1361 //fetch already active call list
1362 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1363 if (pCallList != null && pCallList->GetCount() > 0)
1365 //then atleast 1 active call exist.
1366 AppCallInfo phnCallInfo;
1367 pCallList->GetAt(0,phnCallInfo);
1368 //Check if only 1 call exist and it is on Hold
1369 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1371 //directly accept call
1372 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1376 //Either 1 call exist and not "on Hold".
1378 if(__pOptionPopup != null)
1380 delete __pOptionPopup;
1381 __pOptionPopup = null;
1383 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1384 __pOptionPopup->Initialize();
1385 __pOptionPopup->SetShowState(true);
1386 __pOptionPopup->Draw();
1387 __pOptionPopup->Show();
1389 pCallList->RemoveAll();
1393 //no active call - Accept the incoming call
1394 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1401 __pAcceptVisElem->SetOpacity(1.0f);
1402 __pRejectVisElem->SetOpacity(1.00f);
1406 else if (__isRejectCallStarted == true)
1408 if (currentPosition.x < ((__pAcceptLabel->GetBounds().x + __pAcceptLabel->GetWidth())- __pRejectLabel->GetBounds().x))
1411 if(__pAcceptFinalVisElem == null)
1413 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1414 __pAcceptFinalVisElem->Construct();
1415 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1417 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1418 __pAcceptFinalVisElem->SetOpacity(1.0f);
1421 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1423 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1424 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1426 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1429 AppLogDebug("__pAcceptFinalVisElem drawing");
1430 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1431 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1432 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1433 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1434 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1437 __pRejectVisElem->SetOpacity(0.0f);
1439 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1443 __pAcceptVisElem->SetOpacity(1.0f);
1444 __pRejectVisElem->SetOpacity(1.00f);
1448 __isAnswerCallStarted = false;
1449 __isRejectCallStarted = false;
1453 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1455 if (__isAnswerCallStarted == true)
1457 if (currentPosition.x > 170 && currentPosition.x < 578)
1459 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1461 __pRejectVisElem->SetOpacity(0.60f);
1462 __pAcceptVisElem->SetOpacity(0.60f);
1466 __pRejectVisElem->SetOpacity(1.0f);
1467 __pAcceptVisElem->SetOpacity(1.0f);
1472 if (__isRejectCallStarted == true)
1474 if (currentPosition.x < 0 && currentPosition.x > -522)
1476 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1478 __pRejectVisElem->SetOpacity(0.60f);
1479 __pAcceptVisElem->SetOpacity(0.60f);
1483 __pRejectVisElem->SetOpacity(1.0f);
1484 __pAcceptVisElem->SetOpacity(1.0f);
1491 IncomingCallForm::OnItemSelected(int itemIndex)
1493 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1496 //display name, mobile number
1497 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1498 pArgs->Add(argIndex);
1499 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1503 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1505 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1507 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1509 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1511 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1514 __pAcceptVisElem->SetOpacity(1.0f);
1515 __pRejectVisElem->SetOpacity(1.00f);
1517 if (__pRejectFinalVisElem != null)
1519 __pRejectFinalVisElem->Destroy();
1520 __pRejectFinalVisElem = null;
1522 if (__pAcceptFinalVisElem != null)
1524 __pAcceptFinalVisElem->Destroy();
1525 __pAcceptFinalVisElem = null;
1530 delete __pOptionPopup;
1531 __pOptionPopup = null;
1534 if(itemIndex != IDA_BUTTON_CANCEL_OPTIONS_POPUP)
1536 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1541 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1545 case REQUEST_ITEM_SELECTED:
1549 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1552 HandleMultipleCallSelection(index->ToInt());
1561 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1563 AppLogDebug("Enter");
1566 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1567 if (pButtonRejectMessage)
1569 pButtonRejectMessage->SetShowState(true);
1570 pButtonRejectMessage->Invalidate(true);
1571 pButtonRejectMessage->Draw();
1573 RequestRedraw(true);
1578 IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1580 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1581 if(pKeysPanel->GetShowState() == true)
1583 HideRejectMessagePanel();
1584 ShowRejectMessagePanel();
1587 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1588 if (pButtonRejectMessage != null)
1590 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1591 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
1592 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1593 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
1594 pButtonRejectMessage->Invalidate(true);
1597 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1598 if (pButtonReject != null)
1600 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1601 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
1602 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1603 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
1604 pButtonReject->Invalidate(true);
1609 IncomingCallForm::OnForeground(void)
1611 __pCallPresentor->OnAppForeground();
1615 IncomingCallForm::OnScreenOff(void)
1617 __pCallPresentor->StopAlert();
1621 IncomingCallForm::CallDisconnected(void)
1623 //check if no call option popup is shown, then remain on incoming call screen.
1624 //As user has neither accepted nor rejected incoming call.
1625 if (__pOptionPopup == null)
1630 //fetch already active call list and show updated option popup
1631 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1632 if (pCallList != null && pCallList->GetCount() > 0)
1634 //then atleast 1 active call exist.
1635 AppCallInfo phnCallInfo;
1636 pCallList->GetAt(0,phnCallInfo);
1637 //Check if only 1 call exist and it is on Hold
1638 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1640 //directly accept call
1641 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1645 //Either 1 call exist and not "on Hold".
1647 if(__pOptionPopup != null)
1649 delete __pOptionPopup;
1650 __pOptionPopup = null;
1652 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1653 __pOptionPopup->Initialize();
1654 __pOptionPopup->SetShowState(true);
1655 __pOptionPopup->Draw();
1656 __pOptionPopup->Show();
1658 pCallList->RemoveAll();
1662 //no active call - Accept the incoming call
1663 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);