2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file CallIncomingCallForm.cpp
19 * @brief Incoming Call form implementation
21 #include <FBaseColIList.h>
22 #include <FMessaging.h>
23 #include "CallIncomingCallForm.h"
24 #include "CallAppUtility.h"
25 #include "CallSettingsManager.h"
26 #include "CallPresentationModel.h"
27 #include "CallSceneRegister.h"
28 #include "CallTypes.h"
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Messaging;
36 using namespace Tizen::Ui;
37 using namespace Tizen::Ui::Animations;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
42 const int W_DIAL_BITMAP = 100;
43 const int H_DIAL_BITMAP = 100;
44 const int W_CREATE_BITMAP = 56;
45 const int H_CREATE_BITMAP = 56;
46 const int X_CREATE_BITMAP = 8;
47 const int Y_CREATE_BITMAP = 8;
48 const int W_MESSAGE_BG_BITMAP = 720;
49 const int H_MESSAGE_BG_BITMAP = 110;
50 const int W_ARROW_BITMAP = 28;
51 const int H_ARROW_BITMAP = 36;
52 const int W_MESSAGE_BITMAP = 50;
53 const int H_MESSAGE_BITMAP = 50;
54 const int X_MESSAGE_BITMAP = 185;
55 const int Y_MESSAGE_BITMAP = 50;
56 const int MESSAGE_TEXT_X_MARGIN = 20;
57 const int MESSAGE_TEXT_Y_MARGIN = 10;
58 const int SEND_TEXT_X_MARGIN = 78;
59 const int SEND_TEXT_Y_MARGIN = 20;
60 const int SEND_BUTTON_ROUND_DIMENSION = 5;
61 const int W_DIAL_LABEL = 188;
62 const int H_DIAL_LABEL = 188;
63 const int DIAL_ICON_X_OFFSET = 44;
64 const int DIAL_ICON_Y_OFFSET = 44;
65 const int REJECT_LABEL_X_OFFSET = 492;
66 const int X_CALL_PANEL = 20;
67 const int Y_CALL_PANEL = 110;
68 const int H_CALL_PANEL = 188;
69 const int Y_ARROW_LABEL = 79;
70 const int W_ARROW_LABEL = 20;
71 const int H_ARROW_LABEL = 32;
72 const int VALID_TOUCH_X_OFFSET = 158;
73 const int VALID_TOUCH_Y_OFFSET = 158;
74 const int X_ARROW_LABEL_STARTPOS = 206; // 188 circle wodth , 18 GUI spec
75 const int X_ARROW_REJECT_LABEL_STARTPOS = 454; // 700 width of panel - 20 offset - 188 circle width - 18 GUI spec - 20 width of image
76 const int ARROW_LABEL_X_MARGIN = 48; //20 width of arrow and 28 GUI spec
77 const int ACCEPT_LABEL_RELATIVE_POS = -384; //relative pos of accept labels right to reject labels left
78 const int MAX_LIST_HEIGHT = 448;//678;
79 const int H_REJECT_VIEW_FOOTER = 98;
80 const int X_LIST_TEXT_ITEM = 16;
81 const int W_LIST_TEXT_ITEM = 452;
82 const int H_LIST_TEXT_ITEM = 111;
83 const int X_SEND_TEXT_ITEM = 484;
84 const int Y_SEND_TEXT_ITEM = 20;
85 const int W_SEND_TEXT_ITEM = 220;
86 const int W_SEND_BUTTON_MARGIN = 14;
87 const int H_SEND_TEXT_ITEM = 72;
88 const int X_PHOTO_LBL = 166;
89 const int Y_PHOTO_LBL = 232;
90 const int W_PHOTO_LBL = 388;
91 const int H_PHOTO_LBL = 388;
92 const int W_PHOTO_LABEL = 720;
93 const int H_PHOTO_LABEL = 720;
94 const int COUNT_ARROW_ELEMENTS = 3;
96 const unsigned int COLOR_SEND_BUTTON_PRESSED = Color32<130, 142, 150>::Value;
97 const unsigned int COLOR_SEND_BUTTON_NORMAL = Color32<64, 156, 211>::Value;
98 const unsigned int COLOR_SWIPE_PANEL = Color32<0, 0, 0, 255>::Value;
99 const unsigned int COLOR_LIST_TEXT_NORMAL = Color32<0, 0, 0>::Value;
100 const unsigned int COLOR_LIST_TEXT_PRESSED = Color32<249, 249, 249>::Value;
102 const int FONT_SIZE_MSG_TXT = 44;
104 static const wchar_t* IDL_INCOMING_CALL_FORM = L"IDL_INCOMING_CALL_FORM";
105 static const wchar_t* IDB_REJECT_MESSAGE_BG = L"C01-1_Reject_message_bg.png";
106 static const wchar_t* IDB_REJECT_MESSAGE_UP_ARROW = L"C01-1_Reject_message_arrow_01.png";
107 static const wchar_t* IDB_REJECT_MESSAGE_DOWN_ARROW = L"C01-1_Reject_message_arrow_02.png";
108 static const wchar_t* IDB_REJECT_MESSAGE_ICON = L"C01-1_icon_Reject_with_Message.png";
109 static const wchar_t* IDB_ACCEPT_CIRCLE_ICON = L"C01-1_accept_left.png";
110 static const wchar_t* IDB_REJECT_CIRCLE_ICON = L"C01-1_reject_right.png";
111 static const wchar_t* IDB_CALL_ACCEPT_ICON = L"C01-1_accept_left_dial_answer.png";
112 static const wchar_t* IDB_CALL_REJECT_ICON = L"C01-1_reject_right_dial_decline.png";
113 static const wchar_t* IDB_ACCEPT_ARROW_ICON = L"C01-1_arrow_g.png";
114 static const wchar_t* IDB_REJECT_ARROW_ICON = L"C01-1_arrow_r.png";
115 static const wchar_t* IDB_CALL_BG = L"C01-1_calling_BG_01.png";
116 static const wchar_t* IDC_REJECT_MESSAGE_BUTTON = L"IDC_REJECT_MESSAGE_BUTTON";
117 static const wchar_t* IDC_REJECT_PANEL = L"IDC_REJECT_PANEL";
118 static const wchar_t* IDC_REJECT_MESSAGE_CANCEL_BUTTON = L"IDC_REJECT_MESSAGE_CANCEL_BUTTON";
119 static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
120 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
121 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
122 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
123 static const wchar_t* IDC_CALLHANDEL_PANEL = L"IDC_CALLHANDEL_PANEL";
124 static const wchar_t* IDC_ACCEPT_LABEL = L"IDC_ACCEPT_LABEL";
125 static const wchar_t* IDC_REJECT_LEBEL = L"IDC_REJECT_LEBEL";
126 static const wchar_t* IDC_ACCEPT_ARROW = L"IDC_ACCEPT_ARROW_";
127 static const wchar_t* IDC_REJECT_ARROW = L"IDC_REJECT_ARROW_";
128 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
129 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
130 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
132 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
133 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
134 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
135 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
136 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
137 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
138 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
139 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
143 , public ISmsListener
146 void OnSmsMessageSent(result r)
151 IncomingCallForm::IncomingCallForm(void)
152 : BaseForm(FORMTYPE_INCOMINGCALL)
154 __pActiveContactNo = null;
155 __pRejectMessageList = null;
156 __incomingCallHandle = -1;
157 __isAnswerCallStarted = false;
158 __isRejectCallStarted = false;
159 __pAcceptArrowLabelsList = null;
160 __pRejectArrowLabelsList = null;
161 __pRejectCircle = null;
162 __pAcceptCircle = null;
163 __pAcceptDial = null;
164 __pRejectDial = null;
165 __pAcceptArrow = null;
166 __pRejectArrow = null;
167 __pAcceptLabel = null;
168 __pRejectLabel = null;
169 __pAcceptArrowLabel = null;
170 __pRejectArrowLabel = null;
171 __pCallHandlePanel = null;
172 __pAcceptVisElem = null;
173 __pRejectVisElem = null;
174 __pRejectFinalVisElem = null;
175 __pAcceptFinalVisElem = null;
176 __pAcceptArrowVisElem = null;
177 __pRejectArrowVisElem = null;
178 __pCallPresentor = null;
179 __pOptionPopup = null;
180 __pSmallPhotoLabel = null;
183 IncomingCallForm::~IncomingCallForm(void)
188 IncomingCallForm::Initialize(void)
190 Construct(IDL_INCOMING_CALL_FORM);
194 IncomingCallForm::OnInitializing(void)
196 result r = E_SUCCESS;
197 Canvas* pCanvas = null;
202 VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
203 r = pFormVisElem->Construct();
204 pFormVisElem->SetBounds(FloatRectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
205 pFormVisElem->SetShowState(true);
206 pFormVisElem->SetOpacity(1.0f);
207 pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
208 GetVisualElement()->AttachChild(*pFormVisElem);
209 pCanvas = pFormVisElem->GetCanvasN();
213 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
214 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
215 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
221 //Get Reject list from Settings Manager
222 IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
225 __pRejectMessageList = pMsgMap->GetValuesN();
229 InitializeTableView();
231 __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
232 __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
233 __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
234 __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
235 __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
236 __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
239 if(__pRejectDial == null)
243 //Panel for showing accept and reject call buttons.
244 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
245 int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
247 __pCallHandlePanel = static_cast<Panel*>(GetControl(IDC_CALLHANDEL_PANEL, true));
248 __pCallHandlePanel->AddTouchEventListener(*this);
249 __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
250 VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
251 r = pCallPanelVisElem->Construct();
252 pCallPanelVisElem->SetBounds(FloatRectangle(__pCallHandlePanel->GetBoundsF()));
253 pCallPanelVisElem->SetShowState(true);
254 pCallPanelVisElem->SetOpacity(1.0f);
255 pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
256 __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
257 pCanvas = pCallPanelVisElem->GetCanvasN();
260 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
262 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
263 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
264 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
268 //Lock Label for animation
269 __pAcceptLabel = static_cast<Label*>(GetControl(IDC_ACCEPT_LABEL, true));
270 __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
271 __pAcceptLabel->AddTouchEventListener(*this);
273 __pAcceptVisElem = new (std::nothrow) VisualElement();
274 r = __pAcceptVisElem->Construct();
275 __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, __pAcceptLabel->GetWidth(), __pAcceptLabel->GetHeight()));
276 __pAcceptVisElem->SetShowState(true);
277 __pAcceptVisElem->SetOpacity(1.0f);
278 __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
279 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
280 pCanvas = __pAcceptVisElem->GetCanvasN();
283 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
285 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
286 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
287 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
288 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
289 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
293 //UnLock Label for animation
294 __pRejectLabel = static_cast<Label*>(GetControl(IDC_REJECT_LEBEL, true));
295 __pRejectLabel->AddTouchEventListener(*this);
296 __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
297 SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
300 __pRejectVisElem = new (std::nothrow) VisualElement();
301 r = __pRejectVisElem->Construct();
302 __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
303 __pRejectVisElem->SetShowState(true);
304 __pRejectVisElem->SetOpacity(1.00f);
305 __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
306 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
307 pCanvas = __pRejectVisElem->GetCanvasN();
310 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
312 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
313 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
314 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
315 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
316 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
321 //! Constructs an array list to store the unlock labels
322 __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
323 r = __pAcceptArrowLabelsList->Construct();
325 //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
326 int x = X_ARROW_LABEL_STARTPOS;
327 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
329 String LabelName(IDC_ACCEPT_ARROW);
330 LabelName.Append(index+1);
331 __pAcceptArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
332 __pAcceptArrowLabel->AddTouchEventListener(*this);
333 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
334 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
335 r = __pAcceptArrowVisElem->Construct();
336 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
337 __pAcceptArrowVisElem->SetShowState(true);
338 __pAcceptArrowVisElem->SetOpacity(0.0f);
339 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
340 VisualEleName.Append(index);
341 __pAcceptArrowVisElem->SetName(VisualEleName);
342 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
343 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
346 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
348 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
349 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
350 pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
351 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
352 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
356 x += ARROW_LABEL_X_MARGIN;
358 //! Constructs an array list to store the unlock labels
359 __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
360 r = __pRejectArrowLabelsList->Construct();
362 x = X_ARROW_REJECT_LABEL_STARTPOS;
363 for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
365 String LabelName(IDC_REJECT_ARROW);
366 LabelName.Append(index+1);
367 __pRejectArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
368 __pRejectArrowLabel->AddTouchEventListener(*this);
369 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
370 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
371 r = __pRejectArrowVisElem->Construct();
372 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
373 __pRejectArrowVisElem->SetShowState(true);
374 __pRejectArrowVisElem->SetOpacity(0.0f);
375 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
376 VisualEleName.Append(index);
377 __pRejectArrowVisElem->SetName(VisualEleName);
378 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
379 pCanvas = __pRejectArrowVisElem->GetCanvasN();
382 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
384 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
385 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
386 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
387 pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
391 x -= ARROW_LABEL_X_MARGIN;
399 IncomingCallForm::InitializeFooter(void)
401 Footer* pFooter = GetFooter();
402 FooterItem footerItemCreate;
404 SetFormBackEventListener(this);
407 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
408 pFooter->AddActionEventListener(*this);
410 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
411 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
412 pFooter->AddItem(footerItemCreate);
413 pFooter->SetBackButton();
414 pFooter->SetShowState(false);
419 IncomingCallForm::ShowRejectMessageFooter(void)
421 Footer* pFooter = GetFooter();
424 AppLogDebug("SetShowState");
425 pFooter->SetShowState(true);
431 IncomingCallForm::HideRejectMessageFooter(void)
433 Footer* pFooter = GetFooter();
436 pFooter->SetShowState(false);
441 IncomingCallForm::OnTerminating(void)
443 result r = E_SUCCESS;
445 if (__pRejectMessageList != null)
447 delete __pRejectMessageList;
448 __pRejectMessageList = null;
450 if (__pActiveContactNo != null)
452 delete __pActiveContactNo;
453 __pActiveContactNo = null;
455 __incomingCallHandle = -1;
456 __pCallPresentor = null;
458 /* Deleting fails in A4RC* SDK. Remove if not necessary
459 if (__pAcceptVisElem != null)
461 __pAcceptVisElem->Destroy();
462 __pAcceptVisElem = null;
465 if (__pRejectVisElem != null)
467 __pRejectVisElem->Destroy();
468 __pRejectVisElem = null;
471 if (__pRejectFinalVisElem != null)
473 __pRejectFinalVisElem->Destroy();
474 __pRejectFinalVisElem = null;
477 if (__pAcceptFinalVisElem != null)
479 __pAcceptFinalVisElem->Destroy();
480 __pAcceptFinalVisElem = null;
483 for (int i = 0; i < 7; i++)
485 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
486 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
487 if (__pRejectArrowVisElem != null)
489 __pRejectArrowVisElem->Destroy();
490 __pRejectArrowVisElem = null;
493 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
494 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
495 if (__pAcceptArrowVisElem != null)
497 __pAcceptArrowVisElem->Destroy();
498 __pAcceptArrowVisElem = null;
502 if (__pAcceptArrowVisElem != null)
504 __pAcceptArrowVisElem = null;
507 if (__pRejectArrowVisElem != null)
509 __pRejectArrowVisElem = null;
512 if (__pAcceptArrowLabelsList != null)
514 __pAcceptArrowLabelsList->RemoveAll(false);
515 delete __pAcceptArrowLabelsList;
516 __pAcceptArrowLabelsList = null;
519 if (__pRejectArrowLabelsList != null)
521 __pRejectArrowLabelsList->RemoveAll(false);
522 delete __pRejectArrowLabelsList;
523 __pRejectArrowLabelsList = null;
526 if (__pRejectCircle != null)
528 delete __pRejectCircle;
529 __pRejectCircle = null;
532 if (__pAcceptCircle != null)
534 delete __pAcceptCircle;
535 __pAcceptCircle = null;
538 if (__pAcceptDial != null)
540 delete __pAcceptDial;
541 __pAcceptDial = null;
544 if (__pRejectDial != null)
546 delete __pRejectDial;
547 __pRejectDial = null;
550 if (__pAcceptArrow != null)
552 delete __pAcceptArrow;
553 __pAcceptArrow = null;
556 if (__pRejectArrow != null)
558 delete __pRejectArrow;
559 __pRejectArrow = null;
561 __pCallHandlePanel->RemoveTouchEventListener(*this);
562 __pAcceptLabel->RemoveTouchEventListener(*this);
563 __pRejectLabel->RemoveTouchEventListener(*this);
564 __pAcceptArrowLabel->RemoveTouchEventListener(*this);
565 __pRejectArrowLabel->RemoveTouchEventListener(*this);
566 __pAcceptLabel = null;
567 __pRejectLabel = null;
568 __pAcceptArrowLabel = null;
569 __pRejectArrowLabel = null;
570 __pCallHandlePanel = null;
575 IncomingCallForm::ShowRejectMessagePanel(void)
577 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
580 pKeysPanel->SetShowState(true);
581 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
582 Rectangle tmpRect = pMessageList->GetBounds();
583 SetControlAlwaysOnTop(*pKeysPanel,true);
585 //Set Height to Reject Message Panel
586 int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
587 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
589 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
591 if (listHeight > MAX_LIST_HEIGHT)
593 listHeight = MAX_LIST_HEIGHT;
596 pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
597 pMessageList->UpdateTableView();
598 tmpRect = pKeysPanel->GetBounds();
599 pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight);
601 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
602 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
603 pButtonReject->AddActionEventListener(*this);
604 pButtonReject->SetEnabled(true);
605 pButtonReject->SetFocus();
607 ShowRejectMessageFooter();
610 pKeysPanel->SetFocus();
613 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
614 if (pButtonRejectMessage)
616 pButtonRejectMessage->SetShowState(false);
617 pButtonRejectMessage->Invalidate(true);
618 pButtonRejectMessage->Draw();
622 IncomingCallForm::HideRejectMessagePanel(void)
625 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
626 if (pButtonRejectMessage)
628 pButtonRejectMessage->SetShowState(true);
629 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
630 if (pRelativeLayout != null)
632 pRelativeLayout->SetRelation(*pButtonRejectMessage,*this,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
633 pRelativeLayout->Update();
634 delete pRelativeLayout;
640 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
644 case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
646 ShowRejectMessagePanel();
650 case IDA_CREATE_REJECT_CALL_MESSAGE:
652 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
653 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
654 if(pCallList != null && pCallList->GetCount() > 0)
656 __pCallPresentor->HandleCallConnected(*pCallList);
662 case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
664 HideRejectMessagePanel();
668 case IDA_SEND_REJECT_MSG1:
669 case IDA_SEND_REJECT_MSG2:
670 case IDA_SEND_REJECT_MSG3:
671 case IDA_SEND_REJECT_MSG4:
672 case IDA_SEND_REJECT_MSG5:
673 case IDA_SEND_REJECT_MSG6:
675 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
676 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
677 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
678 result r = pSmsManager->Construct(*pSmsListener);
679 if (IsFailed(r) == false)
681 RecipientList recipient;
682 recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
683 SmsMessage smsMessage;
686 int msgIndex = IDA_SEND_REJECT_MSG1;
687 msgIndex = actionId - msgIndex;
688 __pRejectMessageList->GetAt(msgIndex, textToBeSent);
689 r = smsMessage.SetText(textToBeSent);
690 if (IsFailed(r) == false)
692 r = pSmsManager->Send(smsMessage,recipient,true);
693 if (IsFailed(r) == true)
695 //todo: error message
700 //todo: error message
705 //todo: error message
709 /*ArrayListT<CallInfo>* pCallList = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
710 __pCallPresentor->HandleCallConnected(*pCallList);
721 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
723 AddOrientationEventListener(*this);
724 //listen to Foreground events
725 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
726 pPhoneApp->AddAppStateChangeListener(*this);
727 if(__pCallPresentor == null)
729 __pCallPresentor = CallPresentationModel::GetInstance();
731 __pCallPresentor->SetTelEventListener(this);
734 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
736 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
738 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
740 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
743 __pAcceptVisElem->SetOpacity(1.0f);
744 __pRejectVisElem->SetOpacity(1.00f);
745 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
747 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
748 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
749 RejectVisualEleName.Append(i);
750 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
751 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
752 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
753 AcceptVisualEleName.Append(i);
754 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
758 __pAcceptArrowVisElem->SetOpacity(0.6f);
759 __pRejectArrowVisElem->SetOpacity(0.6f);
762 __pAcceptArrowVisElem->SetOpacity(0.8f);
763 __pRejectArrowVisElem->SetOpacity(0.8f);
766 __pAcceptArrowVisElem->SetOpacity(1.0f);
767 __pRejectArrowVisElem->SetOpacity(1.0f);
777 AppCallInfo* pIncomingCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
778 if (pIncomingCall != null)
780 //start alert with contact's custom ringtone
781 __pCallPresentor->StartAlert(*pIncomingCall);
782 //show contact number
784 contactNo.Append(pIncomingCall->GetContactNumber());
785 if (__pActiveContactNo)
787 delete __pActiveContactNo;
788 __pActiveContactNo = null;
790 __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
791 __pActiveContactNo = new (std::nothrow) String();
793 if(contactNo.IsEmpty())
795 AppLogDebug("Number empty");
796 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
797 AppLogDebug("%ls",contactNo.GetPointer());
799 __pActiveContactNo->Append(contactNo);
800 //Show person details
801 ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
802 //Check if incoming call is hidden call, then do not show "Reject with Message" button
803 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
804 if (pButtonRejectMessage)
806 //for hidden call, contact number is not present
807 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
808 pButtonRejectMessage->SetShowState(showRejectMsgButton);
809 pButtonRejectMessage->Invalidate(true);
816 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
817 pCallApp->SetTopMostWindow(true);
818 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
819 if (pButtonRejectMessage)
821 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
822 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
823 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
824 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
825 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
826 pButtonRejectMessage->AddActionEventListener(*this);
832 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
834 RemoveOrientationEventListener(*this);
835 if (__pSmallPhotoLabel != null)
837 RemoveControl(*__pSmallPhotoLabel);
838 __pSmallPhotoLabel = null;
840 for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
842 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
843 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
844 RejectVisualEleName.Append(i);
845 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
846 __pRejectArrowVisElem->SetOpacity(0.0f);
847 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
848 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
849 AcceptVisualEleName.Append(i);
850 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
851 __pAcceptArrowVisElem->SetOpacity(0.0f);
853 if(__pAcceptLabel != null)
855 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
857 AppLogDebug("__pAcceptLabel Detatach child");
858 __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
861 if(__pRejectLabel != null)
863 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
865 AppLogDebug("__pRejectLabel Detatach child");
866 __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
870 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
871 pCallApp->RemoveAppStateChangeListener(*this);
875 IncomingCallForm::OnDraw(void)
877 Bitmap* pBackgroundWp = null;
878 // get a Canvas instance
879 Canvas* pCanvas = GetCanvasN();
881 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
888 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
892 delete pBackgroundWp;
893 pBackgroundWp = null;
902 IncomingCallForm::HideRejectPanel(void)
904 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
907 pKeysPanel->SetShowState(false);
908 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
909 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
910 pButtonReject->AddActionEventListener(*this);
911 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
912 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
913 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
914 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
916 HideRejectMessageFooter();
917 pKeysPanel->Invalidate(true);
922 IncomingCallForm::InitializeTableView(void)
924 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
926 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
927 pMessageList->SetItemProvider(this);
928 pMessageList->AddTableViewItemEventListener(*this);
931 ///////////////////////////////////////////////////////////////////////////////
932 ///// Table View Functionality supporting functions /////
933 //////////////////////////////////////////////////////////////////////////////
935 IncomingCallForm::GetItemCount(void)
937 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
939 return (__pRejectMessageList->GetCount());
945 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
948 TableViewItem* pItem = new (std::nothrow) TableViewItem();
949 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
951 //Message text item rectangle
952 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
955 String itemName(L"");
956 bool isShowSendButton = true;
957 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
959 __pRejectMessageList->GetAt(itemIndex, itemName);
963 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
964 isShowSendButton = false;
967 Label* pMsgLbl = new (std::nothrow) Label();
968 pMsgLbl->Construct(itemRect, itemName);
969 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
970 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
971 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
972 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
973 pItem->AddControl(*pMsgLbl);
976 if(isShowSendButton == true)
978 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
979 Button* pSendButton = new (std::nothrow) Button();
980 pSendButton->Construct(Rectangle(GetClientAreaBounds().width - W_SEND_BUTTON_MARGIN -W_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
981 //set action id and listener
982 int actionId = IDA_SEND_REJECT_MSG1;
986 actionId = IDA_SEND_REJECT_MSG1;
989 actionId = IDA_SEND_REJECT_MSG2;
992 actionId = IDA_SEND_REJECT_MSG3;
995 actionId = IDA_SEND_REJECT_MSG4;
998 actionId = IDA_SEND_REJECT_MSG5;
1001 actionId = IDA_SEND_REJECT_MSG6;
1004 pSendButton->SetActionId(actionId);
1005 pSendButton->AddActionEventListener(*this);
1006 pItem->AddControl(*pSendButton);
1007 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1011 pItem->SetEnabled(false);
1018 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1026 IncomingCallForm::GetDefaultItemHeight(void)
1028 return H_LIST_NORMAL_MENU_ITEM;
1032 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, AppCallInfo* pCallInfo)
1034 //call individual methods to show contact number, caller name & photo
1035 SetTextToLabel(phoneNumber, contactLblName);
1037 //fetch contact details based on phone number
1038 String* pDisplayName = pCallInfo->FetchCallerNameN();
1039 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1040 ShowCallerPhoto(pPhotoBitmap);
1045 SetTextToLabel(*pDisplayName, nameLblName);
1046 delete pDisplayName;
1047 pDisplayName = null;
1052 delete pPhotoBitmap;
1053 pPhotoBitmap = null;
1058 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1060 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1061 //passing an empty string to SetText fails in label,
1062 //if previously valid text has been set
1063 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1065 String stringToBeSet(L"");
1066 pContactLbl->SetText(stringToBeSet);
1071 pContactLbl->SetText(textToBeSet);
1076 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1078 bool showSmallPhoto = false;
1079 //show photo - for Big Photo Id, Animated Call Image
1080 if (pPhotoId == null)
1082 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1086 //Check the size of photo
1087 // Now checking the condition with && but actually it should be ||
1088 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1089 // height 270 and width = 480 . So all images set thru gallery is show as small image
1090 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1091 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1093 showSmallPhoto = true;
1097 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1098 if(showSmallPhoto == true)
1100 ShowThumbnailImage(pPhotoId);
1104 if (pPhotoLbl != null && pPhotoId != null)
1106 Canvas* pCanvas = new (std::nothrow) Canvas;
1107 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1108 pCanvas->Construct(canvasRect);
1109 //draw the contact bitmap
1110 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1111 Bitmap* pNewPhotoId = new Bitmap();
1112 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1115 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1116 pPhotoLbl->Invalidate(true);
1123 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1125 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1127 if (pPhotoLbl != null && pPhotoId != null)
1129 Canvas* pCanvas = new (std::nothrow) Canvas;
1130 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1131 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1132 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1133 pCanvas->Construct(canvasRect);
1134 //draw the back ground
1135 pCanvas->DrawBitmap(canvasRect,*pBackground);
1136 //draw shadow (to be enabled after correct shadow image is provided )
1137 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1138 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1139 //draw the contact bitmap
1140 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1141 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1142 Bitmap* pNewPhotoId = new Bitmap();
1143 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1146 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1147 pPhotoLbl->Invalidate(true);
1156 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1158 //Draw Small Photo and show on small photo label
1159 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1160 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1161 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1162 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1163 // Add a Label to the Form
1164 AddControl(*__pSmallPhotoLabel);
1165 __pSmallPhotoLabel->Invalidate(true);
1169 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1171 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1172 if (pTimerLbl != null)
1174 pTimerLbl->SetText(textToBeDisplayed);
1179 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1180 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1183 Button* pButton = null;
1184 if (isButtonInPanel == false)
1186 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1190 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1191 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1193 Bitmap* pHoldBmp = null;
1194 Canvas* pCanvas = null;
1195 pCanvas = new (std::nothrow) Canvas();
1196 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1197 //set bitmap to button
1198 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1201 //scale bitmap to predefined size
1202 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1203 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1204 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1208 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1211 //scale bitmap to predefined size
1212 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1213 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1214 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1222 String holdBtnName = AppUtility::GetResourceString(btnName);
1223 FloatDimension textDimension;
1224 if (!holdBtnName.IsEmpty())
1227 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1228 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1229 textDimension.height = textDimension.height + font.GetDescender();
1230 TextElement* pTextElement = new (std::nothrow) TextElement();
1231 pTextElement->Construct(holdBtnName);
1232 Color textColor(249, 249, 249);
1233 if (setButtonPressBitmap)
1235 textColor.SetAlpha(255);
1239 textColor.SetAlpha(127);
1242 pTextElement->SetTextColor(textColor);
1243 pTextElement->SetFont(font);
1245 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1246 pEnrichedText->Construct(textDimension);
1247 pEnrichedText->Add(*pTextElement);
1248 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1249 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1250 pCanvas->DrawText(textPos, *pEnrichedText);
1252 pEnrichedText->RemoveAll(true);
1253 delete pEnrichedText;
1257 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1260 //scale bitmap to predefined size
1261 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1262 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1263 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1264 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1267 //set background bitmpa to button
1268 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1269 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1270 if (setButtonPressBitmap)
1272 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1276 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1278 delete pActualBgBmp;
1283 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1286 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1288 __pCallPresentor->StopAlert();
1289 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1291 Rectangle rect = source.GetBounds();
1292 if (source.Equals(*__pAcceptLabel))
1294 __isAnswerCallStarted = true;
1295 __isRejectCallStarted = false;
1297 else if (source.Equals(*__pRejectLabel))
1299 __isAnswerCallStarted = false;
1300 __isRejectCallStarted = true;
1304 // touch event between the 2 labels. So Do nothing
1311 // On Touch released, the animation and the visual elements disappear
1313 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1315 AppLogDebug("%d",currentPosition.x);
1316 if (__isAnswerCallStarted == true)
1318 if (currentPosition.x > __pRejectLabel->GetBounds().x)
1321 if(__pRejectFinalVisElem == null)
1323 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1324 __pRejectFinalVisElem->Construct();
1325 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1327 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1328 __pRejectFinalVisElem->SetShowState(true);
1329 __pRejectFinalVisElem->SetOpacity(1.00f);
1330 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1332 AppLogDebug("AttachChild __pRejectFinalVisElem");
1333 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1335 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1338 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1339 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1340 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1341 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1345 __pAcceptVisElem->SetOpacity(0.0f);
1346 //fetch already active call list
1347 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1348 if (pCallList != null && pCallList->GetCount() > 0)
1350 //then atleast 1 active call exist.
1351 AppCallInfo phnCallInfo;
1352 pCallList->GetAt(0,phnCallInfo);
1353 //Check if only 1 call exist and it is on Hold
1354 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1356 //directly accept call
1357 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1361 //Either 1 call exist and not "on Hold".
1363 if(__pOptionPopup != null)
1365 delete __pOptionPopup;
1366 __pOptionPopup = null;
1368 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1369 __pOptionPopup->Initialize();
1370 __pOptionPopup->SetShowState(true);
1371 __pOptionPopup->Draw();
1372 __pOptionPopup->Show();
1374 pCallList->RemoveAll();
1378 //no active call - Accept the incoming call
1379 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1386 __pAcceptVisElem->SetOpacity(1.0f);
1387 __pRejectVisElem->SetOpacity(1.00f);
1391 else if (__isRejectCallStarted == true)
1393 if (currentPosition.x < ((__pAcceptLabel->GetBounds().x + __pAcceptLabel->GetWidth())- __pRejectLabel->GetBounds().x))
1396 if(__pAcceptFinalVisElem == null)
1398 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1399 __pAcceptFinalVisElem->Construct();
1400 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1402 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1403 __pAcceptFinalVisElem->SetOpacity(1.0f);
1406 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1408 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1409 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1411 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1414 AppLogDebug("__pAcceptFinalVisElem drawing");
1415 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1416 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1417 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1418 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1419 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1422 __pRejectVisElem->SetOpacity(0.0f);
1424 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1428 __pAcceptVisElem->SetOpacity(1.0f);
1429 __pRejectVisElem->SetOpacity(1.00f);
1433 __isAnswerCallStarted = false;
1434 __isRejectCallStarted = false;
1438 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1440 if (__isAnswerCallStarted == true)
1442 if (currentPosition.x > 170 && currentPosition.x < 578)
1444 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1446 __pRejectVisElem->SetOpacity(0.60f);
1447 __pAcceptVisElem->SetOpacity(0.60f);
1451 __pRejectVisElem->SetOpacity(1.0f);
1452 __pAcceptVisElem->SetOpacity(1.0f);
1457 if (__isRejectCallStarted == true)
1459 if (currentPosition.x < 0 && currentPosition.x > -522)
1461 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1463 __pRejectVisElem->SetOpacity(0.60f);
1464 __pAcceptVisElem->SetOpacity(0.60f);
1468 __pRejectVisElem->SetOpacity(1.0f);
1469 __pAcceptVisElem->SetOpacity(1.0f);
1476 IncomingCallForm::OnItemSelected(int itemIndex)
1478 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1481 //display name, mobile number
1482 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1483 pArgs->Add(argIndex);
1484 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1488 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1490 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1492 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1494 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1496 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1499 __pAcceptVisElem->SetOpacity(1.0f);
1500 __pRejectVisElem->SetOpacity(1.00f);
1502 if (__pRejectFinalVisElem != null)
1504 __pRejectFinalVisElem->Destroy();
1505 __pRejectFinalVisElem = null;
1507 if (__pAcceptFinalVisElem != null)
1509 __pAcceptFinalVisElem->Destroy();
1510 __pAcceptFinalVisElem = null;
1515 delete __pOptionPopup;
1516 __pOptionPopup = null;
1519 if(itemIndex != IDA_BUTTON_CANCEL_OPTIONS_POPUP)
1521 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1526 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1530 case REQUEST_ITEM_SELECTED:
1534 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1537 HandleMultipleCallSelection(index->ToInt());
1546 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1548 AppLogDebug("Enter");
1551 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1552 if (pButtonRejectMessage)
1554 pButtonRejectMessage->SetShowState(true);
1555 pButtonRejectMessage->Invalidate(true);
1556 pButtonRejectMessage->Draw();
1558 RequestRedraw(true);
1563 IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1565 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1566 if(pKeysPanel->GetShowState() == true)
1568 HideRejectMessagePanel();
1569 ShowRejectMessagePanel();
1572 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1573 if (pButtonRejectMessage != null)
1575 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1576 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
1577 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1578 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
1579 pButtonRejectMessage->Invalidate(true);
1582 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1583 if (pButtonReject != null)
1585 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1586 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
1587 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1588 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
1589 pButtonReject->Invalidate(true);
1594 IncomingCallForm::OnForeground(void)
1596 __pCallPresentor->OnAppForeground();
1600 IncomingCallForm::OnScreenOff(void)
1602 __pCallPresentor->StopAlert();
1606 IncomingCallForm::CallDisconnected(void)
1608 //check if no call option popup is shown, then remain on incoming call screen.
1609 //As user has neither accepted nor rejected incoming call.
1610 if (__pOptionPopup == null)
1615 //fetch already active call list and show updated option popup
1616 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1617 if (pCallList != null && pCallList->GetCount() > 0)
1619 //then atleast 1 active call exist.
1620 AppCallInfo phnCallInfo;
1621 pCallList->GetAt(0,phnCallInfo);
1622 //Check if only 1 call exist and it is on Hold
1623 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1625 //directly accept call
1626 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1630 //Either 1 call exist and not "on Hold".
1632 if(__pOptionPopup != null)
1634 delete __pOptionPopup;
1635 __pOptionPopup = null;
1637 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1638 __pOptionPopup->Initialize();
1639 __pOptionPopup->SetShowState(true);
1640 __pOptionPopup->Draw();
1641 __pOptionPopup->Show();
1643 pCallList->RemoveAll();
1647 //no active call - Accept the incoming call
1648 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);