I have a simple icon listview and search bar on top much like searchbar sample code in tizen.
I update the list when a key entered in seachbox.(So far same as sample code)
The problem is when the seach bar is foucused, tapping on the Icon List view item is not working though all the lisner interface are implemented and registered . It only woks when i manually press the cancel button on search bar.
Then the iconlistviews OnItemListener works. Please help me what to do.
Here is my code:
#include "AppResourceId.h" #include "AppSeachForm.h" using namespace Tizen::Base; using namespace Tizen::Ui; using namespace Tizen::App::Package; using namespace Tizen::Ui::Controls; using namespace Tizen::Ui::Scenes; using namespace Tizen::Base::Collection; using namespace Tizen::Graphics; using namespace Tizen::Base; using namespace Tizen::App; AppSeachForm::AppSeachForm(void) { } AppSeachForm::~AppSeachForm(void) { } bool AppSeachForm::Initialize() { Form::Construct(APP_SEARCH_FORM); return true; } result AppSeachForm::OnInitializing(void) { result r = E_SUCCESS; __pSearchBar = new SearchBar(); __pSearchBar->Construct(Rectangle(0, 0, GetClientAreaBounds().width, 80)); __pSearchBar->AddSearchBarEventListener(*this); __pSearchBar->AddTextEventListener(*this); __pSearchBar->AddKeypadEventListener(*this); pAppListIconListView = new IconListView(); pAppListIconListView->Construct(Rectangle(0, 110, GetClientAreaBounds().width, GetClientAreaBounds().height-80), Dimension(100, 100), ICON_LIST_VIEW_STYLE_NORMAL, ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL); pAppListIconListView->SetTextOfEmptyList(L"No search broke"); pAppListIconListView->SetItemProvider(*this); pAppListIconListView->AddIconListViewItemEventListener(*this); pAppListIconListView->SetShowState(false); pAppListIconListView->AddTouchEventListener(*this); // Adds the icon list view to the form AddControl(pAppListIconListView); pSearchedAppList = new (std::nothrow) ArrayList(); pSearchedAppList->Construct(); pTotallAppsList = new (std::nothrow) ArrayList(); pTotallAppsList->Construct(); __pSearchBar->SetContent(pAppListIconListView); AddControl(__pSearchBar); SetFormBackEventListener(this); return r; } result AppSeachForm::OnTerminating(void) { result r = E_SUCCESS; return r; } void AppSeachForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) { SceneManager* pSceneManager = SceneManager::GetInstance(); pSceneManager->GoBackward(BackwardSceneTransition()); } void AppSeachForm::OnIconListViewItemStateChanged( Tizen::Ui::Controls::IconListView& listView, int index, Tizen::Ui::Controls::IconListViewItemStatus status) { AppLog("OnListViewItemPressed----------------"); //doesnt work while on searchbar focused. :(:( } bool AppSeachForm::DeleteItem(int index, Tizen::Ui::Controls::IconListViewItem *pItem) { return true; } Tizen::Ui::Controls::IconListViewItem * AppSeachForm::CreateItem(int index) { AppLog("CREATE ITEM+++"); PackageAppInfo* pInfo = static_cast<PackageAppInfo*>(pSearchedAppList->GetAt(index)); AppId appId = pInfo->GetAppDisplayName(); Tizen::Graphics::Bitmap* menuIcon = pInfo->GetAppMenuIconN(); IconListViewItem* pIconListview = new (std::nothrow) IconListViewItem(); pIconListview->Construct(*menuIcon, new String(appId.GetPointer())); return pIconListview; } int AppSeachForm::GetItemCount(void) { AppLog("APP NUMBER %d", pSearchedAppList->GetCount()); return pSearchedAppList->GetCount(); } void AppSeachForm::OnSearchBarModeChanged( Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode) { AppLog("Mode Change"); if (mode == SEARCH_BAR_MODE_INPUT) { pAppListIconListView->SetShowState(false); AppLog("Mode Change SEARCH_BAR_MODE_INPUT"); } else { // __pSearchedTextList->RemoveAll(true); pAppListIconListView->UpdateList(); pAppListIconListView->SetShowState(true); pAppListIconListView->SetEnabled(true); // SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true); } pAppListIconListView->ScrollToItem(0); Invalidate(true); } void AppSeachForm::OnKeypadActionPerformed(Control &source, Tizen::Ui::KeypadAction keypadAction) { AppLog("OnKeypadActionPerformed"); __pSearchBar->HideKeypad(); Invalidate(true); } void AppSeachForm::OnKeypadClosed(Control &source) { AppLog("OnKeypadClosed"); FloatRectangle clientRect = GetClientAreaBoundsF(); FloatRectangle searchBarBounds = CoordinateSystem::AlignToDevice(FloatRectangle(__pSearchBar->GetBoundsF())); __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - searchBarBounds.height)); pAppListIconListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF())); Invalidate(true); } void AppSeachForm::OnKeypadOpened(Control &source) { AppLog("OnKeypadOpened"); FloatRectangle clientRect = GetClientAreaBoundsF(); FloatRectangle searchBarBounds = CoordinateSystem::AlignToDevice(FloatRectangle(__pSearchBar->GetBoundsF())); __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - searchBarBounds.height)); pAppListIconListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF())); Invalidate(true); } void AppSeachForm::OnKeypadWillOpen(Control &source) { AppLog("OnKeypadWillOpen"); Invalidate(true); } void AppSeachForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source) { AppLog("OnKeypadBoundsChanged"); FloatRectangle clientRect = GetClientAreaBoundsF(); FloatRectangle searchBarBounds = CoordinateSystem::AlignToDevice(FloatRectangle(__pSearchBar->GetBoundsF())); __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - searchBarBounds.height)); pAppListIconListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF())); Invalidate(true); } void AppSeachForm::OnTextValueChanged(const Tizen::Ui::Control& source) { AppLog("TExt Value chaged"); pAppListIconListView->SetShowState(true); pSearchedAppList->RemoveAll(); Tizen::Base::String* query = new String( __pSearchBar->GetText().GetPointer()); AppLog("QUERY FROM SEARCH %ls", query->GetPointer()); if(query->GetLength()>0){ AppLog("*********** Txt Legth %d",query->GetLength()); UpdateAppListBasedOnSearch(query); }else{ pAppListIconListView->SetShowState(true); } pAppListIconListView->UpdateList(); Invalidate(true); } void AppSeachForm:: OnTextValueChangeCanceled(const Tizen::Ui::Control& source){ AppLog("OnTextValueChangeCanceled"); } void AppSeachForm::OnSceneActivatedN( const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId, Tizen::Base::Collection::IList *pArgs) { AppLog("*************OnSceneActivatedN"); pTotallAppsList = static_cast<ArrayList*>(pArgs); int number = pTotallAppsList->GetCount(); AppLog("AApp Count : %d", number); } void AppSeachForm:: OnTouchPressed (const Tizen::Ui::Control &source, const Tizen::Graphics::Point ¤tPosition, const Tizen::Ui::TouchEventInfo &touchInfo){ AppLog("***OnTouchPressed"); } void AppSeachForm::OnSceneDeactivated( const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId) { AppLog("*************OnSceneDeactivated"); } void AppSeachForm::UpdateAppListBasedOnSearch(Tizen::Base::String* searchQuery) { //somthing } void AppSeachForm::UpdateAppListBasedOnQuery(Tizen::Base::String* query) { //my imple }