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 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
123 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
124 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
126 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
127 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
128 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
129 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
130 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
131 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
132 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
133 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
137 , public ISmsListener
140 void OnSmsMessageSent(result r)
145 IncomingCallForm::IncomingCallForm(void)
146 : BaseForm(FORMTYPE_INCOMINGCALL)
148 __pActiveContactNo = null;
149 __pRejectMessageList = null;
150 __incomingCallHandle = -1;
151 __isAnswerCallStarted = false;
152 __isRejectCallStarted = false;
153 __pAcceptArrowLabelsList = null;
154 __pRejectArrowLabelsList = null;
155 __pRejectCircle = null;
156 __pAcceptCircle = null;
157 __pAcceptDial = null;
158 __pRejectDial = null;
159 __pAcceptArrow = null;
160 __pRejectArrow = null;
161 __pAcceptLabel = null;
162 __pRejectLabel = null;
163 __pAcceptArrowLabel = null;
164 __pRejectArrowLabel = null;
165 __pCallHandlePanel = null;
166 __pAcceptVisElem = null;
167 __pRejectVisElem = null;
168 __pRejectFinalVisElem = null;
169 __pAcceptFinalVisElem = null;
170 __pAcceptArrowVisElem = null;
171 __pRejectArrowVisElem = null;
172 __pCallPresentor = null;
173 __pOptionPopup = null;
174 __pSmallPhotoLabel = null;
177 IncomingCallForm::~IncomingCallForm(void)
182 IncomingCallForm::Initialize(void)
184 Construct(IDL_INCOMING_CALL_FORM);
188 IncomingCallForm::OnInitializing(void)
190 result r = E_SUCCESS;
191 Canvas* pCanvas = null;
196 VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
197 r = pFormVisElem->Construct();
198 pFormVisElem->SetBounds(FloatRectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
199 pFormVisElem->SetShowState(true);
200 pFormVisElem->SetOpacity(1.0f);
201 pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
202 GetVisualElement()->AttachChild(*pFormVisElem);
203 pCanvas = pFormVisElem->GetCanvasN();
207 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
208 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
209 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
215 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
216 if (pButtonRejectMessage)
218 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
219 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
220 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
221 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
222 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
223 pButtonRejectMessage->AddActionEventListener(*this);
226 //Get Reject list from Settings Manager
227 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
230 __pRejectMessageList = pMsgMap->GetValuesN();
234 InitializeTableView();
236 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
237 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
238 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
239 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
240 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
241 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
244 if(__pRejectDial == null)
248 //Panel for showing accept and reject call buttons.
249 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
250 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
252 __pCallHandlePanel = new (std::nothrow) Panel();
253 r = __pCallHandlePanel->Construct(Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width - X_CALL_PANEL, H_CALL_PANEL), GROUP_STYLE_NONE);
254 __pCallHandlePanel->AddTouchEventListener(*this);
255 AddControl(*__pCallHandlePanel);
256 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
257 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
258 r = pCallPanelVisElem->Construct();
259 pCallPanelVisElem->SetBounds(FloatRectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
260 pCallPanelVisElem->SetShowState(true);
261 pCallPanelVisElem->SetOpacity(1.0f);
262 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
263 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
264 pCanvas = pCallPanelVisElem->GetCanvasN();
267 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
269 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
270 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
271 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
275 //Lock Label for animation
276 __pAcceptLabel = new (std::nothrow) Label();
277 r = __pAcceptLabel->Construct(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
278 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
279 __pAcceptLabel->AddTouchEventListener(*this);
280 __pCallHandlePanel->AddControl(*__pAcceptLabel);
282 __pAcceptVisElem = new (std::nothrow) VisualElement();
283 r = __pAcceptVisElem->Construct();
284 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
285 __pAcceptVisElem->SetShowState(true);
286 __pAcceptVisElem->SetOpacity(1.0f);
287 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
288 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
289 pCanvas = __pAcceptVisElem->GetCanvasN();
292 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
294 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
295 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
296 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
297 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
298 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
302 //UnLock Label for animation
303 __pRejectLabel = new (std::nothrow) Label();
304 r = __pRejectLabel->Construct(Rectangle(REJECT_LABEL_X_OFFSET, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
305 __pRejectLabel->AddTouchEventListener(*this);
306 __pCallHandlePanel->AddControl(*__pRejectLabel);
307 __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
308 SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
311 __pRejectVisElem = new (std::nothrow) VisualElement();
312 r = __pRejectVisElem->Construct();
313 __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
314 __pRejectVisElem->SetShowState(true);
315 __pRejectVisElem->SetOpacity(1.00f);
316 __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
317 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
318 pCanvas = __pRejectVisElem->GetCanvasN();
321 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
323 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
324 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
325 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
326 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
327 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
332 //! Constructs an array list to store the unlock labels
333 __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
334 r = __pAcceptArrowLabelsList->Construct();
336 //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
337 int x = X_ARROW_LABEL_STARTPOS;
338 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
340 __pAcceptArrowLabel = new (std::nothrow) Label();
341 r = __pAcceptArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
342 __pAcceptArrowLabel->AddTouchEventListener(*this);
343 __pCallHandlePanel->AddControl(*__pAcceptArrowLabel);
344 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
345 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
346 r = __pAcceptArrowVisElem->Construct();
347 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
348 __pAcceptArrowVisElem->SetShowState(true);
349 __pAcceptArrowVisElem->SetOpacity(0.0f);
350 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
351 VisualEleName.Append(index);
352 __pAcceptArrowVisElem->SetName(VisualEleName);
353 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
354 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
357 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
359 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
360 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
361 pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
362 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
363 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
367 x += ARROW_LABEL_X_MARGIN;
369 //! Constructs an array list to store the unlock labels
370 __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
371 r = __pRejectArrowLabelsList->Construct();
373 x = X_ARROW_REJECT_LABEL_STARTPOS;
374 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
376 __pRejectArrowLabel = new (std::nothrow) Label();
377 r = __pRejectArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
378 __pRejectArrowLabel->AddTouchEventListener(*this);
379 __pCallHandlePanel->AddControl(*__pRejectArrowLabel);
380 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
381 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
382 r = __pRejectArrowVisElem->Construct();
383 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
384 __pRejectArrowVisElem->SetShowState(true);
385 __pRejectArrowVisElem->SetOpacity(0.0f);
386 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
387 VisualEleName.Append(index);
388 __pRejectArrowVisElem->SetName(VisualEleName);
389 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
390 pCanvas = __pRejectArrowVisElem->GetCanvasN();
393 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
395 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
396 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
397 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
398 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
402 x -= ARROW_LABEL_X_MARGIN;
410 IncomingCallForm::InitializeFooter(void)
412 Footer* pFooter = GetFooter();
413 FooterItem footerItemCreate;
415 SetFormBackEventListener(this);
418 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
419 pFooter->AddActionEventListener(*this);
421 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
422 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
423 pFooter->AddItem(footerItemCreate);
424 pFooter->SetBackButton();
425 pFooter->SetShowState(false);
430 IncomingCallForm::ShowRejectMessageFooter(void)
432 Footer* pFooter = GetFooter();
435 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<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__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 pButtonRejectMessage->Invalidate(true);
668 pButtonRejectMessage->Draw();
674 case IDA_SEND_REJECT_MSG1:
675 case IDA_SEND_REJECT_MSG2:
676 case IDA_SEND_REJECT_MSG3:
677 case IDA_SEND_REJECT_MSG4:
678 case IDA_SEND_REJECT_MSG5:
679 case IDA_SEND_REJECT_MSG6:
681 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
682 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
683 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
684 result r = pSmsManager->Construct(*pSmsListener);
685 if (IsFailed(r) == false)
687 RecipientList recipient;
688 recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
689 SmsMessage smsMessage;
692 int msgIndex = IDA_SEND_REJECT_MSG1;
693 msgIndex = actionId - msgIndex;
694 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
695 r = smsMessage.SetText(textToBeSent);
696 if (IsFailed(r) == false)
698 r = pSmsManager->Send(smsMessage,recipient,true);
699 if (IsFailed(r) == true)
701 //todo: error message
706 //todo: error message
711 //todo: error message
715 /*ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
716 __pCallPresentor->HandleCallConnected(*pCallList);
727 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
729 if(__pCallPresentor == null)
731 __pCallPresentor = CallPresentationModel::GetInstance();
733 __pCallPresentor->SetTelEventListener(this);
736 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
738 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
740 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
742 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
745 __pAcceptVisElem->SetOpacity(1.0f);
746 __pRejectVisElem->SetOpacity(1.00f);
747 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
749 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
750 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
751 RejectVisualEleName.Append(i);
752 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
753 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
754 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
755 AcceptVisualEleName.Append(i);
756 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
760 __pAcceptArrowVisElem->SetOpacity(0.6f);
761 __pRejectArrowVisElem->SetOpacity(0.6f);
764 __pAcceptArrowVisElem->SetOpacity(0.8f);
765 __pRejectArrowVisElem->SetOpacity(0.8f);
768 __pAcceptArrowVisElem->SetOpacity(1.0f);
769 __pRejectArrowVisElem->SetOpacity(1.0f);
779 CallInfo* pIncomingCall = static_cast<CallInfo*>(pArgs->GetAt(0));
780 if (pIncomingCall != null)
782 //start alert with contact's custom ringtone
783 __pCallPresentor->StartAlert(*pIncomingCall);
784 //show contact number
786 contactNo.Append(pIncomingCall->GetContactNumber());
787 if (__pActiveContactNo)
789 delete __pActiveContactNo;
790 __pActiveContactNo = null;
792 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
793 __pActiveContactNo = new (std::nothrow) String();
795 if(contactNo.IsEmpty())
797 AppLogDebug("Number empty");
798 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
799 AppLogDebug("%ls",contactNo.GetPointer());
801 __pActiveContactNo->Append(contactNo);
802 //Show person details
803 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
804 //Check if incoming call is hidden call, then do not show "Reject with Message" button
805 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
806 if (pButtonRejectMessage)
808 //for hidden call, contact number is not present
809 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
810 pButtonRejectMessage->SetShowState(showRejectMsgButton);
811 pButtonRejectMessage->Invalidate(true);
818 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
819 pCallApp->SetTopMostWindow(true);
825 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
827 if (__pSmallPhotoLabel != null)
829 RemoveControl(*__pSmallPhotoLabel);
830 __pSmallPhotoLabel = null;
832 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
834 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
835 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
836 RejectVisualEleName.Append(i);
837 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
838 __pRejectArrowVisElem->SetOpacity(0.0f);
839 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
840 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
841 AcceptVisualEleName.Append(i);
842 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
843 __pAcceptArrowVisElem->SetOpacity(0.0f);
845 if(__pAcceptLabel != null)
847 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
849 AppLogDebug("__pAcceptLabel Detatach child");
850 __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
853 if(__pRejectLabel != null)
855 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
857 AppLogDebug("__pRejectLabel Detatach child");
858 __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
862 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
863 pCallApp->SetTopMostWindow(false);
867 IncomingCallForm::OnDraw(void)
869 Bitmap* pBackgroundWp = null;
870 // get a Canvas instance
871 Canvas* pCanvas = GetCanvasN();
873 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
880 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
884 delete pBackgroundWp;
885 pBackgroundWp = null;
894 IncomingCallForm::HideRejectPanel(void)
896 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
899 pKeysPanel->SetShowState(false);
900 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
901 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
902 pButtonReject->AddActionEventListener(*this);
903 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
904 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
905 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
906 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
908 HideRejectMessageFooter();
909 pKeysPanel->Invalidate(true);
914 IncomingCallForm::InitializeTableView(void)
916 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
918 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
919 pMessageList->SetItemProvider(this);
920 pMessageList->AddTableViewItemEventListener(*this);
923 ///////////////////////////////////////////////////////////////////////////////
924 ///// Table View Functionality supporting functions /////
925 //////////////////////////////////////////////////////////////////////////////
927 IncomingCallForm::GetItemCount(void)
929 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
931 return (__pRejectMessageList->GetCount());
937 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
940 TableViewItem* pItem = new (std::nothrow) TableViewItem();
941 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
943 //Message text item rectangle
944 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
947 String itemName(L"");
948 bool isShowSendButton = true;
949 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
951 __pRejectMessageList->GetAt(itemIndex, itemName);
955 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
956 isShowSendButton = false;
959 Label* pMsgLbl = new (std::nothrow) Label();
960 pMsgLbl->Construct(itemRect, itemName);
961 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
962 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
963 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
964 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
965 pItem->AddControl(*pMsgLbl);
968 if(isShowSendButton == true)
970 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
971 Button* pSendButton = new (std::nothrow) Button();
972 pSendButton->Construct(Rectangle(X_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
973 //set action id and listener
974 int actionId = IDA_SEND_REJECT_MSG1;
978 actionId = IDA_SEND_REJECT_MSG1;
981 actionId = IDA_SEND_REJECT_MSG2;
984 actionId = IDA_SEND_REJECT_MSG3;
987 actionId = IDA_SEND_REJECT_MSG4;
990 actionId = IDA_SEND_REJECT_MSG5;
993 actionId = IDA_SEND_REJECT_MSG6;
996 pSendButton->SetActionId(actionId);
997 pSendButton->AddActionEventListener(*this);
998 pItem->AddControl(*pSendButton);
999 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1006 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1014 IncomingCallForm::GetDefaultItemHeight(void)
1016 return H_LIST_NORMAL_MENU_ITEM;
1020 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, CallInfo* pCallInfo)
1022 //call individual methods to show contact number, caller name & photo
1023 SetTextToLabel(phoneNumber, contactLblName);
1025 //fetch contact details based on phone number
1026 String* pDisplayName = pCallInfo->FetchCallerNameN();
1027 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1028 ShowCallerPhoto(pPhotoBitmap);
1033 SetTextToLabel(*pDisplayName, nameLblName);
1034 delete pDisplayName;
1035 pDisplayName = null;
1040 delete pPhotoBitmap;
1041 pPhotoBitmap = null;
1046 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1048 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1049 //passing an empty string to SetText fails in label,
1050 //if previously valid text has been set
1051 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1053 String stringToBeSet(L"");
1054 pContactLbl->SetText(stringToBeSet);
1059 pContactLbl->SetText(textToBeSet);
1064 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1066 bool showSmallPhoto = false;
1067 //show photo - for Big Photo Id, Animated Call Image
1068 if (pPhotoId == null)
1070 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1074 //Check the size of photo
1075 // Now checking the condition with && but actually it should be ||
1076 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1077 // height 270 and width = 480 . So all images set thru gallery is show as small image
1078 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1079 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1081 showSmallPhoto = true;
1085 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1086 if(showSmallPhoto == true)
1088 ShowThumbnailImage(pPhotoId);
1092 if (pPhotoLbl != null && pPhotoId != null)
1094 Canvas* pCanvas = new (std::nothrow) Canvas;
1095 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1096 pCanvas->Construct(canvasRect);
1097 //draw the contact bitmap
1098 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1099 Bitmap* pNewPhotoId = new Bitmap();
1100 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1103 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1104 pPhotoLbl->Invalidate(true);
1111 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1113 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1115 if (pPhotoLbl != null && pPhotoId != null)
1117 Canvas* pCanvas = new (std::nothrow) Canvas;
1118 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1119 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1120 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1121 pCanvas->Construct(canvasRect);
1122 //draw the back ground
1123 pCanvas->DrawBitmap(canvasRect,*pBackground);
1124 //draw shadow (to be enabled after correct shadow image is provided )
1125 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1126 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1127 //draw the contact bitmap
1128 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1129 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1130 Bitmap* pNewPhotoId = new Bitmap();
1131 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1134 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1135 pPhotoLbl->Invalidate(true);
1144 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1146 //Draw Small Photo and show on small photo label
1147 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1148 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1149 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1150 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1151 // Add a Label to the Form
1152 AddControl(*__pSmallPhotoLabel);
1153 __pSmallPhotoLabel->Invalidate(true);
1157 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1159 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1160 if (pTimerLbl != null)
1162 pTimerLbl->SetText(textToBeDisplayed);
1167 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1168 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1171 Button* pButton = null;
1172 if (isButtonInPanel == false)
1174 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1178 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1179 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1181 Bitmap* pHoldBmp = null;
1182 Canvas* pCanvas = null;
1183 pCanvas = new (std::nothrow) Canvas();
1184 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1185 //set bitmap to button
1186 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1189 //scale bitmap to predefined size
1190 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1191 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1192 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1196 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1199 //scale bitmap to predefined size
1200 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1201 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1202 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1210 String holdBtnName = AppUtility::GetResourceString(btnName);
1211 Dimension textDimension;
1212 if (!holdBtnName.IsEmpty())
1215 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1216 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1217 textDimension.height = textDimension.height + font.GetDescender();
1218 TextElement* pTextElement = new (std::nothrow) TextElement();
1219 pTextElement->Construct(holdBtnName);
1220 Color textColor(249, 249, 249);
1221 if (setButtonPressBitmap)
1223 textColor.SetAlpha(255);
1227 textColor.SetAlpha(127);
1230 pTextElement->SetTextColor(textColor);
1231 pTextElement->SetFont(font);
1233 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1234 pEnrichedText->Construct(textDimension);
1235 pEnrichedText->Add(*pTextElement);
1236 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1237 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1238 pCanvas->DrawText(textPos, *pEnrichedText);
1240 pEnrichedText->RemoveAll(true);
1241 delete pEnrichedText;
1245 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1248 //scale bitmap to predefined size
1249 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1250 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1251 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1252 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1255 //set background bitmpa to button
1256 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1257 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1258 if (setButtonPressBitmap)
1260 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1264 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1266 delete pActualBgBmp;
1271 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1274 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1276 __pCallPresentor->StopAlert();
1277 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1279 Rectangle rect = source.GetBounds();
1280 if (source.Equals(*__pAcceptLabel))
1282 __isAnswerCallStarted = true;
1283 __isRejectCallStarted = false;
1285 else if (source.Equals(*__pRejectLabel))
1287 __isAnswerCallStarted = false;
1288 __isRejectCallStarted = true;
1292 // touch event between the 2 labels. So Do nothing
1299 // On Touch released, the animation and the visual elements disappear
1301 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1303 if (__isAnswerCallStarted == true)
1305 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1308 if(__pRejectFinalVisElem == null)
1310 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1312 __pRejectFinalVisElem->Construct();
1313 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1314 __pRejectFinalVisElem->SetShowState(true);
1315 __pRejectFinalVisElem->SetOpacity(1.00f);
1316 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1317 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1319 AppLogDebug("AttachChild __pRejectFinalVisElem");
1320 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1322 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1325 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1326 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1327 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1328 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1332 __pAcceptVisElem->SetOpacity(0.0f);
1333 //fetch already active call list
1334 ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
1335 if (pCallList != null && pCallList->GetCount() > 0)
1337 //then atleast 1 active call exist.
1338 CallInfo phnCallInfo;
1339 pCallList->GetAt(0,phnCallInfo);
1340 //Check if only 1 call exist and it is on Hold
1341 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1343 //directly accept call
1344 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1348 //Either 1 call exist and not "on Hold".
1350 if(__pOptionPopup != null)
1352 delete __pOptionPopup;
1353 __pOptionPopup = null;
1355 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1356 __pOptionPopup->Initialize();
1357 __pOptionPopup->SetShowState(true);
1358 __pOptionPopup->Draw();
1359 __pOptionPopup->Show();
1361 pCallList->RemoveAll();
1365 //no active call - Accept the incoming call
1366 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1373 __pAcceptVisElem->SetOpacity(1.0f);
1374 __pRejectVisElem->SetOpacity(1.00f);
1378 else if (__isRejectCallStarted == true)
1380 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1383 if(__pAcceptFinalVisElem == null)
1385 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1387 __pAcceptFinalVisElem->Construct();
1388 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1389 __pAcceptFinalVisElem->SetShowState(true);
1390 __pAcceptFinalVisElem->SetOpacity(1.0f);
1391 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1392 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1394 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1395 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1397 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1400 AppLogDebug("__pAcceptFinalVisElem drawing");
1401 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1402 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1403 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1404 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1405 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1408 __pRejectVisElem->SetOpacity(0.0f);
1410 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1414 __pAcceptVisElem->SetOpacity(1.0f);
1415 __pRejectVisElem->SetOpacity(1.00f);
1419 __isAnswerCallStarted = false;
1420 __isRejectCallStarted = false;
1424 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1426 if (__isAnswerCallStarted == true)
1428 if (currentPosition.x > 170 && currentPosition.x < 578)
1430 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1432 __pRejectVisElem->SetOpacity(0.60f);
1433 __pAcceptVisElem->SetOpacity(0.60f);
1437 __pRejectVisElem->SetOpacity(1.0f);
1438 __pAcceptVisElem->SetOpacity(1.0f);
1443 if (__isRejectCallStarted == true)
1445 if (currentPosition.x < 0 && currentPosition.x > -522)
1447 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1449 __pRejectVisElem->SetOpacity(0.60f);
1450 __pAcceptVisElem->SetOpacity(0.60f);
1454 __pRejectVisElem->SetOpacity(1.0f);
1455 __pAcceptVisElem->SetOpacity(1.0f);
1462 IncomingCallForm::OnItemSelected(int itemIndex)
1465 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1468 //display name, mobile number
1469 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1470 pArgs->Add(argIndex);
1471 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1476 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1478 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1480 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1482 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1484 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1487 __pAcceptVisElem->SetOpacity(1.0f);
1488 __pRejectVisElem->SetOpacity(1.00f);
1490 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
1492 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
1493 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1494 RejectVisualEleName.Append(i);
1495 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
1496 __pRejectArrowVisElem->SetOpacity(0.0f);
1497 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
1498 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1499 AcceptVisualEleName.Append(i);
1500 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
1501 __pAcceptArrowVisElem->SetOpacity(0.0f);
1503 if (__pRejectFinalVisElem != null)
1505 __pRejectFinalVisElem->Destroy();
1506 __pRejectFinalVisElem = null;
1509 if (__pAcceptFinalVisElem != null)
1511 __pAcceptFinalVisElem->Destroy();
1512 __pAcceptFinalVisElem = null;
1516 delete __pOptionPopup;
1517 __pOptionPopup = null;
1520 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1524 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1528 case REQUEST_ITEM_SELECTED:
1532 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1535 HandleMultipleCallSelection(index->ToInt());
1544 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1546 AppLogDebug("Enter");
1549 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1550 if (pButtonRejectMessage)
1552 pButtonRejectMessage->SetShowState(true);
1553 pButtonRejectMessage->Invalidate(true);
1554 pButtonRejectMessage->Draw();
1556 RequestRedraw(true);