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"
30 using namespace Tizen::App;
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Messaging;
35 using namespace Tizen::Ui;
36 using namespace Tizen::Ui::Animations;
37 using namespace Tizen::Ui::Controls;
38 using namespace Tizen::Ui::Scenes;
41 const int W_DIAL_BITMAP = 100;
42 const int H_DIAL_BITMAP = 100;
43 const int W_CREATE_BITMAP = 56;
44 const int H_CREATE_BITMAP = 56;
45 const int X_CREATE_BITMAP = 8;
46 const int Y_CREATE_BITMAP = 8;
47 const int W_MESSAGE_BG_BITMAP = 720;
48 const int H_MESSAGE_BG_BITMAP = 110;
49 const int W_ARROW_BITMAP = 28;
50 const int H_ARROW_BITMAP = 36;
51 const int W_MESSAGE_BITMAP = 50;
52 const int H_MESSAGE_BITMAP = 50;
53 const int X_MESSAGE_BITMAP = 185;
54 const int Y_MESSAGE_BITMAP = 50;
55 const int MESSAGE_TEXT_X_MARGIN = 20;
56 const int MESSAGE_TEXT_Y_MARGIN = 10;
57 const int SEND_TEXT_X_MARGIN = 78;
58 const int SEND_TEXT_Y_MARGIN = 20;
59 const int SEND_BUTTON_ROUND_DIMENSION = 5;
60 const int W_DIAL_LABEL = 188;
61 const int H_DIAL_LABEL = 188;
62 const int DIAL_ICON_X_OFFSET = 44;
63 const int DIAL_ICON_Y_OFFSET = 44;
64 const int REJECT_LABEL_X_OFFSET = 492;
65 const int X_CALL_PANEL = 20;
66 const int Y_CALL_PANEL = 110;
67 const int H_CALL_PANEL = 188;
68 const int Y_ARROW_LABEL = 79;
69 const int W_ARROW_LABEL = 20;
70 const int H_ARROW_LABEL = 32;
71 const int VALID_TOUCH_X_OFFSET = 158;
72 const int VALID_TOUCH_Y_OFFSET = 158;
73 const int X_ARROW_LABEL_STARTPOS = 206; // 188 circle wodth , 18 GUI spec
74 const int X_ARROW_REJECT_LABEL_STARTPOS = 454; // 700 width of panel - 20 offset - 188 circle width - 18 GUI spec - 20 width of image
75 const int ARROW_LABEL_X_MARGIN = 48; //20 width of arrow and 28 GUI spec
76 const int ACCEPT_LABEL_RELATIVE_POS = -384; //relative pos of accept labels right to reject labels left
77 const int MAX_LIST_HEIGHT = 448;//678;
78 const int H_REJECT_VIEW_FOOTER = 98;
79 const int X_LIST_TEXT_ITEM = 16;
80 const int W_LIST_TEXT_ITEM = 452;
81 const int H_LIST_TEXT_ITEM = 111;
82 const int X_SEND_TEXT_ITEM = 484;
83 const int Y_SEND_TEXT_ITEM = 20;
84 const int W_SEND_TEXT_ITEM = 220;
85 const int H_SEND_TEXT_ITEM = 72;
86 const int X_PHOTO_LBL = 166;
87 const int Y_PHOTO_LBL = 232;
88 const int W_PHOTO_LBL = 388;
89 const int H_PHOTO_LBL = 388;
90 const int W_PHOTO_LABEL = 720;
91 const int H_PHOTO_LABEL = 720;
92 const int COUNT_ARROW_ELEMENTS = 3;
94 const unsigned int COLOR_SEND_BUTTON_PRESSED = Color32<130, 142, 150>::Value;
95 const unsigned int COLOR_SEND_BUTTON_NORMAL = Color32<64, 156, 211>::Value;
96 const unsigned int COLOR_SWIPE_PANEL = Color32<0, 0, 0, 255>::Value;
97 const unsigned int COLOR_LIST_TEXT_NORMAL = Color32<0, 0, 0>::Value;
98 const unsigned int COLOR_LIST_TEXT_PRESSED = Color32<249, 249, 249>::Value;
100 const int FONT_SIZE_MSG_TXT = 44;
102 static const wchar_t* IDL_INCOMING_CALL_FORM = L"IDL_INCOMING_CALL_FORM";
103 static const wchar_t* IDB_REJECT_MESSAGE_BG = L"C01-1_Reject_message_bg.png";
104 static const wchar_t* IDB_REJECT_MESSAGE_UP_ARROW = L"C01-1_Reject_message_arrow_01.png";
105 static const wchar_t* IDB_REJECT_MESSAGE_DOWN_ARROW = L"C01-1_Reject_message_arrow_02.png";
106 static const wchar_t* IDB_REJECT_MESSAGE_ICON = L"C01-1_icon_Reject_with_Message.png";
107 static const wchar_t* IDB_ACCEPT_CIRCLE_ICON = L"C01-1_accept_left.png";
108 static const wchar_t* IDB_REJECT_CIRCLE_ICON = L"C01-1_reject_right.png";
109 static const wchar_t* IDB_CALL_ACCEPT_ICON = L"C01-1_accept_left_dial_answer.png";
110 static const wchar_t* IDB_CALL_REJECT_ICON = L"C01-1_reject_right_dial_decline.png";
111 static const wchar_t* IDB_ACCEPT_ARROW_ICON = L"C01-1_arrow_g.png";
112 static const wchar_t* IDB_REJECT_ARROW_ICON = L"C01-1_arrow_r.png";
113 static const wchar_t* IDB_CALL_BG = L"C01-1_calling_BG_01.png";
114 static const wchar_t* IDC_REJECT_MESSAGE_BUTTON = L"IDC_REJECT_MESSAGE_BUTTON";
115 static const wchar_t* IDC_REJECT_PANEL = L"IDC_REJECT_PANEL";
116 static const wchar_t* IDC_REJECT_MESSAGE_CANCEL_BUTTON = L"IDC_REJECT_MESSAGE_CANCEL_BUTTON";
117 static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
118 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
119 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
120 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
121 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
122 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
123 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
125 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
126 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
127 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
128 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
129 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
130 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
131 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
132 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
136 , public ISmsListener
139 void OnSmsMessageSent(result r)
144 IncomingCallForm::IncomingCallForm(void)
145 : BaseForm(FORMTYPE_INCOMINGCALL)
147 __pActiveContactNo = null;
148 __pRejectMessageList = null;
149 __incomingCallHandle = -1;
150 __isAnswerCallStarted = false;
151 __isRejectCallStarted = false;
152 __pAcceptArrowLabelsList = null;
153 __pRejectArrowLabelsList = null;
154 __pRejectCircle = null;
155 __pAcceptCircle = null;
156 __pAcceptDial = null;
157 __pRejectDial = null;
158 __pAcceptArrow = null;
159 __pRejectArrow = null;
160 __pAcceptLabel = null;
161 __pRejectLabel = null;
162 __pAcceptArrowLabel = null;
163 __pRejectArrowLabel = null;
164 __pCallHandlePanel = null;
165 __pAcceptVisElem = null;
166 __pRejectVisElem = null;
167 __pRejectFinalVisElem = null;
168 __pAcceptFinalVisElem = null;
169 __pAcceptArrowVisElem = null;
170 __pRejectArrowVisElem = null;
171 __pCallPresentor = null;
172 __pOptionPopup = null;
173 __pSmallPhotoLabel = null;
176 IncomingCallForm::~IncomingCallForm(void)
181 IncomingCallForm::Initialize(void)
183 Construct(IDL_INCOMING_CALL_FORM);
187 IncomingCallForm::OnInitializing(void)
189 result r = E_SUCCESS;
190 Canvas* pCanvas = null;
195 VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
196 r = pFormVisElem->Construct();
197 pFormVisElem->SetBounds(FloatRectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
198 pFormVisElem->SetShowState(true);
199 pFormVisElem->SetOpacity(1.0f);
200 pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
201 GetVisualElement()->AttachChild(*pFormVisElem);
202 pCanvas = pFormVisElem->GetCanvasN();
206 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
207 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
208 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
214 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
215 if (pButtonRejectMessage)
217 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
218 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
219 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
220 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
221 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
222 pButtonRejectMessage->AddActionEventListener(*this);
225 //Get Reject list from Settings Manager
226 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
229 __pRejectMessageList = pMsgMap->GetValuesN();
233 InitializeTableView();
235 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
236 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
237 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
238 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
239 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
240 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
243 if(__pRejectDial == null)
247 //Panel for showing accept and reject call buttons.
248 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
249 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
251 __pCallHandlePanel = new (std::nothrow) Panel();
252 r = __pCallHandlePanel->Construct(Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width - X_CALL_PANEL, H_CALL_PANEL), GROUP_STYLE_NONE);
253 __pCallHandlePanel->AddTouchEventListener(*this);
254 AddControl(*__pCallHandlePanel);
255 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
256 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
257 r = pCallPanelVisElem->Construct();
258 pCallPanelVisElem->SetBounds(FloatRectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
259 pCallPanelVisElem->SetShowState(true);
260 pCallPanelVisElem->SetOpacity(1.0f);
261 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
262 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
263 pCanvas = pCallPanelVisElem->GetCanvasN();
266 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
268 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
269 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
270 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
274 //Lock Label for animation
275 __pAcceptLabel = new (std::nothrow) Label();
276 r = __pAcceptLabel->Construct(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
277 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
278 __pAcceptLabel->AddTouchEventListener(*this);
279 __pCallHandlePanel->AddControl(*__pAcceptLabel);
281 __pAcceptVisElem = new (std::nothrow) VisualElement();
282 r = __pAcceptVisElem->Construct();
283 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
284 __pAcceptVisElem->SetShowState(true);
285 __pAcceptVisElem->SetOpacity(1.0f);
286 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
287 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
288 pCanvas = __pAcceptVisElem->GetCanvasN();
291 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
293 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
294 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
295 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
296 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
297 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
301 //UnLock Label for animation
302 __pRejectLabel = new (std::nothrow) Label();
303 r = __pRejectLabel->Construct(Rectangle(REJECT_LABEL_X_OFFSET, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
304 __pRejectLabel->AddTouchEventListener(*this);
305 __pCallHandlePanel->AddControl(*__pRejectLabel);
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 __pAcceptArrowLabel = new (std::nothrow) Label();
340 r = __pAcceptArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
341 __pAcceptArrowLabel->AddTouchEventListener(*this);
342 __pCallHandlePanel->AddControl(*__pAcceptArrowLabel);
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 __pRejectArrowLabel = new (std::nothrow) Label();
376 r = __pRejectArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
377 __pRejectArrowLabel->AddTouchEventListener(*this);
378 __pCallHandlePanel->AddControl(*__pRejectArrowLabel);
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 pFooter->SetShowState(true);
440 IncomingCallForm::HideRejectMessageFooter(void)
442 Footer* pFooter = GetFooter();
445 pFooter->SetShowState(false);
450 IncomingCallForm::OnTerminating(void)
452 result r = E_SUCCESS;
454 if (__pRejectMessageList != null)
456 delete __pRejectMessageList;
457 __pRejectMessageList = null;
459 if (__pActiveContactNo != null)
461 delete __pActiveContactNo;
462 __pActiveContactNo = null;
464 __incomingCallHandle = -1;
465 __pCallPresentor = null;
467 /* Deleting fails in A4RC* SDK. Remove if not necessary
468 if (__pAcceptVisElem != null)
470 __pAcceptVisElem->Destroy();
471 __pAcceptVisElem = null;
474 if (__pRejectVisElem != null)
476 __pRejectVisElem->Destroy();
477 __pRejectVisElem = null;
480 if (__pRejectFinalVisElem != null)
482 __pRejectFinalVisElem->Destroy();
483 __pRejectFinalVisElem = null;
486 if (__pAcceptFinalVisElem != null)
488 __pAcceptFinalVisElem->Destroy();
489 __pAcceptFinalVisElem = null;
492 for (int i = 0; i < 7; i++)
494 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
495 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
496 if (__pRejectArrowVisElem != null)
498 __pRejectArrowVisElem->Destroy();
499 __pRejectArrowVisElem = null;
502 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
503 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
504 if (__pAcceptArrowVisElem != null)
506 __pAcceptArrowVisElem->Destroy();
507 __pAcceptArrowVisElem = null;
511 if (__pAcceptArrowVisElem != null)
513 __pAcceptArrowVisElem = null;
516 if (__pRejectArrowVisElem != null)
518 __pRejectArrowVisElem = null;
521 if (__pAcceptArrowLabelsList != null)
523 __pAcceptArrowLabelsList->RemoveAll(false);
524 delete __pAcceptArrowLabelsList;
525 __pAcceptArrowLabelsList = null;
528 if (__pRejectArrowLabelsList != null)
530 __pRejectArrowLabelsList->RemoveAll(false);
531 delete __pRejectArrowLabelsList;
532 __pRejectArrowLabelsList = null;
535 if (__pRejectCircle != null)
537 delete __pRejectCircle;
538 __pRejectCircle = null;
541 if (__pAcceptCircle != null)
543 delete __pAcceptCircle;
544 __pAcceptCircle = null;
547 if (__pAcceptDial != null)
549 delete __pAcceptDial;
550 __pAcceptDial = null;
553 if (__pRejectDial != null)
555 delete __pRejectDial;
556 __pRejectDial = null;
559 if (__pAcceptArrow != null)
561 delete __pAcceptArrow;
562 __pAcceptArrow = null;
565 if (__pRejectArrow != null)
567 delete __pRejectArrow;
568 __pRejectArrow = null;
570 __pCallHandlePanel->RemoveTouchEventListener(*this);
571 __pAcceptLabel->RemoveTouchEventListener(*this);
572 __pRejectLabel->RemoveTouchEventListener(*this);
573 __pAcceptArrowLabel->RemoveTouchEventListener(*this);
574 __pRejectArrowLabel->RemoveTouchEventListener(*this);
575 __pAcceptLabel = null;
576 __pRejectLabel = null;
577 __pAcceptArrowLabel = null;
578 __pRejectArrowLabel = null;
579 __pCallHandlePanel = null;
584 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
588 case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
590 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
593 pKeysPanel->SetShowState(true);
594 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
595 Rectangle tmpRect = pMessageList->GetBounds();
596 SetControlAlwaysOnTop(*pKeysPanel,true);
598 //Set Height to Reject Message Panel
599 int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
600 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
602 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
604 if (listHeight > MAX_LIST_HEIGHT)
606 listHeight = MAX_LIST_HEIGHT;
609 pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
610 tmpRect = pKeysPanel->GetBounds();
611 pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight);
613 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
614 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
615 pButtonReject->AddActionEventListener(*this);
616 pButtonReject->SetEnabled(true);
617 pButtonReject->SetFocus();
619 ShowRejectMessageFooter();
621 /* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_BACK_BUTTON));
622 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
623 pButtonReject->AddActionEventListener(*this);
624 pButtonReject->SetEnabled(true);
625 pButtonReject->SetFocus();
627 Button* pButtonCreate = static_cast<Button*>(pKeysPanel->GetControl(IDC_CREATE_BUTTON));
628 pButtonCreate->SetActionId(IDA_CREATE_REJECT_CALL_MESSAGE);
629 pButtonCreate->AddActionEventListener(*this);
630 pButtonCreate->SetEnabled(true);
631 pButtonCreate->SetFocus();*/
633 pKeysPanel->SetFocus();
636 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
637 if (pButtonRejectMessage)
639 pButtonRejectMessage->SetShowState(false);
640 pButtonRejectMessage->Invalidate(true);
641 pButtonRejectMessage->Draw();
646 case IDA_CREATE_REJECT_CALL_MESSAGE:
648 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
649 ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
650 if(pCallList != null && pCallList->GetCount() > 0)
652 __pCallPresentor->HandleCallConnected(*pCallList);
658 case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
662 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
663 if (pButtonRejectMessage)
665 pButtonRejectMessage->SetShowState(true);
666 pButtonRejectMessage->Invalidate(true);
667 pButtonRejectMessage->Draw();
673 case IDA_SEND_REJECT_MSG1:
674 case IDA_SEND_REJECT_MSG2:
675 case IDA_SEND_REJECT_MSG3:
676 case IDA_SEND_REJECT_MSG4:
677 case IDA_SEND_REJECT_MSG5:
678 case IDA_SEND_REJECT_MSG6:
680 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
681 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
682 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
683 result r = pSmsManager->Construct(*pSmsListener);
684 if (IsFailed(r) == false)
686 RecipientList recipient;
687 recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
688 SmsMessage smsMessage;
691 int msgIndex = IDA_SEND_REJECT_MSG1;
692 msgIndex = actionId - msgIndex;
693 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
694 r = smsMessage.SetText(textToBeSent);
695 if (IsFailed(r) == false)
697 r = pSmsManager->Send(smsMessage,recipient,true);
698 if (IsFailed(r) == true)
700 //todo: error message
705 //todo: error message
710 //todo: error message
714 /*ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
715 __pCallPresentor->HandleCallConnected(*pCallList);
726 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
728 if(__pCallPresentor == null)
730 __pCallPresentor = CallPresentationModel::GetInstance();
732 __pCallPresentor->SetTelEventListener(this);
735 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
737 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
739 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
741 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
744 __pAcceptVisElem->SetOpacity(1.0f);
745 __pRejectVisElem->SetOpacity(1.00f);
746 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
748 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
749 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
750 RejectVisualEleName.Append(i);
751 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
752 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
753 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
754 AcceptVisualEleName.Append(i);
755 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
759 __pAcceptArrowVisElem->SetOpacity(0.6f);
760 __pRejectArrowVisElem->SetOpacity(0.6f);
763 __pAcceptArrowVisElem->SetOpacity(0.8f);
764 __pRejectArrowVisElem->SetOpacity(0.8f);
767 __pAcceptArrowVisElem->SetOpacity(1.0f);
768 __pRejectArrowVisElem->SetOpacity(1.0f);
778 CallInfo* pIncomingCall = static_cast<CallInfo*>(pArgs->GetAt(0));
779 if (pIncomingCall != null)
781 //start alert with contact's custom ringtone
782 __pCallPresentor->StartAlert(*pIncomingCall);
783 //show contact number
785 contactNo.Append(pIncomingCall->GetContactNumber());
786 if (__pActiveContactNo)
788 delete __pActiveContactNo;
789 __pActiveContactNo = null;
791 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
792 __pActiveContactNo = new (std::nothrow) String();
794 if(contactNo.IsEmpty())
796 AppLogDebug("Number empty");
797 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
798 AppLogDebug("%ls",contactNo.GetPointer());
800 __pActiveContactNo->Append(contactNo);
801 //Show person details
802 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
803 //Check if incoming call is hidden call, then do not show "Reject with Message" button
804 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
805 if (pButtonRejectMessage)
807 //for hidden call, contact number is not present
808 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
809 pButtonRejectMessage->SetShowState(showRejectMsgButton);
810 pButtonRejectMessage->Invalidate(true);
820 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
822 if (__pSmallPhotoLabel != null)
824 RemoveControl(*__pSmallPhotoLabel);
825 __pSmallPhotoLabel = null;
827 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
829 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
830 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
831 RejectVisualEleName.Append(i);
832 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
833 __pRejectArrowVisElem->SetOpacity(0.0f);
834 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
835 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
836 AcceptVisualEleName.Append(i);
837 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
838 __pAcceptArrowVisElem->SetOpacity(0.0f);
840 if(__pAcceptLabel != null)
842 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
844 AppLogDebug("__pAcceptLabel Detatach child");
845 __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
848 if(__pRejectLabel != null)
850 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
852 AppLogDebug("__pRejectLabel Detatach child");
853 __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
860 IncomingCallForm::OnDraw(void)
862 Bitmap* pBackgroundWp = null;
863 // get a Canvas instance
864 Canvas* pCanvas = GetCanvasN();
866 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
873 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
877 delete pBackgroundWp;
878 pBackgroundWp = null;
887 IncomingCallForm::HideRejectPanel(void)
889 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
892 pKeysPanel->SetShowState(false);
893 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
894 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
895 pButtonReject->AddActionEventListener(*this);
896 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
897 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
898 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
899 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
901 HideRejectMessageFooter();
902 pKeysPanel->Invalidate(true);
907 IncomingCallForm::InitializeTableView(void)
909 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
911 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
912 pMessageList->SetItemProvider(this);
913 pMessageList->AddTableViewItemEventListener(*this);
916 ///////////////////////////////////////////////////////////////////////////////
917 ///// Table View Functionality supporting functions /////
918 //////////////////////////////////////////////////////////////////////////////
920 IncomingCallForm::GetItemCount(void)
922 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
924 return (__pRejectMessageList->GetCount());
930 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
933 TableViewItem* pItem = new (std::nothrow) TableViewItem();
934 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
936 //Message text item rectangle
937 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
940 String itemName(L"");
941 bool isShowSendButton = true;
942 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
944 __pRejectMessageList->GetAt(itemIndex, itemName);
948 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
949 isShowSendButton = false;
952 Label* pMsgLbl = new (std::nothrow) Label();
953 pMsgLbl->Construct(itemRect, itemName);
954 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
955 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
956 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
957 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
958 pItem->AddControl(*pMsgLbl);
961 if(isShowSendButton == true)
963 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
964 Button* pSendButton = new (std::nothrow) Button();
965 pSendButton->Construct(Rectangle(X_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
966 //set action id and listener
967 int actionId = IDA_SEND_REJECT_MSG1;
971 actionId = IDA_SEND_REJECT_MSG1;
974 actionId = IDA_SEND_REJECT_MSG2;
977 actionId = IDA_SEND_REJECT_MSG3;
980 actionId = IDA_SEND_REJECT_MSG4;
983 actionId = IDA_SEND_REJECT_MSG5;
986 actionId = IDA_SEND_REJECT_MSG6;
989 pSendButton->SetActionId(actionId);
990 pSendButton->AddActionEventListener(*this);
991 pItem->AddControl(*pSendButton);
992 pItem->SetIndividualSelectionEnabled(pSendButton, true);
999 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1007 IncomingCallForm::GetDefaultItemHeight(void)
1009 return H_LIST_NORMAL_MENU_ITEM;
1013 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, CallInfo* pCallInfo)
1015 //call individual methods to show contact number, caller name & photo
1016 SetTextToLabel(phoneNumber, contactLblName);
1018 //fetch contact details based on phone number
1019 String* pDisplayName = pCallInfo->FetchCallerNameN();
1020 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1021 ShowCallerPhoto(pPhotoBitmap);
1026 SetTextToLabel(*pDisplayName, nameLblName);
1027 delete pDisplayName;
1028 pDisplayName = null;
1033 delete pPhotoBitmap;
1034 pPhotoBitmap = null;
1039 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1041 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1042 //passing an empty string to SetText fails in label,
1043 //if previously valid text has been set
1044 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1046 String stringToBeSet(L"");
1047 pContactLbl->SetText(stringToBeSet);
1052 pContactLbl->SetText(textToBeSet);
1057 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1059 bool showSmallPhoto = false;
1060 //show photo - for Big Photo Id, Animated Call Image
1061 if (pPhotoId == null)
1063 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1067 //Check the size of photo
1068 // Now checking the condition with && but actually it should be ||
1069 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1070 // height 270 and width = 480 . So all images set thru gallery is show as small image
1071 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1072 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1074 showSmallPhoto = true;
1078 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1079 if(showSmallPhoto == true)
1081 ShowThumbnailImage(pPhotoId);
1085 if (pPhotoLbl != null && pPhotoId != null)
1087 Canvas* pCanvas = new (std::nothrow) Canvas;
1088 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1089 pCanvas->Construct(canvasRect);
1090 //draw the contact bitmap
1091 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1092 Bitmap* pNewPhotoId = new Bitmap();
1093 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1096 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1097 pPhotoLbl->Invalidate(true);
1104 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1106 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1108 if (pPhotoLbl != null && pPhotoId != null)
1110 Canvas* pCanvas = new (std::nothrow) Canvas;
1111 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1112 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1113 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1114 pCanvas->Construct(canvasRect);
1115 //draw the back ground
1116 pCanvas->DrawBitmap(canvasRect,*pBackground);
1117 //draw shadow (to be enabled after correct shadow image is provided )
1118 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1119 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1120 //draw the contact bitmap
1121 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1122 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1123 Bitmap* pNewPhotoId = new Bitmap();
1124 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1127 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1128 pPhotoLbl->Invalidate(true);
1137 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1139 //Draw Small Photo and show on small photo label
1140 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1141 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1142 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1143 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1144 // Add a Label to the Form
1145 AddControl(*__pSmallPhotoLabel);
1146 __pSmallPhotoLabel->Invalidate(true);
1150 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1152 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1153 if (pTimerLbl != null)
1155 pTimerLbl->SetText(textToBeDisplayed);
1160 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1161 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1164 Button* pButton = null;
1165 if (isButtonInPanel == false)
1167 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1171 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1172 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1174 Bitmap* pHoldBmp = null;
1175 Canvas* pCanvas = null;
1176 pCanvas = new (std::nothrow) Canvas();
1177 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1178 //set bitmap to button
1179 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1182 //scale bitmap to predefined size
1183 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1184 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1185 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1189 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1192 //scale bitmap to predefined size
1193 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1194 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1195 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1203 String holdBtnName = AppUtility::GetResourceString(btnName);
1204 Dimension textDimension;
1205 if (!holdBtnName.IsEmpty())
1208 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1209 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1210 textDimension.height = textDimension.height + font.GetDescender();
1211 TextElement* pTextElement = new (std::nothrow) TextElement();
1212 pTextElement->Construct(holdBtnName);
1213 Color textColor(249, 249, 249);
1214 if (setButtonPressBitmap)
1216 textColor.SetAlpha(255);
1220 textColor.SetAlpha(127);
1223 pTextElement->SetTextColor(textColor);
1224 pTextElement->SetFont(font);
1226 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1227 pEnrichedText->Construct(textDimension);
1228 pEnrichedText->Add(*pTextElement);
1229 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1230 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1231 pCanvas->DrawText(textPos, *pEnrichedText);
1233 pEnrichedText->RemoveAll(true);
1234 delete pEnrichedText;
1238 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1241 //scale bitmap to predefined size
1242 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1243 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1244 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1245 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1248 //set background bitmpa to button
1249 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1250 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1251 if (setButtonPressBitmap)
1253 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1257 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1259 delete pActualBgBmp;
1264 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1267 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1269 __pCallPresentor->StopAlert();
1270 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1272 Rectangle rect = source.GetBounds();
1273 if (source.Equals(*__pAcceptLabel))
1275 __isAnswerCallStarted = true;
1276 __isRejectCallStarted = false;
1278 else if (source.Equals(*__pRejectLabel))
1280 __isAnswerCallStarted = false;
1281 __isRejectCallStarted = true;
1285 // touch event between the 2 labels. So Do nothing
1292 // On Touch released, the animation and the visual elements disappear
1294 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1296 if (__isAnswerCallStarted == true)
1298 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1301 if(__pRejectFinalVisElem == null)
1303 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1305 __pRejectFinalVisElem->Construct();
1306 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1307 __pRejectFinalVisElem->SetShowState(true);
1308 __pRejectFinalVisElem->SetOpacity(1.00f);
1309 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1310 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1312 AppLogDebug("AttachChild __pRejectFinalVisElem");
1313 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1315 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1318 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1319 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1320 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1321 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1325 __pAcceptVisElem->SetOpacity(0.0f);
1326 //fetch already active call list
1327 ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
1328 if (pCallList != null && pCallList->GetCount() > 0)
1330 //then atleast 1 active call exist.
1331 CallInfo phnCallInfo;
1332 pCallList->GetAt(0,phnCallInfo);
1333 //Check if only 1 call exist and it is on Hold
1334 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1336 //directly accept call
1337 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1341 //Either 1 call exist and not "on Hold".
1343 if(__pOptionPopup != null)
1345 delete __pOptionPopup;
1346 __pOptionPopup = null;
1348 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1349 __pOptionPopup->Initialize();
1350 __pOptionPopup->SetShowState(true);
1351 __pOptionPopup->Draw();
1352 __pOptionPopup->Show();
1354 pCallList->RemoveAll();
1358 //no active call - Accept the incoming call
1359 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1366 __pAcceptVisElem->SetOpacity(1.0f);
1367 __pRejectVisElem->SetOpacity(1.00f);
1371 else if (__isRejectCallStarted == true)
1373 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1376 if(__pAcceptFinalVisElem == null)
1378 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1380 __pAcceptFinalVisElem->Construct();
1381 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1382 __pAcceptFinalVisElem->SetShowState(true);
1383 __pAcceptFinalVisElem->SetOpacity(1.0f);
1384 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1385 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1387 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1388 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1390 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1393 AppLogDebug("__pAcceptFinalVisElem drawing");
1394 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1395 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1396 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1397 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1398 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1401 __pRejectVisElem->SetOpacity(0.0f);
1403 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1407 __pAcceptVisElem->SetOpacity(1.0f);
1408 __pRejectVisElem->SetOpacity(1.00f);
1412 __isAnswerCallStarted = false;
1413 __isRejectCallStarted = false;
1417 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1419 if (__isAnswerCallStarted == true)
1421 if (currentPosition.x > 170 && currentPosition.x < 578)
1423 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1425 __pRejectVisElem->SetOpacity(0.60f);
1426 __pAcceptVisElem->SetOpacity(0.60f);
1430 __pRejectVisElem->SetOpacity(1.0f);
1431 __pAcceptVisElem->SetOpacity(1.0f);
1436 if (__isRejectCallStarted == true)
1438 if (currentPosition.x < 0 && currentPosition.x > -522)
1440 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1442 __pRejectVisElem->SetOpacity(0.60f);
1443 __pAcceptVisElem->SetOpacity(0.60f);
1447 __pRejectVisElem->SetOpacity(1.0f);
1448 __pAcceptVisElem->SetOpacity(1.0f);
1455 IncomingCallForm::OnItemSelected(int itemIndex)
1458 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1461 //display name, mobile number
1462 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1463 pArgs->Add(argIndex);
1464 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1469 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1471 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1473 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1475 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1477 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1480 __pAcceptVisElem->SetOpacity(1.0f);
1481 __pRejectVisElem->SetOpacity(1.00f);
1483 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
1485 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
1486 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1487 RejectVisualEleName.Append(i);
1488 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
1489 __pRejectArrowVisElem->SetOpacity(0.0f);
1490 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
1491 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1492 AcceptVisualEleName.Append(i);
1493 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
1494 __pAcceptArrowVisElem->SetOpacity(0.0f);
1496 if (__pRejectFinalVisElem != null)
1498 __pRejectFinalVisElem->Destroy();
1499 __pRejectFinalVisElem = null;
1502 if (__pAcceptFinalVisElem != null)
1504 __pAcceptFinalVisElem->Destroy();
1505 __pAcceptFinalVisElem = null;
1509 delete __pOptionPopup;
1510 __pOptionPopup = null;
1513 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1517 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1521 case REQUEST_ITEM_SELECTED:
1525 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1528 HandleMultipleCallSelection(index->ToInt());
1537 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1539 AppLogDebug("Enter");
1542 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1543 if (pButtonRejectMessage)
1545 pButtonRejectMessage->SetShowState(true);
1546 pButtonRejectMessage->Invalidate(true);
1547 pButtonRejectMessage->Draw();
1549 RequestRedraw(true);