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->SetTopMostWindow(false);
872 pCallApp->RemoveAppStateChangeListener(*this);
876 IncomingCallForm::OnDraw(void)
878 Bitmap* pBackgroundWp = null;
879 // get a Canvas instance
880 Canvas* pCanvas = GetCanvasN();
882 pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
889 pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
893 delete pBackgroundWp;
894 pBackgroundWp = null;
903 IncomingCallForm::HideRejectPanel(void)
905 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
908 pKeysPanel->SetShowState(false);
909 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
910 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
911 pButtonReject->AddActionEventListener(*this);
912 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
913 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
914 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
915 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
917 HideRejectMessageFooter();
918 pKeysPanel->Invalidate(true);
923 IncomingCallForm::InitializeTableView(void)
925 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
927 TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
928 pMessageList->SetItemProvider(this);
929 pMessageList->AddTableViewItemEventListener(*this);
932 ///////////////////////////////////////////////////////////////////////////////
933 ///// Table View Functionality supporting functions /////
934 //////////////////////////////////////////////////////////////////////////////
936 IncomingCallForm::GetItemCount(void)
938 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
940 return (__pRejectMessageList->GetCount());
946 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
949 TableViewItem* pItem = new (std::nothrow) TableViewItem();
950 pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
952 //Message text item rectangle
953 Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
956 String itemName(L"");
957 bool isShowSendButton = true;
958 if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
960 __pRejectMessageList->GetAt(itemIndex, itemName);
964 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
965 isShowSendButton = false;
968 Label* pMsgLbl = new (std::nothrow) Label();
969 pMsgLbl->Construct(itemRect, itemName);
970 pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
971 pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
972 pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
973 pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
974 pItem->AddControl(*pMsgLbl);
977 if(isShowSendButton == true)
979 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
980 Button* pSendButton = new (std::nothrow) Button();
981 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);
982 //set action id and listener
983 int actionId = IDA_SEND_REJECT_MSG1;
987 actionId = IDA_SEND_REJECT_MSG1;
990 actionId = IDA_SEND_REJECT_MSG2;
993 actionId = IDA_SEND_REJECT_MSG3;
996 actionId = IDA_SEND_REJECT_MSG4;
999 actionId = IDA_SEND_REJECT_MSG5;
1002 actionId = IDA_SEND_REJECT_MSG6;
1005 pSendButton->SetActionId(actionId);
1006 pSendButton->AddActionEventListener(*this);
1007 pItem->AddControl(*pSendButton);
1008 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1012 pItem->SetEnabled(false);
1019 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1027 IncomingCallForm::GetDefaultItemHeight(void)
1029 return H_LIST_NORMAL_MENU_ITEM;
1033 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, AppCallInfo* pCallInfo)
1035 //call individual methods to show contact number, caller name & photo
1036 SetTextToLabel(phoneNumber, contactLblName);
1038 //fetch contact details based on phone number
1039 String* pDisplayName = pCallInfo->FetchCallerNameN();
1040 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1041 ShowCallerPhoto(pPhotoBitmap);
1046 SetTextToLabel(*pDisplayName, nameLblName);
1047 delete pDisplayName;
1048 pDisplayName = null;
1053 delete pPhotoBitmap;
1054 pPhotoBitmap = null;
1059 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1061 Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1062 //passing an empty string to SetText fails in label,
1063 //if previously valid text has been set
1064 if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1066 String stringToBeSet(L"");
1067 pContactLbl->SetText(stringToBeSet);
1072 pContactLbl->SetText(textToBeSet);
1077 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1079 bool showSmallPhoto = false;
1080 //show photo - for Big Photo Id, Animated Call Image
1081 if (pPhotoId == null)
1083 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1087 //Check the size of photo
1088 // Now checking the condition with && but actually it should be ||
1089 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1090 // height 270 and width = 480 . So all images set thru gallery is show as small image
1091 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1092 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1094 showSmallPhoto = true;
1098 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1099 if(showSmallPhoto == true)
1101 ShowThumbnailImage(pPhotoId);
1105 if (pPhotoLbl != null && pPhotoId != null)
1107 Canvas* pCanvas = new (std::nothrow) Canvas;
1108 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1109 pCanvas->Construct(canvasRect);
1110 //draw the contact bitmap
1111 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1112 Bitmap* pNewPhotoId = new Bitmap();
1113 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1116 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1117 pPhotoLbl->Invalidate(true);
1124 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1126 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1128 if (pPhotoLbl != null && pPhotoId != null)
1130 Canvas* pCanvas = new (std::nothrow) Canvas;
1131 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1132 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1133 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1134 pCanvas->Construct(canvasRect);
1135 //draw the back ground
1136 pCanvas->DrawBitmap(canvasRect,*pBackground);
1137 //draw shadow (to be enabled after correct shadow image is provided )
1138 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1139 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1140 //draw the contact bitmap
1141 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1142 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1143 Bitmap* pNewPhotoId = new Bitmap();
1144 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1147 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1148 pPhotoLbl->Invalidate(true);
1157 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1159 //Draw Small Photo and show on small photo label
1160 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1161 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1162 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1163 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1164 // Add a Label to the Form
1165 AddControl(*__pSmallPhotoLabel);
1166 __pSmallPhotoLabel->Invalidate(true);
1170 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1172 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1173 if (pTimerLbl != null)
1175 pTimerLbl->SetText(textToBeDisplayed);
1180 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1181 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1184 Button* pButton = null;
1185 if (isButtonInPanel == false)
1187 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1191 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1192 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1194 Bitmap* pHoldBmp = null;
1195 Canvas* pCanvas = null;
1196 pCanvas = new (std::nothrow) Canvas();
1197 pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1198 //set bitmap to button
1199 pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1202 //scale bitmap to predefined size
1203 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1204 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1205 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1209 pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1212 //scale bitmap to predefined size
1213 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1214 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1215 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1223 String holdBtnName = AppUtility::GetResourceString(btnName);
1224 FloatDimension textDimension;
1225 if (!holdBtnName.IsEmpty())
1228 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1229 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1230 textDimension.height = textDimension.height + font.GetDescender();
1231 TextElement* pTextElement = new (std::nothrow) TextElement();
1232 pTextElement->Construct(holdBtnName);
1233 Color textColor(249, 249, 249);
1234 if (setButtonPressBitmap)
1236 textColor.SetAlpha(255);
1240 textColor.SetAlpha(127);
1243 pTextElement->SetTextColor(textColor);
1244 pTextElement->SetFont(font);
1246 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1247 pEnrichedText->Construct(textDimension);
1248 pEnrichedText->Add(*pTextElement);
1249 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1250 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1251 pCanvas->DrawText(textPos, *pEnrichedText);
1253 pEnrichedText->RemoveAll(true);
1254 delete pEnrichedText;
1258 pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1261 //scale bitmap to predefined size
1262 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1263 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1264 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1265 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1268 //set background bitmpa to button
1269 Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1270 pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1271 if (setButtonPressBitmap)
1273 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1277 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1279 delete pActualBgBmp;
1284 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1287 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1289 __pCallPresentor->StopAlert();
1290 if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1292 Rectangle rect = source.GetBounds();
1293 if (source.Equals(*__pAcceptLabel))
1295 __isAnswerCallStarted = true;
1296 __isRejectCallStarted = false;
1298 else if (source.Equals(*__pRejectLabel))
1300 __isAnswerCallStarted = false;
1301 __isRejectCallStarted = true;
1305 // touch event between the 2 labels. So Do nothing
1312 // On Touch released, the animation and the visual elements disappear
1314 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1316 AppLogDebug("%d",currentPosition.x);
1317 if (__isAnswerCallStarted == true)
1319 if (currentPosition.x > __pRejectLabel->GetBounds().x)
1322 if(__pRejectFinalVisElem == null)
1324 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1325 __pRejectFinalVisElem->Construct();
1326 __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1328 __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1329 __pRejectFinalVisElem->SetShowState(true);
1330 __pRejectFinalVisElem->SetOpacity(1.00f);
1331 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1333 AppLogDebug("AttachChild __pRejectFinalVisElem");
1334 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1336 Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1339 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1340 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1341 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1342 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1346 __pAcceptVisElem->SetOpacity(0.0f);
1347 //fetch already active call list
1348 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1349 if (pCallList != null && pCallList->GetCount() > 0)
1351 //then atleast 1 active call exist.
1352 AppCallInfo phnCallInfo;
1353 pCallList->GetAt(0,phnCallInfo);
1354 //Check if only 1 call exist and it is on Hold
1355 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1357 //directly accept call
1358 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1362 //Either 1 call exist and not "on Hold".
1364 if(__pOptionPopup != null)
1366 delete __pOptionPopup;
1367 __pOptionPopup = null;
1369 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1370 __pOptionPopup->Initialize();
1371 __pOptionPopup->SetShowState(true);
1372 __pOptionPopup->Draw();
1373 __pOptionPopup->Show();
1375 pCallList->RemoveAll();
1379 //no active call - Accept the incoming call
1380 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1387 __pAcceptVisElem->SetOpacity(1.0f);
1388 __pRejectVisElem->SetOpacity(1.00f);
1392 else if (__isRejectCallStarted == true)
1394 if (currentPosition.x < ((__pAcceptLabel->GetBounds().x + __pAcceptLabel->GetWidth())- __pRejectLabel->GetBounds().x))
1397 if(__pAcceptFinalVisElem == null)
1399 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1400 __pAcceptFinalVisElem->Construct();
1401 __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1403 __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1404 __pAcceptFinalVisElem->SetOpacity(1.0f);
1407 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1409 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1410 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1412 Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1415 AppLogDebug("__pAcceptFinalVisElem drawing");
1416 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1417 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1418 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1419 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1420 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1423 __pRejectVisElem->SetOpacity(0.0f);
1425 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1429 __pAcceptVisElem->SetOpacity(1.0f);
1430 __pRejectVisElem->SetOpacity(1.00f);
1434 __isAnswerCallStarted = false;
1435 __isRejectCallStarted = false;
1439 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1441 if (__isAnswerCallStarted == true)
1443 if (currentPosition.x > 170 && currentPosition.x < 578)
1445 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1447 __pRejectVisElem->SetOpacity(0.60f);
1448 __pAcceptVisElem->SetOpacity(0.60f);
1452 __pRejectVisElem->SetOpacity(1.0f);
1453 __pAcceptVisElem->SetOpacity(1.0f);
1458 if (__isRejectCallStarted == true)
1460 if (currentPosition.x < 0 && currentPosition.x > -522)
1462 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1464 __pRejectVisElem->SetOpacity(0.60f);
1465 __pAcceptVisElem->SetOpacity(0.60f);
1469 __pRejectVisElem->SetOpacity(1.0f);
1470 __pAcceptVisElem->SetOpacity(1.0f);
1477 IncomingCallForm::OnItemSelected(int itemIndex)
1479 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1482 //display name, mobile number
1483 Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1484 pArgs->Add(argIndex);
1485 SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1489 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1491 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1493 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1495 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1497 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1500 __pAcceptVisElem->SetOpacity(1.0f);
1501 __pRejectVisElem->SetOpacity(1.00f);
1503 if (__pRejectFinalVisElem != null)
1505 __pRejectFinalVisElem->Destroy();
1506 __pRejectFinalVisElem = null;
1508 if (__pAcceptFinalVisElem != null)
1510 __pAcceptFinalVisElem->Destroy();
1511 __pAcceptFinalVisElem = null;
1516 delete __pOptionPopup;
1517 __pOptionPopup = null;
1520 if(itemIndex != IDA_BUTTON_CANCEL_OPTIONS_POPUP)
1522 __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1527 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1531 case REQUEST_ITEM_SELECTED:
1535 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1538 HandleMultipleCallSelection(index->ToInt());
1547 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1549 AppLogDebug("Enter");
1552 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1553 if (pButtonRejectMessage)
1555 pButtonRejectMessage->SetShowState(true);
1556 pButtonRejectMessage->Invalidate(true);
1557 pButtonRejectMessage->Draw();
1559 RequestRedraw(true);
1564 IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1566 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1567 if(pKeysPanel->GetShowState() == true)
1569 HideRejectMessagePanel();
1570 ShowRejectMessagePanel();
1573 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1574 if (pButtonRejectMessage != null)
1576 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1577 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
1578 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1579 IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
1580 pButtonRejectMessage->Invalidate(true);
1583 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1584 if (pButtonReject != null)
1586 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1587 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
1588 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1589 IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
1590 pButtonReject->Invalidate(true);
1595 IncomingCallForm::OnForeground(void)
1597 __pCallPresentor->OnAppForeground();
1601 IncomingCallForm::OnScreenOff(void)
1603 __pCallPresentor->StopAlert();
1607 IncomingCallForm::CallDisconnected(void)
1609 //check if no call option popup is shown, then remain on incoming call screen.
1610 //As user has neither accepted nor rejected incoming call.
1611 if (__pOptionPopup == null)
1616 //fetch already active call list and show updated option popup
1617 ArrayListT<AppCallInfo>* pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
1618 if (pCallList != null && pCallList->GetCount() > 0)
1620 //then atleast 1 active call exist.
1621 AppCallInfo phnCallInfo;
1622 pCallList->GetAt(0,phnCallInfo);
1623 //Check if only 1 call exist and it is on Hold
1624 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1626 //directly accept call
1627 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1631 //Either 1 call exist and not "on Hold".
1633 if(__pOptionPopup != null)
1635 delete __pOptionPopup;
1636 __pOptionPopup = null;
1638 __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1639 __pOptionPopup->Initialize();
1640 __pOptionPopup->SetShowState(true);
1641 __pOptionPopup->Draw();
1642 __pOptionPopup->Show();
1644 pCallList->RemoveAll();
1648 //no active call - Accept the incoming call
1649 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);