Initialize Tizen 2.3
[apps/osp/Contacts.git] / src / CtContactSelectorForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file        CtContactSelectorForm.cpp
19  * @brief       This is the implementation file for the ContactSelectorForm class.
20  */
21
22 #include <FApp.h>
23 #include <FSocial.h>
24 #include "CtContactsApp.h"
25 #include "CtContactSelectorForm.h"
26 #include "CtContactListItem.h"
27 #include "CtContactListPresentationModel.h"
28 #include "CtResourceManager.h"
29 #include "CtSceneRegister.h"
30 #include "CtSearchListEventListener.h"
31 #include "CtSearchListItem.h"
32 #include "CtTypes.h"
33
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Graphics;
38 using namespace Tizen::Ui;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
41 using namespace Tizen::Social;
42
43 static const int IDA_FOOTER_DONE = 0;
44 static const int IDA_FOOTER_CANCEL = 1;
45 static const int IDA_CHECK_SELECT_ALL_CHECKED = 10;
46 static const int IDA_CHECK_SELECT_ALL_UNCHECKED = 11;
47
48 static const int H_SEARCHBAR = 86;
49 static const int H_SELECT_ALL = 112;
50 static const int H_GROUP_ITEM = 76;
51 static const int H_BOTTOM_LABEL = 48;
52 static const int X_LIST_ITEM_TEXT_MARGIN = 32;
53 static const int H_CHECK_LABEL = 72;
54 static const int Y_CHECK_LABEL = 20;
55
56 static const int FONT_SIZE_BOTTOM_LABEL = 32;
57
58 static const unsigned int COLOR_BOTTOM_LABEL_BG = Color32<68, 68, 68>::Value;
59 static const unsigned int COLOR_BOTTOM_LABEL_FONT = Color32<255, 255, 255>::Value;
60 static const unsigned int COLOR_CHECK_LABEL_BG = Color32<220, 218, 211>::Value;
61
62 ContactSelectorForm::ContactSelectorForm(void)
63 : __pPresentationModel(null)
64 , __pSelectAll(null)
65 , __pListView(null)
66 , __pSearchListView(null)
67 , __pCheckLabel(null)
68 , __pBottomLabel(null)
69 , __pSearchBar(null)
70 , __pSearchListEvent(null)
71 {
72 }
73
74 ContactSelectorForm::~ContactSelectorForm(void)
75 {
76 }
77
78 void
79 ContactSelectorForm::Initialize(void)
80 {
81         Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
82 }
83
84 result
85 ContactSelectorForm::OnInitializing(void)
86 {
87         Header* pHeader = GetHeader();
88         pHeader->SetTitleText(ResourceManager::GetString(L"IDS_PB_HEADER_SELECT_CONTACTS"));
89
90         SetFormBackEventListener(this);
91
92         CreateFooterButton();
93
94         __pPresentationModel = ContactListPresentationModel::GetInstance();
95
96         __pCheckLabel = new (std::nothrow) Label();
97         __pCheckLabel->Construct(Rectangle(0, H_SEARCHBAR + Y_CHECK_LABEL, GetClientAreaBounds().width, H_CHECK_LABEL), L"");
98         __pCheckLabel->SetBackgroundColor(COLOR_CHECK_LABEL_BG);
99         AddControl(__pCheckLabel);
100
101         __pSelectAll = new (std::nothrow) CheckButton();
102         __pSelectAll->Construct(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, H_SELECT_ALL), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_NONE);
103         __pSelectAll->SetText(ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
104         __pSelectAll->SetActionId(IDA_CHECK_SELECT_ALL_CHECKED, IDA_CHECK_SELECT_ALL_UNCHECKED);
105         __pSelectAll->AddActionEventListener(*this);
106         AddControl(__pSelectAll);
107
108         __pListView = new (std::nothrow) GroupedListView();
109         __pListView->Construct(Rectangle(0, H_SELECT_ALL + H_SEARCHBAR, GetClientAreaBounds().width,
110                                                                                         GetClientAreaBounds().height - (H_SEARCHBAR + H_SELECT_ALL + H_BOTTOM_LABEL)), GROUPED_LIST_VIEW_STYLE_INDEXED, true, true);
111         __pListView->SetItemProvider(*this);
112         __pListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
113         __pListView->AddFastScrollListener(*this);
114         __pListView->AddGroupedListViewItemEventListener(*this);
115         __pListView->AddTouchEventListener(*this);
116         AddControl(__pListView);
117
118         __pSearchBar = new (std::nothrow) SearchBar();
119         __pSearchBar->Construct(Rectangle(0, 0, GetClientAreaBounds().width, H_SEARCHBAR));
120         __pSearchBar->SetGuideText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
121         __pSearchBar->AddSearchBarEventListener(*this);
122         __pSearchBar->AddTextEventListener(*this);
123         __pSearchBar->AddKeypadEventListener(*this);
124         __pSearchBar->SetContentAreaSize(Dimension(0, 0));
125
126         __pSearchListEvent = new (std::nothrow) SearchListEventListener(LIST_ANNEX_STYLE_MARK, __pPresentationModel);
127         AddControl(__pSearchBar);
128
129         __pSearchListView = new (std::nothrow) GroupedListView();
130         __pSearchListView->Construct(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
131         __pSearchListView->SetItemProvider(*__pSearchListEvent);
132         __pSearchListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
133         __pSearchListView->AddGroupedListViewItemEventListener(*this);
134         __pSearchListView->AddTouchEventListener(*this);
135         __pSearchListView->SetShowState(false);
136         AddControl(__pSearchListView);
137
138         __pBottomLabel = new (std::nothrow) Label();
139         __pBottomLabel->Construct(FloatRectangle(0, GetClientAreaBoundsF().height - H_BOTTOM_LABEL, GetClientAreaBoundsF().width, H_BOTTOM_LABEL),
140                                                                                                                 ResourceManager::GetString(L"IDS_COM_POP_SELECTED") + INITIAL_SELECTED_COUNT);
141         __pBottomLabel->SetBackgroundColor(Color(COLOR_BOTTOM_LABEL_BG));
142         __pBottomLabel->SetTextColor(Color(COLOR_BOTTOM_LABEL_FONT));
143         __pBottomLabel->SetTextConfig(FONT_SIZE_BOTTOM_LABEL, LABEL_TEXT_STYLE_BOLD);
144         __pBottomLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
145         __pBottomLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
146         AddControl(__pBottomLabel);
147
148         return E_SUCCESS;
149 }
150
151 result
152 ContactSelectorForm::OnTerminating(void)
153 {
154         result r = E_SUCCESS;
155
156         if (__pPresentationModel != null)
157         {
158                 __pPresentationModel->RemoveContactChangeListener(*this);
159         }
160
161         if (__pSearchListEvent != null)
162         {
163                 delete __pSearchListEvent;
164         }
165         return r;
166 }
167
168 void
169 ContactSelectorForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
170 {
171         SceneManager *pSceneManager = SceneManager::GetInstance();
172         pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
173 }
174
175 void
176 ContactSelectorForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
177 {
178         result r = E_SUCCESS;
179
180         SceneManager* pSceneManager = SceneManager::GetInstance();
181
182         switch (actionId)
183         {
184         case IDA_CHECK_SELECT_ALL_CHECKED:
185                 {
186                         for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
187                         {
188                                 for (int itemIndex = 0; itemIndex < __pListView->GetItemCountAt(groupIndex); itemIndex++)
189                                 {
190                                         __pListView->SetItemChecked(groupIndex, itemIndex, true);
191                                 }
192                         }
193                         __pListView->Invalidate(true);
194                         UpdateBottomLabel();
195                 }
196                 break;
197         case IDA_CHECK_SELECT_ALL_UNCHECKED:
198                 {
199                         for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
200                         {
201                                 for (int itemIndex = 0; itemIndex < __pListView->GetItemCountAt(groupIndex); itemIndex++)
202                                 {
203                                         __pListView->SetItemChecked(groupIndex, itemIndex, false);
204                                 }
205                         }
206                         __pListView->Invalidate(true);
207                         UpdateBottomLabel();
208                 }
209                 break;
210         case IDA_FOOTER_DONE:
211                 {
212                         ArrayList* contactIdList = new (std::nothrow) ArrayList();
213                         contactIdList->Construct();
214
215                         for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
216                         {
217                                 for (int itemIndex = 0; itemIndex < __pListView->GetItemCountAt(groupIndex); itemIndex++)
218                                 {
219                                         bool isChecked  = false;
220                                         isChecked = __pListView->IsItemChecked(groupIndex, itemIndex);
221                                         if (isChecked == true)
222                                         {
223                                                 RecordId contactId = __pPresentationModel->GetContactId(groupIndex, itemIndex);
224                                                 contactIdList->Add(*(new (std::nothrow) Integer(contactId)));
225                                         }
226                                 }
227                         }
228
229                         pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), contactIdList);
230                 }
231                 break;
232         case IDA_FOOTER_CANCEL:
233                 {
234                         r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
235                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
236                 }
237                 break;
238         default:
239                 break;
240         }
241 }
242
243 void
244 ContactSelectorForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
245 {
246         if (pArgs != null)
247         {
248                 __pPresentationModel->InitializeContactList(pArgs);
249
250                 String fastScrollIndex;
251                 for (int i = 0; i < __pPresentationModel->GetContactCount(); i++)
252                 {
253                         fastScrollIndex.Append(__pPresentationModel->GetKey(i));
254                 }
255
256                 __pListView->SetFastScrollIndex(fastScrollIndex, false);
257
258                 Footer* pFooter = GetFooter();
259                 pFooter->SetItemEnabled(1, false);
260         }
261
262         UpdateBottomLabel();
263         __pPresentationModel->AddContactChangeListener(*this);
264 }
265
266 void
267 ContactSelectorForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
268 {
269         __pPresentationModel->RemoveContactChangeListener(*this);
270 }
271
272 void
273 ContactSelectorForm::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
274 {
275         if (mode == SEARCH_BAR_MODE_NORMAL)
276         {
277                 int count = __pPresentationModel->GetSearchedContactCount();
278                 bool isChecked = true;
279
280                 for (int i = 0; i < count; i++)
281                 {
282                         int groupIndex = 0;
283                         int itemIndex = 0;
284
285                         __pPresentationModel->GetItemMainIndex(i, groupIndex, itemIndex);
286
287                         __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, i));
288                 }
289
290                 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
291                 {
292                         int itemCount = __pListView->GetItemCountAt(groupIndex);
293                         for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
294                         {
295                                 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
296                                 {
297                                         isChecked = false;
298                                         break;
299                                 }
300                         }
301                 }
302
303                 __pListView->SetShowState(true);
304                 __pListView->Invalidate(true);
305                 __pCheckLabel->SetShowState(true);
306                 __pSelectAll->SetShowState(true);
307                 __pSelectAll->SetSelected(isChecked);
308                 __pSearchListView->SetShowState(false);
309                 __pPresentationModel->ResetSearchedContactList();
310                 __pSearchListView->UpdateList();
311
312                 UpdateBottomLabel();
313         }
314 }
315
316 void
317 ContactSelectorForm::OnTextValueChanged(const Tizen::Ui::Control& source)
318 {
319         String searchText = __pSearchBar->GetText();
320         searchText.Trim();
321
322         __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_NORMAL);
323
324         if (searchText.GetLength() != 0)
325         {
326                 __pCheckLabel->SetShowState(false);
327                 __pSelectAll->SetShowState(false);
328                 __pListView->SetShowState(false);
329                 __pSearchListView->SetShowState(true);
330
331                 __pSearchListView->UpdateList();
332
333                 int count = __pPresentationModel->GetSearchedContactCount();
334
335                 for (int index = 0; index < count; index++)
336                 {
337                         int groupIndex = 0;
338                         int itemIndex = 0;
339
340                         __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
341                         __pSearchListView->SetItemChecked(0, index, __pListView->IsItemChecked(groupIndex, itemIndex));
342                 }
343
344                 __pSearchListView->Invalidate(true);
345         }
346         else
347         {
348                 __pCheckLabel->SetShowState(true);
349                 __pSelectAll->SetShowState(true);
350                 __pListView->SetShowState(true);
351                 __pSearchListView->SetShowState(false);
352
353                 int count = __pPresentationModel->GetSearchedContactCount();
354                 bool isChecked = true;
355
356                 for (int index = 0; index < count; index++)
357                 {
358                         int groupIndex = 0;
359                         int itemIndex = 0;
360
361                         __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
362                         __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
363                 }
364
365                 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
366                 {
367                         int itemCount = __pListView->GetItemCountAt(groupIndex);
368                         for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
369                         {
370                                 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
371                                 {
372                                         isChecked = false;
373                                         break;
374                                 }
375                         }
376                 }
377
378                 __pSelectAll->SetSelected(isChecked);
379                 __pListView->Invalidate(true);
380         }
381         UpdateBottomLabel();
382 }
383
384 void
385 ContactSelectorForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
386 {
387 }
388
389 int
390 ContactSelectorForm::GetGroupCount(void)
391 {
392         return __pPresentationModel->GetKeyCount();
393 }
394
395 int
396 ContactSelectorForm::GetItemCount(int groupIndex)
397 {
398         int contactCount = __pPresentationModel->GetContactCount(groupIndex);
399         if (contactCount == 0)
400         {
401                 contactCount = -1;
402         }
403
404         return contactCount;
405 }
406
407 Tizen::Ui::Controls::ListItemBase*
408 ContactSelectorForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
409 {
410         String name;
411         Bitmap* pThumbnail = null;
412
413         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
414         CustomItem* pItem = new (std::nothrow) CustomItem();
415         pItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), LIST_ANNEX_STYLE_MARK);
416
417         __pPresentationModel->GetContactItemInfoN(groupIndex, itemIndex, name, pThumbnail);
418         ContactListItem* pCustomElement = new (std::nothrow) ContactListItem(name, pThumbnail);
419         pItem->AddElement(Rectangle(0, 0, itemWidth - (ListItemBase::GetAnnexWidth(LIST_ANNEX_STYLE_MARK) + X_LIST_ITEM_TEXT_MARGIN), pContactsApp->GetListItemSingleLineHeight()), 0, *(static_cast<ICustomElement *>(pCustomElement)));
420
421         return pItem;
422 }
423
424 Tizen::Ui::Controls::GroupItem*
425 ContactSelectorForm::CreateGroupItem(int groupIndex, int itemWidth)
426 {
427         GroupItem* pItem = new (std::nothrow) GroupItem();
428         pItem->Construct(Dimension(itemWidth, H_GROUP_ITEM));
429         pItem->SetElement(__pPresentationModel->GetKey(groupIndex), null);
430
431         return pItem;
432 }
433
434 bool
435 ContactSelectorForm::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
436 {
437         CustomItem* pCustomItem = static_cast<CustomItem *>(pItem);
438         pCustomItem->RemoveAllElements();
439
440         delete pItem;
441         pItem = null;
442
443         return true;
444 }
445
446 bool
447 ContactSelectorForm::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth)
448 {
449         delete pItem;
450         pItem = null;
451
452         return true;
453 }
454
455 void
456 ContactSelectorForm::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
457 {
458 }
459
460 void
461 ContactSelectorForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus state)
462 {
463         if (&listView == __pListView)
464         {
465                 if (listView.IsItemChecked(groupIndex, itemIndex) == true)
466                 {
467                         bool isChecked = true;
468                         for (int groupIndex = 0; groupIndex < listView.GetGroupCount() && isChecked == true; groupIndex++)
469                         {
470                                 for (int itemIndex = 0; itemIndex < listView.GetItemCountAt(groupIndex); itemIndex++)
471                                 {
472                                         if (listView.IsItemChecked(groupIndex, itemIndex) == false)
473                                         {
474                                                 isChecked = false;
475                                                 break;
476                                         }
477                                 }
478                         }
479
480                         __pSelectAll->SetSelected(isChecked);
481                 }
482                 else
483                 {
484                         __pSelectAll->SetSelected(false);
485                 }
486         }
487         else if (&listView == __pSearchListView)
488         {
489                 int count = __pPresentationModel->GetSearchedContactCount();
490
491                 for (int i = 0; i < count; i++)
492                 {
493                         int groupIndex = 0;
494                         int itemIndex = 0;
495
496                         __pPresentationModel->GetItemMainIndex(i, groupIndex, itemIndex);
497
498                         __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, i));
499                 }
500         }
501
502         UpdateBottomLabel();
503 }
504
505 void
506 ContactSelectorForm::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
507 {
508 }
509
510 void
511 ContactSelectorForm::OnContactsChanged(void)
512 {
513         result r = E_SUCCESS;
514
515         SceneManager* pSceneManager = SceneManager::GetInstance();
516
517         r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
518         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
519 }
520
521 void
522 ContactSelectorForm::OnCategoriesChanged(void)
523 {
524 }
525
526 result
527 ContactSelectorForm::CreateFooterButton()
528 {
529         result r = E_SUCCESS;
530
531         Footer* pFooter = GetFooter();
532         pFooter->RemoveAllItems();
533         pFooter->AddActionEventListener(*this);
534
535         FooterItem footerItemCancel;
536         FooterItem footerItemDone;
537
538         footerItemCancel.Construct(IDA_FOOTER_CANCEL);
539         footerItemDone.Construct(IDA_FOOTER_DONE);
540
541         footerItemCancel.SetText(ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
542         footerItemDone.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
543
544         pFooter->AddItem(footerItemCancel);
545         pFooter->AddItem(footerItemDone);
546
547         return r;
548 }
549
550 void
551 ContactSelectorForm::UpdateBottomLabel(void)
552 {
553         int selectedCount = 0;
554         for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
555         {
556                 for (int itemIndex = 0; itemIndex < __pListView->GetItemCountAt(groupIndex); itemIndex++)
557                 {
558                         if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
559                         {
560                                 selectedCount++;
561                         }
562                 }
563         }
564
565         String string = ResourceManager::GetString(L"IDS_COM_POP_SELECTED");
566         string.Append(L" (");
567         string.Append(selectedCount);
568         string.Append(L")");
569         __pBottomLabel->SetText(string);
570         __pBottomLabel->SetPosition(FloatPoint(0, GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
571         __pBottomLabel->Invalidate(false);
572
573         Footer* pFooter = GetFooter();
574         if (selectedCount > 0 && __pBottomLabel->GetShowState() == false)
575         {
576                 __pBottomLabel->SetShowState(true);
577                 __pListView->SetSize(__pListView->GetSize().width, __pListView->GetSize().height - H_BOTTOM_LABEL);
578                 __pSearchListView->SetSize(__pSearchListView->GetSize().width, __pSearchListView->GetSize().height - H_BOTTOM_LABEL);
579                 pFooter->SetItemEnabled(1, true);
580         }
581         else if (selectedCount == 0 && __pBottomLabel->GetShowState() == true)
582         {
583                 __pBottomLabel->SetShowState(false);
584                 __pListView->SetSize(__pListView->GetSize().width, __pListView->GetSize().height + H_BOTTOM_LABEL);
585                 __pSearchListView->SetSize(__pSearchListView->GetSize().width, __pSearchListView->GetSize().height + H_BOTTOM_LABEL);
586                 pFooter->SetItemEnabled(1, false);
587         }
588
589         pFooter->Invalidate(true);
590 }
591
592 void
593 ContactSelectorForm::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
594 {
595         __pListView->ScrollToItem(__pPresentationModel->GetKeyIndex(index), -1);
596         __pListView->Invalidate(false);
597 }
598
599 void
600 ContactSelectorForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
601 {
602 }
603
604 void
605 ContactSelectorForm::OnKeypadOpened(Tizen::Ui::Control& source)
606 {
607         if (__pBottomLabel->GetShowState() == true)
608         {
609                 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
610                 __pBottomLabel->SetPosition(FloatPoint(0, GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
611                 __pBottomLabel->Invalidate(true);
612         }
613         else
614         {
615                 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCHBAR));
616         }
617 }
618
619 void
620 ContactSelectorForm::OnKeypadClosed(Tizen::Ui::Control& source)
621 {
622         if (__pBottomLabel->GetShowState() == true)
623         {
624                 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
625                 __pBottomLabel->SetPosition(FloatPoint(0, GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
626                 __pBottomLabel->Invalidate(true);
627
628                 UpdateBottomLabel();
629         }
630         else
631         {
632                 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCHBAR));
633         }
634 }
635
636 void
637 ContactSelectorForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
638 {
639         if (__pBottomLabel->GetShowState() == true)
640         {
641                 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
642                 __pBottomLabel->SetPosition(FloatPoint(0, GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
643                 __pBottomLabel->Invalidate(true);
644         }
645         else
646         {
647                 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCHBAR));
648         }
649 }
650
651 void
652 ContactSelectorForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
653 {
654         if (keypadAction == KEYPAD_ACTION_SEARCH)
655         {
656                 __pSearchBar->HideKeypad();
657         }
658 }
659
660 void
661 ContactSelectorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
662 {
663         GroupedListView* pList = static_cast<GroupedListView*>(&const_cast<Control&>(source));
664         if (pList != null)
665         {
666                 pList->SetFocus();
667         }
668 }
669
670 void
671 ContactSelectorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
672 {
673 }
674
675 void
676 ContactSelectorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
677 {
678 }
679
680 void
681 ContactSelectorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
682 {
683 }
684
685 void
686 ContactSelectorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
687 {
688 }