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 H_SEND_TEXT_ITEM = 72;
87 const int X_PHOTO_LBL = 166;
88 const int Y_PHOTO_LBL = 232;
89 const int W_PHOTO_LBL = 388;
90 const int H_PHOTO_LBL = 388;
91 const int W_PHOTO_LABEL = 720;
92 const int H_PHOTO_LABEL = 720;
93 const int COUNT_ARROW_ELEMENTS = 3;
95 const unsigned int COLOR_SEND_BUTTON_PRESSED = Color32<130, 142, 150>::Value;
96 const unsigned int COLOR_SEND_BUTTON_NORMAL = Color32<64, 156, 211>::Value;
97 const unsigned int COLOR_SWIPE_PANEL = Color32<0, 0, 0, 255>::Value;
98 const unsigned int COLOR_LIST_TEXT_NORMAL = Color32<0, 0, 0>::Value;
99 const unsigned int COLOR_LIST_TEXT_PRESSED = Color32<249, 249, 249>::Value;
101 const int FONT_SIZE_MSG_TXT = 44;
103 static const wchar_t* IDL_INCOMING_CALL_FORM = L"IDL_INCOMING_CALL_FORM";
104 static const wchar_t* IDB_REJECT_MESSAGE_BG = L"C01-1_Reject_message_bg.png";
105 static const wchar_t* IDB_REJECT_MESSAGE_UP_ARROW = L"C01-1_Reject_message_arrow_01.png";
106 static const wchar_t* IDB_REJECT_MESSAGE_DOWN_ARROW = L"C01-1_Reject_message_arrow_02.png";
107 static const wchar_t* IDB_REJECT_MESSAGE_ICON = L"C01-1_icon_Reject_with_Message.png";
108 static const wchar_t* IDB_ACCEPT_CIRCLE_ICON = L"C01-1_accept_left.png";
109 static const wchar_t* IDB_REJECT_CIRCLE_ICON = L"C01-1_reject_right.png";
110 static const wchar_t* IDB_CALL_ACCEPT_ICON = L"C01-1_accept_left_dial_answer.png";
111 static const wchar_t* IDB_CALL_REJECT_ICON = L"C01-1_reject_right_dial_decline.png";
112 static const wchar_t* IDB_ACCEPT_ARROW_ICON = L"C01-1_arrow_g.png";
113 static const wchar_t* IDB_REJECT_ARROW_ICON = L"C01-1_arrow_r.png";
114 static const wchar_t* IDB_CALL_BG = L"C01-1_calling_BG_01.png";
115 static const wchar_t* IDC_REJECT_MESSAGE_BUTTON = L"IDC_REJECT_MESSAGE_BUTTON";
116 static const wchar_t* IDC_REJECT_PANEL = L"IDC_REJECT_PANEL";
117 static const wchar_t* IDC_REJECT_MESSAGE_CANCEL_BUTTON = L"IDC_REJECT_MESSAGE_CANCEL_BUTTON";
118 static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
119 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
120 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
121 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
122 static const wchar_t* IDC_CALLHANDEL_PANEL = L"IDC_CALLHANDEL_PANEL";
123 static const wchar_t* IDC_ACCEPT_LABEL = L"IDC_ACCEPT_LABEL";
124 static const wchar_t* IDC_REJECT_LEBEL = L"IDC_REJECT_LEBEL";
125 static const wchar_t* IDC_ACCEPT_ARROW = L"IDC_ACCEPT_ARROW_";
126 static const wchar_t* IDC_REJECT_ARROW = L"IDC_REJECT_ARROW_";
127 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
128 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
129 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
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;
201 VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
202 r = pFormVisElem->Construct();
203 pFormVisElem->SetBounds(FloatRectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
204 pFormVisElem->SetShowState(true);
205 pFormVisElem->SetOpacity(1.0f);
206 pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
207 GetVisualElement()->AttachChild(*pFormVisElem);
208 pCanvas = pFormVisElem->GetCanvasN();
212 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
213 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
214 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
220 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
221 if (pButtonRejectMessage)
223 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
224 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
225 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
226 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
227 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
228 pButtonRejectMessage->AddActionEventListener(*this);
231 //Get Reject list from Settings Manager
232 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
235 __pRejectMessageList = pMsgMap->GetValuesN();
239 InitializeTableView();
241 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
242 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
243 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
244 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
245 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
246 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
249 if(__pRejectDial == null)
253 //Panel for showing accept and reject call buttons.
254 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
255 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
257 __pCallHandlePanel = static_cast<Panel*>(GetControl(IDC_CALLHANDEL_PANEL, true));
258 __pCallHandlePanel->AddTouchEventListener(*this);
259 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
260 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
261 r = pCallPanelVisElem->Construct();
262 pCallPanelVisElem->SetBounds(FloatRectangle(__pCallHandlePanel->GetBoundsF()));
263 pCallPanelVisElem->SetShowState(true);
264 pCallPanelVisElem->SetOpacity(1.0f);
265 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
266 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
267 pCanvas = pCallPanelVisElem->GetCanvasN();
270 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
272 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
273 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
274 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
278 //Lock Label for animation
279 __pAcceptLabel = static_cast<Label*>(GetControl(IDC_ACCEPT_LABEL, true));
280 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
281 __pAcceptLabel->AddTouchEventListener(*this);
283 __pAcceptVisElem = new (std::nothrow) VisualElement();
284 r = __pAcceptVisElem->Construct();
285 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, __pAcceptLabel->GetWidth(), __pAcceptLabel->GetHeight()));
286 __pAcceptVisElem->SetShowState(true);
287 __pAcceptVisElem->SetOpacity(1.0f);
288 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
289 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
290 pCanvas = __pAcceptVisElem->GetCanvasN();
293 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
295 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
296 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
297 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
298 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
299 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
303 //UnLock Label for animation
304 __pRejectLabel = static_cast<Label*>(GetControl(IDC_REJECT_LEBEL, true));
305 __pRejectLabel->AddTouchEventListener(*this);
306 __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
307 SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
310 __pRejectVisElem = new (std::nothrow) VisualElement();
311 r = __pRejectVisElem->Construct();
312 __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
313 __pRejectVisElem->SetShowState(true);
314 __pRejectVisElem->SetOpacity(1.00f);
315 __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
316 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
317 pCanvas = __pRejectVisElem->GetCanvasN();
320 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
322 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
323 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
324 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
325 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
326 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
331 //! Constructs an array list to store the unlock labels
332 __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
333 r = __pAcceptArrowLabelsList->Construct();
335 //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
336 int x = X_ARROW_LABEL_STARTPOS;
337 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
339 String LabelName(IDC_ACCEPT_ARROW);
340 LabelName.Append(index+1);
341 __pAcceptArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
342 __pAcceptArrowLabel->AddTouchEventListener(*this);
343 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
344 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
345 r = __pAcceptArrowVisElem->Construct();
346 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
347 __pAcceptArrowVisElem->SetShowState(true);
348 __pAcceptArrowVisElem->SetOpacity(0.0f);
349 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
350 VisualEleName.Append(index);
351 __pAcceptArrowVisElem->SetName(VisualEleName);
352 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
353 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
356 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
358 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
359 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
360 pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
361 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
362 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
366 x += ARROW_LABEL_X_MARGIN;
368 //! Constructs an array list to store the unlock labels
369 __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
370 r = __pRejectArrowLabelsList->Construct();
372 x = X_ARROW_REJECT_LABEL_STARTPOS;
373 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
375 String LabelName(IDC_REJECT_ARROW);
376 LabelName.Append(index+1);
377 __pRejectArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
378 __pRejectArrowLabel->AddTouchEventListener(*this);
379 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
380 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
381 r = __pRejectArrowVisElem->Construct();
382 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
383 __pRejectArrowVisElem->SetShowState(true);
384 __pRejectArrowVisElem->SetOpacity(0.0f);
385 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
386 VisualEleName.Append(index);
387 __pRejectArrowVisElem->SetName(VisualEleName);
388 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
389 pCanvas = __pRejectArrowVisElem->GetCanvasN();
392 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
394 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
395 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
396 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
397 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
401 x -= ARROW_LABEL_X_MARGIN;
409 IncomingCallForm::InitializeFooter(void)
411 Footer* pFooter = GetFooter();
412 FooterItem footerItemCreate;
414 SetFormBackEventListener(this);
417 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
418 pFooter->AddActionEventListener(*this);
420 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
421 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
422 pFooter->AddItem(footerItemCreate);
423 pFooter->SetBackButton();
424 pFooter->SetShowState(false);
429 IncomingCallForm::ShowRejectMessageFooter(void)
431 Footer* pFooter = GetFooter();
434 AppLogDebug("SetShowState");
435 pFooter->SetShowState(true);
441 IncomingCallForm::HideRejectMessageFooter(void)
443 Footer* pFooter = GetFooter();
446 pFooter->SetShowState(false);
451 IncomingCallForm::OnTerminating(void)
453 result r = E_SUCCESS;
455 if (__pRejectMessageList != null)
457 delete __pRejectMessageList;
458 __pRejectMessageList = null;
460 if (__pActiveContactNo != null)
462 delete __pActiveContactNo;
463 __pActiveContactNo = null;
465 __incomingCallHandle = -1;
466 __pCallPresentor = null;
468 /* Deleting fails in A4RC* SDK. Remove if not necessary
469 if (__pAcceptVisElem != null)
471 __pAcceptVisElem->Destroy();
472 __pAcceptVisElem = null;
475 if (__pRejectVisElem != null)
477 __pRejectVisElem->Destroy();
478 __pRejectVisElem = null;
481 if (__pRejectFinalVisElem != null)
483 __pRejectFinalVisElem->Destroy();
484 __pRejectFinalVisElem = null;
487 if (__pAcceptFinalVisElem != null)
489 __pAcceptFinalVisElem->Destroy();
490 __pAcceptFinalVisElem = null;
493 for (int i = 0; i < 7; i++)
495 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
496 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
497 if (__pRejectArrowVisElem != null)
499 __pRejectArrowVisElem->Destroy();
500 __pRejectArrowVisElem = null;
503 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
504 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
505 if (__pAcceptArrowVisElem != null)
507 __pAcceptArrowVisElem->Destroy();
508 __pAcceptArrowVisElem = null;
512 if (__pAcceptArrowVisElem != null)
514 __pAcceptArrowVisElem = null;
517 if (__pRejectArrowVisElem != null)
519 __pRejectArrowVisElem = null;
522 if (__pAcceptArrowLabelsList != null)
524 __pAcceptArrowLabelsList->RemoveAll(false);
525 delete __pAcceptArrowLabelsList;
526 __pAcceptArrowLabelsList = null;
529 if (__pRejectArrowLabelsList != null)
531 __pRejectArrowLabelsList->RemoveAll(false);
532 delete __pRejectArrowLabelsList;
533 __pRejectArrowLabelsList = null;
536 if (__pRejectCircle != null)
538 delete __pRejectCircle;
539 __pRejectCircle = null;
542 if (__pAcceptCircle != null)
544 delete __pAcceptCircle;
545 __pAcceptCircle = null;
548 if (__pAcceptDial != null)
550 delete __pAcceptDial;
551 __pAcceptDial = null;
554 if (__pRejectDial != null)
556 delete __pRejectDial;
557 __pRejectDial = null;
560 if (__pAcceptArrow != null)
562 delete __pAcceptArrow;
563 __pAcceptArrow = null;
566 if (__pRejectArrow != null)
568 delete __pRejectArrow;
569 __pRejectArrow = null;
571 __pCallHandlePanel->RemoveTouchEventListener(*this);
572 __pAcceptLabel->RemoveTouchEventListener(*this);
573 __pRejectLabel->RemoveTouchEventListener(*this);
574 __pAcceptArrowLabel->RemoveTouchEventListener(*this);
575 __pRejectArrowLabel->RemoveTouchEventListener(*this);
576 __pAcceptLabel = null;
577 __pRejectLabel = null;
578 __pAcceptArrowLabel = null;
579 __pRejectArrowLabel = null;
580 __pCallHandlePanel = null;
585 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
589 case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
591 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
594 pKeysPanel->SetShowState(true);
595 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
596 Rectangle tmpRect = pMessageList->GetBounds();
597 SetControlAlwaysOnTop(*pKeysPanel,true);
599 //Set Height to Reject Message Panel
600 int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
601 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
603 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
605 if (listHeight > MAX_LIST_HEIGHT)
607 listHeight = MAX_LIST_HEIGHT;
610 pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
611 tmpRect = pKeysPanel->GetBounds();
612 pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight);
614 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
615 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
616 pButtonReject->AddActionEventListener(*this);
617 pButtonReject->SetEnabled(true);
618 pButtonReject->SetFocus();
620 ShowRejectMessageFooter();
622 /* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_BACK_BUTTON));
623 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
624 pButtonReject->AddActionEventListener(*this);
625 pButtonReject->SetEnabled(true);
626 pButtonReject->SetFocus();
628 Button* pButtonCreate = static_cast<Button*>(pKeysPanel->GetControl(IDC_CREATE_BUTTON));
629 pButtonCreate->SetActionId(IDA_CREATE_REJECT_CALL_MESSAGE);
630 pButtonCreate->AddActionEventListener(*this);
631 pButtonCreate->SetEnabled(true);
632 pButtonCreate->SetFocus();*/
634 pKeysPanel->SetFocus();
637 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
638 if (pButtonRejectMessage)
640 pButtonRejectMessage->SetShowState(false);
641 pButtonRejectMessage->Invalidate(true);
642 pButtonRejectMessage->Draw();
647 case IDA_CREATE_REJECT_CALL_MESSAGE:
649 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
650 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
651 if(pCallList != null && pCallList->GetCount() > 0)
653 __pCallPresentor->HandleCallConnected(*pCallList);
659 case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
663 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
664 if (pButtonRejectMessage)
666 pButtonRejectMessage->SetShowState(true);
667 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
668 if (pRelativeLayout != null)
670 pRelativeLayout->SetRelation(*pButtonRejectMessage,*this,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
671 pRelativeLayout->Update();
672 delete pRelativeLayout;
679 case IDA_SEND_REJECT_MSG1:
680 case IDA_SEND_REJECT_MSG2:
681 case IDA_SEND_REJECT_MSG3:
682 case IDA_SEND_REJECT_MSG4:
683 case IDA_SEND_REJECT_MSG5:
684 case IDA_SEND_REJECT_MSG6:
686 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
687 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
688 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
689 result r = pSmsManager->Construct(*pSmsListener);
690 if (IsFailed(r) == false)
692 RecipientList recipient;
693 recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
694 SmsMessage smsMessage;
697 int msgIndex = IDA_SEND_REJECT_MSG1;
698 msgIndex = actionId - msgIndex;
699 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
700 r = smsMessage.SetText(textToBeSent);
701 if (IsFailed(r) == false)
703 r = pSmsManager->Send(smsMessage,recipient,true);
704 if (IsFailed(r) == true)
706 //todo: error message
711 //todo: error message
716 //todo: error message
720 /*ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
721 __pCallPresentor->HandleCallConnected(*pCallList);
732 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
734 AddOrientationEventListener(*this);
735 if(__pCallPresentor == null)
737 __pCallPresentor = CallPresentationModel::GetInstance();
739 __pCallPresentor->SetTelEventListener(this);
742 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
744 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
746 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
748 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
751 __pAcceptVisElem->SetOpacity(1.0f);
752 __pRejectVisElem->SetOpacity(1.00f);
753 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
755 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
756 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
757 RejectVisualEleName.Append(i);
758 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
759 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
760 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
761 AcceptVisualEleName.Append(i);
762 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
766 __pAcceptArrowVisElem->SetOpacity(0.6f);
767 __pRejectArrowVisElem->SetOpacity(0.6f);
770 __pAcceptArrowVisElem->SetOpacity(0.8f);
771 __pRejectArrowVisElem->SetOpacity(0.8f);
774 __pAcceptArrowVisElem->SetOpacity(1.0f);
775 __pRejectArrowVisElem->SetOpacity(1.0f);
785 AppCallInfo* pIncomingCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
786 if (pIncomingCall != null)
788 //start alert with contact's custom ringtone
789 __pCallPresentor->StartAlert(*pIncomingCall);
790 //show contact number
792 contactNo.Append(pIncomingCall->GetContactNumber());
793 if (__pActiveContactNo)
795 delete __pActiveContactNo;
796 __pActiveContactNo = null;
798 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
799 __pActiveContactNo = new (std::nothrow) String();
801 if(contactNo.IsEmpty())
803 AppLogDebug("Number empty");
804 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
805 AppLogDebug("%ls",contactNo.GetPointer());
807 __pActiveContactNo->Append(contactNo);
808 //Show person details
809 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
810 //Check if incoming call is hidden call, then do not show "Reject with Message" button
811 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
812 if (pButtonRejectMessage)
814 //for hidden call, contact number is not present
815 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
816 pButtonRejectMessage->SetShowState(showRejectMsgButton);
817 pButtonRejectMessage->Invalidate(true);
824 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
825 pCallApp->SetTopMostWindow(true);
831 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
833 RemoveOrientationEventListener(*this);
834 if (__pSmallPhotoLabel != null)
836 RemoveControl(*__pSmallPhotoLabel);
837 __pSmallPhotoLabel = null;
839 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
841 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
842 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
843 RejectVisualEleName.Append(i);
844 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
845 __pRejectArrowVisElem->SetOpacity(0.0f);
846 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
847 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
848 AcceptVisualEleName.Append(i);
849 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
850 __pAcceptArrowVisElem->SetOpacity(0.0f);
852 if(__pAcceptLabel != null)
854 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
856 AppLogDebug("__pAcceptLabel Detatach child");
857 __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
860 if(__pRejectLabel != null)
862 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
864 AppLogDebug("__pRejectLabel Detatach child");
865 __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
869 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
870 pCallApp->SetTopMostWindow(false);
874 IncomingCallForm::OnDraw(void)
876 Bitmap* pBackgroundWp = null;
877 // get a Canvas instance
878 Canvas* pCanvas = GetCanvasN();
880 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
887 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
891 delete pBackgroundWp;
892 pBackgroundWp = null;
901 IncomingCallForm::HideRejectPanel(void)
903 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
906 pKeysPanel->SetShowState(false);
907 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
908 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
909 pButtonReject->AddActionEventListener(*this);
910 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
911 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
912 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
913 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
915 HideRejectMessageFooter();
916 pKeysPanel->Invalidate(true);
921 IncomingCallForm::InitializeTableView(void)
923 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
925 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
926 pMessageList->SetItemProvider(this);
927 pMessageList->AddTableViewItemEventListener(*this);
930 ///////////////////////////////////////////////////////////////////////////////
931 ///// Table View Functionality supporting functions /////
932 //////////////////////////////////////////////////////////////////////////////
934 IncomingCallForm::GetItemCount(void)
936 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
938 return (__pRejectMessageList->GetCount());
944 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
947 TableViewItem* pItem = new (std::nothrow) TableViewItem();
948 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
950 //Message text item rectangle
951 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
954 String itemName(L"");
955 bool isShowSendButton = true;
956 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
958 __pRejectMessageList->GetAt(itemIndex, itemName);
962 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
963 isShowSendButton = false;
966 Label* pMsgLbl = new (std::nothrow) Label();
967 pMsgLbl->Construct(itemRect, itemName);
968 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
969 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
970 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
971 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
972 pItem->AddControl(*pMsgLbl);
975 if(isShowSendButton == true)
977 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
978 Button* pSendButton = new (std::nothrow) Button();
979 pSendButton->Construct(Rectangle(X_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
980 //set action id and listener
981 int actionId = IDA_SEND_REJECT_MSG1;
985 actionId = IDA_SEND_REJECT_MSG1;
988 actionId = IDA_SEND_REJECT_MSG2;
991 actionId = IDA_SEND_REJECT_MSG3;
994 actionId = IDA_SEND_REJECT_MSG4;
997 actionId = IDA_SEND_REJECT_MSG5;
1000 actionId = IDA_SEND_REJECT_MSG6;
1003 pSendButton->SetActionId(actionId);
1004 pSendButton->AddActionEventListener(*this);
1005 pItem->AddControl(*pSendButton);
1006 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1010 pItem->SetEnabled(false);
1017 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1025 IncomingCallForm::GetDefaultItemHeight(void)
1027 return H_LIST_NORMAL_MENU_ITEM;
1031 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, AppCallInfo* pCallInfo)
1033 //call individual methods to show contact number, caller name & photo
1034 SetTextToLabel(phoneNumber, contactLblName);
1036 //fetch contact details based on phone number
1037 String* pDisplayName = pCallInfo->FetchCallerNameN();
1038 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1039 ShowCallerPhoto(pPhotoBitmap);
1044 SetTextToLabel(*pDisplayName, nameLblName);
1045 delete pDisplayName;
1046 pDisplayName = null;
1051 delete pPhotoBitmap;
1052 pPhotoBitmap = null;
1057 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1059 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1060 //passing an empty string to SetText fails in label,
1061 //if previously valid text has been set
1062 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1064 String stringToBeSet(L"");
1065 pContactLbl->SetText(stringToBeSet);
1070 pContactLbl->SetText(textToBeSet);
1075 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1077 bool showSmallPhoto = false;
1078 //show photo - for Big Photo Id, Animated Call Image
1079 if (pPhotoId == null)
1081 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1085 //Check the size of photo
1086 // Now checking the condition with && but actually it should be ||
1087 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1088 // height 270 and width = 480 . So all images set thru gallery is show as small image
1089 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1090 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1092 showSmallPhoto = true;
1096 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1097 if(showSmallPhoto == true)
1099 ShowThumbnailImage(pPhotoId);
1103 if (pPhotoLbl != null && pPhotoId != null)
1105 Canvas* pCanvas = new (std::nothrow) Canvas;
1106 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1107 pCanvas->Construct(canvasRect);
1108 //draw the contact bitmap
1109 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1110 Bitmap* pNewPhotoId = new Bitmap();
1111 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1114 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1115 pPhotoLbl->Invalidate(true);
1122 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1124 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1126 if (pPhotoLbl != null && pPhotoId != null)
1128 Canvas* pCanvas = new (std::nothrow) Canvas;
1129 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1130 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1131 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1132 pCanvas->Construct(canvasRect);
1133 //draw the back ground
1134 pCanvas->DrawBitmap(canvasRect,*pBackground);
1135 //draw shadow (to be enabled after correct shadow image is provided )
1136 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1137 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1138 //draw the contact bitmap
1139 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1140 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1141 Bitmap* pNewPhotoId = new Bitmap();
1142 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1145 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1146 pPhotoLbl->Invalidate(true);
1155 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1157 //Draw Small Photo and show on small photo label
1158 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1159 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1160 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1161 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1162 // Add a Label to the Form
1163 AddControl(*__pSmallPhotoLabel);
1164 __pSmallPhotoLabel->Invalidate(true);
1168 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1170 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1171 if (pTimerLbl != null)
1173 pTimerLbl->SetText(textToBeDisplayed);
1178 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1179 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1182 Button* pButton = null;
1183 if (isButtonInPanel == false)
1185 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1189 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1190 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1192 Bitmap* pHoldBmp = null;
1193 Canvas* pCanvas = null;
1194 pCanvas = new (std::nothrow) Canvas();
1195 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1196 //set bitmap to button
1197 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1200 //scale bitmap to predefined size
1201 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1202 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1203 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1207 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1210 //scale bitmap to predefined size
1211 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1212 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1213 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1221 String holdBtnName = AppUtility::GetResourceString(btnName);
1222 Dimension textDimension;
1223 if (!holdBtnName.IsEmpty())
1226 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1227 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1228 textDimension.height = textDimension.height + font.GetDescender();
1229 TextElement* pTextElement = new (std::nothrow) TextElement();
1230 pTextElement->Construct(holdBtnName);
1231 Color textColor(249, 249, 249);
1232 if (setButtonPressBitmap)
1234 textColor.SetAlpha(255);
1238 textColor.SetAlpha(127);
1241 pTextElement->SetTextColor(textColor);
1242 pTextElement->SetFont(font);
1244 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1245 pEnrichedText->Construct(textDimension);
1246 pEnrichedText->Add(*pTextElement);
1247 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1248 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1249 pCanvas->DrawText(textPos, *pEnrichedText);
1251 pEnrichedText->RemoveAll(true);
1252 delete pEnrichedText;
1256 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1259 //scale bitmap to predefined size
1260 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1261 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1262 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1263 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1266 //set background bitmpa to button
1267 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1268 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1269 if (setButtonPressBitmap)
1271 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1275 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1277 delete pActualBgBmp;
1282 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1285 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1287 __pCallPresentor->StopAlert();
1288 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1290 Rectangle rect = source.GetBounds();
1291 if (source.Equals(*__pAcceptLabel))
1293 __isAnswerCallStarted = true;
1294 __isRejectCallStarted = false;
1296 else if (source.Equals(*__pRejectLabel))
1298 __isAnswerCallStarted = false;
1299 __isRejectCallStarted = true;
1303 // touch event between the 2 labels. So Do nothing
1310 // On Touch released, the animation and the visual elements disappear
1312 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1314 if (__isAnswerCallStarted == true)
1316 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1319 if(__pRejectFinalVisElem == null)
1321 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1323 __pRejectFinalVisElem->Construct();
1324 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1325 __pRejectFinalVisElem->SetShowState(true);
1326 __pRejectFinalVisElem->SetOpacity(1.00f);
1327 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1328 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1330 AppLogDebug("AttachChild __pRejectFinalVisElem");
1331 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1333 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1336 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1337 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1338 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1339 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1343 __pAcceptVisElem->SetOpacity(0.0f);
1344 //fetch already active call list
1345 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1346 if (pCallList != null && pCallList->GetCount() > 0)
1348 //then atleast 1 active call exist.
1349 AppCallInfo phnCallInfo;
1350 pCallList->GetAt(0,phnCallInfo);
1351 //Check if only 1 call exist and it is on Hold
1352 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1354 //directly accept call
1355 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1359 //Either 1 call exist and not "on Hold".
1361 if(__pOptionPopup != null)
1363 delete __pOptionPopup;
1364 __pOptionPopup = null;
1366 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1367 __pOptionPopup->Initialize();
1368 __pOptionPopup->SetShowState(true);
1369 __pOptionPopup->Draw();
1370 __pOptionPopup->Show();
1372 pCallList->RemoveAll();
1376 //no active call - Accept the incoming call
1377 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1384 __pAcceptVisElem->SetOpacity(1.0f);
1385 __pRejectVisElem->SetOpacity(1.00f);
1389 else if (__isRejectCallStarted == true)
1391 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1394 if(__pAcceptFinalVisElem == null)
1396 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1398 __pAcceptFinalVisElem->Construct();
1399 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1400 __pAcceptFinalVisElem->SetShowState(true);
1401 __pAcceptFinalVisElem->SetOpacity(1.0f);
1402 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1403 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1405 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1406 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1408 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1411 AppLogDebug("__pAcceptFinalVisElem drawing");
1412 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1413 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1414 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1415 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1416 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1419 __pRejectVisElem->SetOpacity(0.0f);
1421 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1425 __pAcceptVisElem->SetOpacity(1.0f);
1426 __pRejectVisElem->SetOpacity(1.00f);
1430 __isAnswerCallStarted = false;
1431 __isRejectCallStarted = false;
1435 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1437 if (__isAnswerCallStarted == true)
1439 if (currentPosition.x > 170 && currentPosition.x < 578)
1441 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1443 __pRejectVisElem->SetOpacity(0.60f);
1444 __pAcceptVisElem->SetOpacity(0.60f);
1448 __pRejectVisElem->SetOpacity(1.0f);
1449 __pAcceptVisElem->SetOpacity(1.0f);
1454 if (__isRejectCallStarted == true)
1456 if (currentPosition.x < 0 && currentPosition.x > -522)
1458 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1460 __pRejectVisElem->SetOpacity(0.60f);
1461 __pAcceptVisElem->SetOpacity(0.60f);
1465 __pRejectVisElem->SetOpacity(1.0f);
1466 __pAcceptVisElem->SetOpacity(1.0f);
1473 IncomingCallForm::OnItemSelected(int itemIndex)
1476 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1479 //display name, mobile number
1480 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1481 pArgs->Add(argIndex);
1482 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1487 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1489 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1491 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1493 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1495 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1498 __pAcceptVisElem->SetOpacity(1.0f);
1499 __pRejectVisElem->SetOpacity(1.00f);
1501 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
1503 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
1504 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1505 RejectVisualEleName.Append(i);
1506 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
1507 __pRejectArrowVisElem->SetOpacity(0.0f);
1508 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
1509 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1510 AcceptVisualEleName.Append(i);
1511 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
1512 __pAcceptArrowVisElem->SetOpacity(0.0f);
1514 if (__pRejectFinalVisElem != null)
1516 __pRejectFinalVisElem->Destroy();
1517 __pRejectFinalVisElem = null;
1520 if (__pAcceptFinalVisElem != null)
1522 __pAcceptFinalVisElem->Destroy();
1523 __pAcceptFinalVisElem = null;
1527 delete __pOptionPopup;
1528 __pOptionPopup = null;
1531 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1535 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1539 case REQUEST_ITEM_SELECTED:
1543 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1546 HandleMultipleCallSelection(index->ToInt());
1555 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1557 AppLogDebug("Enter");
1560 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1561 if (pButtonRejectMessage)
1563 pButtonRejectMessage->SetShowState(true);
1564 pButtonRejectMessage->Invalidate(true);
1565 pButtonRejectMessage->Draw();
1567 RequestRedraw(true);
1572 IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1574 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1575 if (pButtonRejectMessage)
1577 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1578 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
1579 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1580 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);